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

Krisztian Kasa commented on HIVE-30211:
---------------------------------------

[~Aggarwal_Raghav]
I'm unclear on the advantage of the new API introduced in HIVE-5737.

The description says that {{StructObjectInspector}} is better because column 
names (function parameter names) are exposed to the UDTF implementation. 
However, in you patch:

{code}
List fieldNames = IntStream.range(0, inputsOIs.length)
.mapToObj(i -> "col_" + i)
.toList();
{code}

Are generated names like col_0, col_1 ... col_n the only names passed here?

All existing built-in UDTFs in Hive still use the old API. Could you please 
share a reproduction or example where meaningful column names are passed 
instead of synthetic ones? If that isn't supported, it might make more sense to 
un-deprecate the old initialize method and deprecate the new one instead.


>  Fix IllegalStateException in Calcite HiveFunctionHelper for GenericUDTF 
> using StructObjectInspector
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-30211
>                 URL: https://issues.apache.org/jira/browse/HIVE-30211
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Raghav Aggarwal
>            Assignee: Raghav Aggarwal
>            Priority: Major
>              Labels: pull-request-available
>
> GenericUDTF explicitly deprecates the array-based initialization method in 
> favor of the struct-based overload:
> {code:java}
> public StructObjectInspector initialize(StructObjectInspector argOIs) throws 
> UDFArgumentException {
> ...
> }
> @Deprecated
> public StructObjectInspector initialize(ObjectInspector[] argOIs) throws 
> UDFArgumentException {
>   throw new IllegalStateException("Should not be called directly");
> }
> {code}
> However, during Calcite query compilation, 
> {{HiveFunctionHelper.getReturnType()}} directly calls the deprecated array 
> overload, resulting in {{java.lang.IllegalStateException: Should not be 
> called directly}}
>  
> This bug forces all UDTF implementations to implement the deprecated method, 
> which violates the API contract and creates issues for:
>   1. New native UDTFs (e.g., Iceberg snapshot lineage functions like 
> iceberg_ancestors_of).
>   2. 3rd-party / custom user UDTFs (e.g., external jars loaded dynamically 
> via ADD JAR in Beeline).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to