[ 
https://issues.apache.org/jira/browse/HIVE-11462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659100#comment-14659100
 ] 

Hari Sankar Sivarama Subramaniyan commented on HIVE-11462:
----------------------------------------------------------

[~gopalv] A couple of comments on the WIP patch.
1. Object[] constantValues = new Object[arguments.length]; I think we can reuse 
ret field to store the constantValues and hence the call to 
ObjectInspectorFactory.getStandardConstantStructObjectInspector(fname, 
Arrays.asList(arguments), Arrays.asList(ret)) should work fine.
2.  boolean constantStruct = true; I think constantStruct has to be a field of 
the GenericUDFStruct so that whenever someone calls 
GenericUDFStruct.evaluate(), we should check if the struct is a constant struct 
and return right away from the initialized value without getting into any of 
the following for loop in evaluate().
{code}
    for (int i = 0; i < arguments.length; i++) {
      ret[i] = arguments[i].get();
    }
{code}

Thanks
Hari

> GenericUDFStruct should constant fold at compile time
> -----------------------------------------------------
>
>                 Key: HIVE-11462
>                 URL: https://issues.apache.org/jira/browse/HIVE-11462
>             Project: Hive
>          Issue Type: Bug
>          Components: UDF
>    Affects Versions: 2.0.0
>            Reporter: Gopal V
>         Attachments: HIVE-11462.WIP.patch
>
>
> HIVE-11428 introduces a constant Struct Object, which is available for the 
> runtime operators to assume as a constant parameter.
> This operator isn't constant folded during compilation since the UDF returns 
> a complex type, which is logged as warning by the constant propogation layer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to