puneetdixit200 commented on code in PR #18901:
URL: https://github.com/apache/hudi/pull/18901#discussion_r3348956274
##########
hudi-common/src/main/java/org/apache/hudi/common/util/LanceUtils.java:
##########
@@ -175,7 +181,42 @@ public List<HoodieColumnRangeMetadata<Comparable>>
readColumnStatsFromMetadata(H
StoragePath filePath,
List<String> columnList,
HoodieIndexVersion indexVersion) {
- throw new UnsupportedOperationException("readColumnStatsFromMetadata is
not yet supported for Lance format");
+ if (columnList == null || columnList.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ try (HoodieFileReader fileReader =
+ HoodieIOFactory.getIOFactory(storage)
+ .getReaderFactory(HoodieRecord.HoodieRecordType.SPARK)
+ .getFileReader(
+ ConfigUtils.DEFAULT_HUDI_CONFIG_FOR_READER,
+ filePath,
+ HoodieFileFormat.LANCE)) {
+ HoodieSchema fileSchema = fileReader.getSchema();
+ List<Pair<String, HoodieSchemaField>> fieldsToIndex = columnList.stream()
+ .map(columnName -> HoodieSchemaUtils.getNestedField(fileSchema,
columnName))
+ .filter(Option::isPresent)
+ .map(Option::get)
+ .collect(Collectors.toList());
+ if (fieldsToIndex.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ List<String> projectedColumns = fieldsToIndex.stream()
Review Comment:
This patch keeps the read-based path so Lance column and partition stats can
be generated now. The writer-side/native Lance stats path looks like larger
follow-up work: the current Lance writer path only writes file data plus
bloom/vector metadata, and I do not see an existing HoodieWriteStat
column-stats hook to reuse there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]