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

Rui Li resolved FLINK-16268.
----------------------------
    Resolution: Fixed

> 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
>            Assignee: Rui Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.3
>
>          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)

Reply via email to