You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jingsong Lee (Jira)" <ji...@apache.org> on 2020/04/29 08:17:00 UTC

[jira] [Closed] (FLINK-17334) Flink does not support HIVE UDFs with primitive return types

     [ https://issues.apache.org/jira/browse/FLINK-17334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jingsong Lee closed FLINK-17334.
--------------------------------
    Resolution: Fixed

release-1.10: 8ef57fa9e844d74354aef96531f09d5daf8f121f

>  Flink does not support HIVE UDFs with primitive return types
> -------------------------------------------------------------
>
>                 Key: FLINK-17334
>                 URL: https://issues.apache.org/jira/browse/FLINK-17334
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Hive
>    Affects Versions: 1.10.0
>            Reporter: xin.ruan
>            Assignee: xin.ruan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.10.1
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> We are currently migrating Hive UDF to Flink. While testing compatibility, we found that Flink cannot support primitive types like boolean, int, etc.
> Hive UDF:
> public class UDFTest extends UDF {
>  public boolean evaluate(String content) {
>  if (StringUtils.isEmpty(content))
> { return false; }
> else
> { return true; }
> }
> }
> We found that the following error will be reported:
>  Caused by: org.apache.flink.table.functions.hive.FlinkHiveUDFException: Class boolean is not supported yet
>  at org.apache.flink.table.functions.hive.conversion.HiveInspectors.getObjectInspector(HiveInspectors.java:372)
>  at org.apache.flink.table.functions.hive.HiveSimpleUDF.getHiveResultType(HiveSimpleUDF.java:133)
> I found that if I add the type comparison in HiveInspectors.getObjectInspector to the primitive type, I can get the correct result.
> as follows:
>  public static ObjectInspector getObjectInspector(HiveShim hiveShim, Class clazz){       
>    ..........
>           else if (clazz.equals(boolean.class) || clazz.equals(Boolean.class) ||                  clazz.equals(BooleanWritable.class))
> {                                       typeInfo = TypeInfoFactory.booleanTypeInfo;                                 }
>          ..........
> }
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)