kasakrisz commented on code in PR #5251:
URL: https://github.com/apache/hive/pull/5251#discussion_r1618922915


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/mapred/MapredIcebergInputFormat.java:
##########
@@ -75,8 +76,17 @@ public InputSplit[] getSplits(JobConf job, int numSplits) 
throws IOException {
   @Override
   public RecordReader<Void, Container<T>> getRecordReader(InputSplit split, 
JobConf job,
                                                           Reporter reporter) 
throws IOException {
-    IcebergSplit icebergSplit = ((IcebergSplitContainer) split).icebergSplit();
-    return new MapredIcebergRecordReader<>(innerInputFormat, icebergSplit, 
job, reporter);
+    try {
+      if (split instanceof IcebergMergeSplit) {
+        IcebergMergeSplit mergeSplit = (IcebergMergeSplit) split;
+        return new MapredIcebergRecordReader<>(innerInputFormat, mergeSplit, 
job, reporter);
+      } else {
+        IcebergSplit icebergSplit = ((IcebergSplitContainer) 
split).icebergSplit();
+        return new MapredIcebergRecordReader<>(innerInputFormat, icebergSplit, 
job, reporter);
+      }

Review Comment:
   How about
   ```
   InputSplit inputSplit = split instanceof IcebergMergeSplit ? split : 
((IcebergSplitContainer) split).icebergSplit();
   return new MapredIcebergRecordReader<>(innerInputFormat, inputSplit, job, 
reporter);
   ```
   ?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to