rdblue commented on a change in pull request #1478:
URL: https://github.com/apache/iceberg/pull/1478#discussion_r496313105



##########
File path: 
mr/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergObjectInspector.java
##########
@@ -72,7 +75,20 @@ public ObjectInspector primitive(Type.PrimitiveType 
primitiveType) {
         primitiveTypeInfo = TypeInfoFactory.booleanTypeInfo;
         break;
       case DATE:
-        return IcebergDateObjectInspector.get();
+        // create the correct inspector based on whether we're working with 
Hive2 or Hive3 dependencies
+        // we need to do this because there is a breaking API change in 
DateObjectInspector between Hive2 and Hive3
+        if (MetastoreUtil.hive3PresentOnClasspath()) {

Review comment:
       Because the object inspector is a singleton, this could be done just 
once to set a static field. Then all this would need to do is return the 
`IcebergObjectInspector.DATE_INSPECTOR`. I think that would be better than 
running reflect code every invocation.




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

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