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

[jira] [Commented] (FLINK-16268) Failed to run rank over window with Hive built-in functions

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

Rui Li commented on FLINK-16268:
--------------------------------

Although hive UDF has been migrated to new type inference, it's only pushed to 1.12, which means 1.11 users still suffer from the problem here.
[~lzljs3620320] Do you think it makes sense to have a fix (the hacky way) just for 1.11?

> Failed to run rank over window with Hive built-in functions
> -----------------------------------------------------------
>
>                 Key: FLINK-16268
>                 URL: https://issues.apache.org/jira/browse/FLINK-16268
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Hive, Table SQL / Planner
>    Affects Versions: 1.10.0
>            Reporter: Rui Li
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The following test:
> {code}
> 	@Test
> 	public void test() throws Exception {
> 		hiveShell.execute("create table emp (dep string,name string,salary int)");
> 		hiveShell.insertInto("default", "emp").addRow("1", "A", 1).addRow("1", "B", 2).addRow("2", "C", 3).commit();
> 		TableEnvironment tableEnv = // create table env...
> 		tableEnv.unloadModule("core");
> 		tableEnv.loadModule("hive", new HiveModule(hiveCatalog.getHiveVersion()));
> 		tableEnv.loadModule("core", CoreModule.INSTANCE);
> 		List<Row> results = TableUtils.collectToList(tableEnv.sqlQuery("select dep,name,rank() over (partition by dep order by salary) as rnk from emp"));
> 	}
> {code}
> fails with:
> {noformat}
> java.lang.NullPointerException
> 	at org.apache.flink.table.functions.hive.conversion.HiveInspectors.toInspectors(HiveInspectors.java:126)
> 	at org.apache.flink.table.functions.hive.HiveGenericUDF.getHiveResultType(HiveGenericUDF.java:97)
> 	at org.apache.flink.table.functions.hive.HiveScalarFunction.getResultType(HiveScalarFunction.java:75)
> 	at org.apache.flink.table.planner.functions.utils.UserDefinedFunctionUtils$.getResultTypeOfScalarFunction(UserDefinedFunctionUtils.scala:620)
> 	at org.apache.flink.table.planner.expressions.PlannerScalarFunctionCall.resultType(call.scala:165)
> 	at org.apache.flink.table.planner.expressions.PlannerTypeInferenceUtilImpl.runTypeInference(PlannerTypeInferenceUtilImpl.java:75)
> 	at org.apache.flink.table.expressions.resolver.rules.ResolveCallByArgumentsRule$ResolvingCallVisitor.runLegacyTypeInference(ResolveCallByArgumentsRule.java:213)
> 	at org.apache.flink.table.expressions.resolver.rules.ResolveCallByArgumentsRule$ResolvingCallVisitor.lambda$visit$2(ResolveCallByArgumentsRule.java:134)
> 	at java.util.Optional.orElseGet(Optional.java:267)
> 	at org.apache.flink.table.expressions.resolver.rules.ResolveCallByArgumentsRule$ResolvingCallVisitor.visit(ResolveCallByArgumentsRule.java:134)
> 	at org.apache.flink.table.expressions.resolver.rules.ResolveCallByArgumentsRule$ResolvingCallVisitor.visit(ResolveCallByArgumentsRule.java:89)
> 	at org.apache.flink.table.expressions.ApiExpressionVisitor.visit(ApiExpressionVisitor.java:39)
> 	at org.apache.flink.table.expressions.UnresolvedCallExpression.accept(UnresolvedCallExpression.java:135)
> 	at org.apache.flink.table.expressions.resolver.rules.ResolveCallByArgumentsRule.lambda$apply$0(ResolveCallByArgumentsRule.java:83)
> 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
> 	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> 	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
> 	at org.apache.flink.table.expressions.resolver.rules.ResolveCallByArgumentsRule.apply(ResolveCallByArgumentsRule.java:84)
> ......
> {noformat}



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