Csaba Ringhofer created IMPALA-14575:
----------------------------------------

             Summary: Optimize constants in HiveUdfCall
                 Key: IMPALA-14575
                 URL: https://issues.apache.org/jira/browse/IMPALA-14575
             Project: IMPALA
          Issue Type: Sub-task
          Components: Backend, Frontend
            Reporter: Csaba Ringhofer


Hive can signal to a UDF that an argument is constant with 
ConstantObjectInspector: 
https://github.com/apache/hive/blob/d9ec04156d84bedbaa9f8dc40c27dbb88a3b9f49/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java#L1440
https://github.com/apache/hive/blob/d9ec04156d84bedbaa9f8dc40c27dbb88a3b9f49/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java#L1512

This is used by st_ relation functions to optimize the common case of comparing 
many geometries to a constant geometry:
https://github.com/apache/hive/blob/d9ec04156d84bedbaa9f8dc40c27dbb88a3b9f49/ql/src/java/org/apache/hadoop/hive/ql/udf/esri/ST_GeometryRelational.java#L93

Impala knows in c++ whether an argument is constant, but this information is 
not passed to the Java side:
https://github.com/apache/impala/blob/2ac5a24dc0cfc9c9e7a1fc86cccf94cd1a2900af/common/thrift/Frontend.thrift#L41

Optimizing constants could help by:
- passing the argument from cpp to Java only once
- allowing const aware optimizations in UDFs

TODO:
only checked generic UDFs, not sure if this exists for legacy UDFs



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to