kokila-19 commented on code in PR #6138:
URL: https://github.com/apache/hive/pull/6138#discussion_r2453022308


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java:
##########
@@ -804,6 +804,8 @@ public final class FunctionRegistry {
           (Class<? extends GenericUDF>) 
Class.forName("org.apache.iceberg.mr.hive.udf.GenericUDFIcebergDay"));
       system.registerGenericUDF("iceberg_hour",
           (Class<? extends GenericUDF>) 
Class.forName("org.apache.iceberg.mr.hive.udf.GenericUDFIcebergHour"));
+      system.registerGenericUDF("iceberg_zorder",

Review Comment:
   Yes, if the udf is not registered we get error
   
   ```
   Caused by: org.apache.hive.com.esotericsoftware.kryo.kryo5.KryoException: 
java.lang.SecurityException: UDF 
org.apache.iceberg.mr.hive.udf.GenericUDFIcebergZorder is not allowed
   Serialization trace:
   genericUDF (org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc)
   colExprMap (org.apache.hadoop.hive.ql.plan.ReduceSinkDesc)
   conf (org.apache.hadoop.hive.ql.exec.ReduceSinkOperator)
   childOperators (org.apache.hadoop.hive.ql.exec.SelectOperator)
   childOperators (org.apache.hadoop.hive.ql.exec.UDTFOperator)
   childOperators (org.apache.hadoop.hive.ql.exec.SelectOperator)
   childOperators (org.apache.hadoop.hive.ql.exec.TableScanOperator)
   aliasToWork (org.apache.hadoop.hive.ql.plan.MapWork)
           at 
org.apache.hive.com.esotericsoftware.kryo.kryo5.serializers.ReflectField.read(ReflectField.java:146)
           at 
org.apache.hive.com.esotericsoftware.kryo.kryo5.serializers.FieldSerializer.read(FieldSerializer.java:129)
           at 
org.apache.hive.com.esotericsoftware.kryo.kryo5.Kryo.readClassAndObject(Kryo.java:877)
           at 
org.apache.hadoop.hive.ql.exec.SerializationUtilities$KryoWithHooks.readClassAndObject(SerializationUtilities.java:184)
   
   Caused by: java.lang.SecurityException: UDF 
org.apache.iceberg.mr.hive.udf.GenericUDFIcebergZorder is not allowed
           at 
org.apache.hadoop.hive.llap.daemon.impl.LlapDaemon$LlapGlobalUdfChecker.preRead(LlapDaemon.java:789)
           at 
org.apache.hadoop.hive.ql.exec.SerializationUtilities$KryoWithHooks.ponderGlobalPreReadHook(SerializationUtilities.java:169)
   ```
   
   Reason:
   When udf is registered using FunctionRegistry 
   
   - Creates a FunctionInfo with FunctionType.BUILTIN
   - Adds the class to the builtIns set in 
[Registry](https://github.com/apache/hive/blob/434749050102d1f0ea90eb2a88659f47f54bf2ae/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java#L570)
   - During Kryo deserialization, FunctionRegistry.isBuiltInFuncClass() is 
checked 
[here](https://github.com/apache/hive/blob/434749050102d1f0ea90eb2a88659f47f54bf2ae/llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/StaticPermanentFunctionChecker.java#L61)
 to verify if the udf is registered.
   - Only registered built-in UDFs are allowed.
   
   



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