jonvex commented on code in PR #10422:
URL: https://github.com/apache/hudi/pull/10422#discussion_r1476613616


##########
hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/HoodieParquetInputFormat.java:
##########
@@ -91,9 +94,42 @@ private void initAvroInputFormat() {
     }
   }
 
+  private static boolean checkIfHudiTable(final InputSplit split, final 
JobConf job) {
+    try {
+      Option<Path> tablePathOpt = TablePathUtils.getTablePath(((FileSplit) 
split).getPath(), job);
+      if (!tablePathOpt.isPresent()) {
+        return false;
+      }
+      return tablePathOpt.get().getFileSystem(job).exists(new 
Path(tablePathOpt.get(), HoodieTableMetaClient.METAFOLDER_NAME));
+    } catch (IOException e) {
+      return false;
+    }
+  }
+
   @Override
   public RecordReader<NullWritable, ArrayWritable> getRecordReader(final 
InputSplit split, final JobConf job,
                                                                    final 
Reporter reporter) throws IOException {
+
+    if (HoodieFileGroupReaderRecordReader.useFilegroupReader(job)) {
+      try {
+        if (!(split instanceof FileSplit) || !checkIfHudiTable(split, job)) {
+          return super.getRecordReader(split, job, reporter);
+        }
+        if (supportAvroRead && 
HoodieColumnProjectionUtils.supportTimestamp(job)) {
+          return new HoodieFileGroupReaderRecordReader((s, j, r) -> {
+            try {
+              return new ParquetRecordReaderWrapper(new 
HoodieTimestampAwareParquetInputFormat(), s, j, r);
+            } catch (InterruptedException e) {
+              throw new RuntimeException(e);
+            }
+          }, split, job, reporter);
+        } else {
+          return new HoodieFileGroupReaderRecordReader(super::getRecordReader, 
split, job, reporter);

Review Comment:
   I added your suggestion. Could you please let me know if that fixes the 
issue? Thanks!



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