-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.10.0
-
Fix Version/s: 1.10.1
-
Component/s: Connectors / Hive
-
Labels:
-
Flags:Patch
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))
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; }..........
}