linliu-code commented on code in PR #13300:
URL: https://github.com/apache/hudi/pull/13300#discussion_r2102980655


##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroReaderContext.java:
##########
@@ -80,12 +89,27 @@ public ClosableIterator<IndexedRecord> 
getFileRecordIterator(
       long length,
       Schema dataSchema,
       Schema requiredSchema,
-      HoodieStorage storage
+      HoodieStorage storage,
+      Option<Predicate> filter
   ) throws IOException {
+    HoodieFileFormat fileFormat = detectFileFormat(filePath);
     HoodieAvroFileReader reader = (HoodieAvroFileReader) 
HoodieIOFactory.getIOFactory(storage)
         
.getReaderFactory(HoodieRecord.HoodieRecordType.AVRO).getFileReader(new 
HoodieConfig(),
-            filePath, HoodieFileFormat.PARQUET, Option.empty());
-    return reader.getIndexedRecordIterator(dataSchema, requiredSchema);
+            filePath, fileFormat, Option.empty());
+    if (!filter.isPresent() || !(reader instanceof 
HoodieAvroHFileReaderImplBase)) {
+      return reader.getIndexedRecordIterator(dataSchema, requiredSchema);
+    } else {
+      // Only hfile reader accepts keys or key prefixes.
+      HoodieAvroHFileReaderImplBase hfileReader = 
(HoodieAvroHFileReaderImplBase) reader;
+      List<Expression> children = filter.get().getChildren();
+      List<String> keysOrPrefixes = children.subList(1, children.size())
+          .stream().map(e -> (String) 
e.eval(null)).collect(Collectors.toList());

Review Comment:
   I have a task "New abstraction for expressions and filters, for indexing 
subsystem", and may need additional scoping for it.



-- 
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]

Reply via email to