Skip to content

Commit 46baa21

Browse files
committed
Add latest metadata path field
1 parent bd97225 commit 46baa21

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

xtable-api/src/main/java/org/apache/xtable/model/InternalTable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ public class InternalTable {
5050
List<InternalPartitionField> partitioningFields;
5151
// latest commit(write) on the table.
5252
Instant latestCommitTime;
53+
// Path to latest metadata
54+
String latestMetdataPath;
5355
}

xtable-core/src/main/java/org/apache/xtable/delta/DeltaTableExtractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public InternalTable table(DeltaLog deltaLog, String tableName, Long version) {
6262
.partitioningFields(partitionFields)
6363
.readSchema(schema)
6464
.latestCommitTime(Instant.ofEpochMilli(snapshot.timestamp()))
65+
.latestMetdataPath(snapshot.deltaLog().logPath().toString())
6566
.build();
6667
}
6768
}

xtable-core/src/main/java/org/apache/xtable/hudi/HudiTableExtractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public InternalTable table(HoodieTableMetaClient metaClient, HoodieInstant commi
8787
.partitioningFields(partitionFields)
8888
.readSchema(canonicalSchema)
8989
.latestCommitTime(HudiInstantUtils.parseFromInstantTime(commit.getTimestamp()))
90+
.latestMetdataPath(metaClient.getMetaPath().toString())
9091
.build();
9192
}
9293

xtable-core/src/main/java/org/apache/xtable/iceberg/IcebergConversionSource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@
3535

3636
import org.apache.hadoop.conf.Configuration;
3737

38+
import org.apache.iceberg.BaseTable;
3839
import org.apache.iceberg.DataFile;
3940
import org.apache.iceberg.FileScanTask;
4041
import org.apache.iceberg.PartitionSpec;
4142
import org.apache.iceberg.Schema;
4243
import org.apache.iceberg.Snapshot;
4344
import org.apache.iceberg.Table;
45+
import org.apache.iceberg.TableOperations;
4446
import org.apache.iceberg.TableScan;
4547
import org.apache.iceberg.catalog.Namespace;
4648
import org.apache.iceberg.catalog.TableIdentifier;
@@ -107,6 +109,7 @@ private FileIO initTableOps() {
107109
public InternalTable getTable(Snapshot snapshot) {
108110
Table iceTable = getSourceTable();
109111
Schema iceSchema = iceTable.schemas().get(snapshot.schemaId());
112+
TableOperations iceOps = ((BaseTable) iceTable).operations();
110113
IcebergSchemaExtractor schemaExtractor = IcebergSchemaExtractor.getInstance();
111114
InternalSchema irSchema = schemaExtractor.fromIceberg(iceSchema);
112115

@@ -128,6 +131,7 @@ public InternalTable getTable(Snapshot snapshot) {
128131
.latestCommitTime(Instant.ofEpochMilli(snapshot.timestampMillis()))
129132
.readSchema(irSchema)
130133
.layoutStrategy(dataLayoutStrategy)
134+
.latestMetdataPath(iceOps.current().metadataFileLocation())
131135
.build();
132136
}
133137

0 commit comments

Comments
 (0)