Skip to content

Commit

Permalink
Address review comments and fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
codope committed Jan 27, 2025
1 parent c32bac2 commit d0bf390
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ public boolean isHudiMetadataEnabled()
}

@Config("hive.hudi-tables-use-merged-view")
@ConfigDescription("For Hudi tables prefer to fetch the list of files from the merged file system view")
@ConfigDescription("For Hudi tables, a comma-separated list in the form of <schema>.<table> which should prefer to fetch the list of files from the merged file system view")
public HiveClientConfig setHudiTablesUseMergedView(String hudiTablesUseMergedView)
{
this.hudiTablesUseMergedView = hudiTablesUseMergedView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public HiveSessionProperties(HiveClientConfig hiveClientConfig, OrcFileWriterCon
false),
stringProperty(
HUDI_TABLES_USE_MERGED_VIEW,
"For Hudi tables, use merged view to read data",
"For Hudi tables, a comma-separated list in the form of <schema>.<table> which should use merged view to read data",
hiveClientConfig.getHudiTablesUseMergedView(),
false),
booleanProperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,22 @@ public HudiDirectoryLister(Configuration conf, ConnectorSession session, Table t
.setConf(actualConfig)
.setBasePath(table.getStorage().getLocation())
.build();
this.latestInstant = metaClient.getActiveTimeline()
String latestCompactionInstantTime = metaClient.getActiveTimeline()
.getCommitsAndCompactionTimeline()
.filterCompletedInstants()
.filter(instant -> !HoodieTableType.MERGE_ON_READ.equals(metaClient.getTableType()) || instant.getAction().equals(HoodieTimeline.COMMIT_ACTION))
.filter(instant -> HoodieTableType.MERGE_ON_READ.equals(metaClient.getTableType()) && instant.getAction().equals(HoodieTimeline.COMPACTION_ACTION))
.lastInstant()
.map(HoodieInstant::getTimestamp).orElseThrow(() -> new RuntimeException("No active instant found"));
.map(HoodieInstant::getTimestamp).orElse(null);
if (latestCompactionInstantTime != null) {
this.latestInstant = latestCompactionInstantTime;
}
else {
this.latestInstant = metaClient.getActiveTimeline()
.getCommitsTimeline()
.filterCompletedInstants()
.lastInstant()
.map(HoodieInstant::getTimestamp).orElseThrow(() -> new RuntimeException("No active instant found"));
}
HoodieEngineContext engineContext = new HoodieLocalEngineContext(actualConfig);
HoodieMetadataConfig metadataConfig = HoodieMetadataConfig.newBuilder()
.enable(metadataEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void testDefaults()
.setUseRecordPageSourceForCustomSplit(true)
.setFileSplittable(true)
.setHudiMetadataEnabled(false)
.setHudiTablesUseMergedView(null)
.setThriftProtocol(Protocol.BINARY)
.setThriftBufferSize(new DataSize(128, BYTE))
.setCopyOnFirstWriteConfigurationEnabled(true)
Expand Down Expand Up @@ -279,6 +280,7 @@ public void testExplicitPropertyMappings()
.put("hive.use-record-page-source-for-custom-split", "false")
.put("hive.file-splittable", "false")
.put("hive.hudi-metadata-enabled", "true")
.put("hive.hudi-tables-use-merged-view", "default.user")
.put("hive.internal-communication.thrift-transport-protocol", "COMPACT")
.put("hive.internal-communication.thrift-transport-buffer-size", "256B")
.put("hive.copy-on-first-write-configuration-enabled", "false")
Expand Down Expand Up @@ -403,6 +405,7 @@ public void testExplicitPropertyMappings()
.setUseRecordPageSourceForCustomSplit(false)
.setFileSplittable(false)
.setHudiMetadataEnabled(true)
.setHudiTablesUseMergedView("default.user")
.setThriftProtocol(Protocol.COMPACT)
.setThriftBufferSize(new DataSize(256, BYTE))
.setCopyOnFirstWriteConfigurationEnabled(false)
Expand Down

0 comments on commit d0bf390

Please sign in to comment.