tprelle commented on a change in pull request #3242:
URL: https://github.com/apache/iceberg/pull/3242#discussion_r728919625



##########
File path: 
mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergInputFormat.java
##########
@@ -100,23 +101,39 @@
                  .toArray(InputSplit[]::new);
   }
 
+  // Need for testing
+  protected void checkHive3Present() {
+    Preconditions.checkArgument(MetastoreUtil.hive3PresentOnClasspath(), 
"Vectorization only supported for Hive 3+");
+  }
+
+  protected RecordReader<Void, Container<Record>> 
getVectorizedRecordReader(IcebergSplit icebergSplit,
+                                                                            
JobConf job,
+                                                                            
Reporter reporter) {
+    return (RecordReader) HIVE_VECTORIZED_RECORDREADER_CTOR.newInstance(
+            new org.apache.iceberg.mr.mapreduce.IcebergInputFormat<>(),
+            icebergSplit,
+            job,
+            reporter);
+  }
+
   @Override
   public RecordReader<Void, Container<Record>> getRecordReader(InputSplit 
split, JobConf job,
                                                                Reporter 
reporter) throws IOException {
     String[] selectedColumns = ColumnProjectionUtils.getReadColumnNames(job);
     job.setStrings(InputFormatConfig.SELECTED_COLUMNS, selectedColumns);
-
-    if (HiveConf.getBoolVar(job, 
HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED)) {
-      Preconditions.checkArgument(MetastoreUtil.hive3PresentOnClasspath(), 
"Vectorization only supported for Hive 3+");
-
+    // Testing if vectorization was enabled and ok for hive
+    if (HiveConf.getBoolVar(job, HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED) 
&&
+            Utilities.getVectorizedRowBatchCtx(job) != null) {
+      checkHive3Present();

Review comment:
       good idea.
   i just fix 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]



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

Reply via email to