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

xin.ruan commented on FLINK-17334:
----------------------------------

Hi all, I want to support array and map types, but I found that I can't get the 
type of key and value in Map type, and can't create the corresponding object 
inspector, I have added the picture to my question。

If I want to create Map's object inspector, I need to call

ObjectInspectorFactory.getStandardMapObjectInspector(getObjectInspector(mapType.getMapKeyTypeInfo()),
 getObjectInspector(mapType.getMapValueTypeInfo()));

And I need to get MapValueTypeInfo() and MapKeyTypeInfo()

>  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
>
>         Attachments: screenshot-1.png
>
>   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;                 
>                 
>           }
>          ..........
> }
>  !screenshot-1.png! 
>  



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

Reply via email to