[ https://issues.apache.org/jira/browse/FLINK-15592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17015607#comment-17015607 ]
Jark Wu commented on FLINK-15592: --------------------------------- cc [~lirui] [~bli], it seems that the ModuleManager resolve the {{ROW_NUMBER()}} as a Hive function. However, according to FLIP-68 the resolve order should be the moudle order which should be {{core}} and then {{hive}}. I guess it might be a bug in the resolve order? > Streaming sql throw hive exception when it doesn't use any hive table > --------------------------------------------------------------------- > > Key: FLINK-15592 > URL: https://issues.apache.org/jira/browse/FLINK-15592 > Project: Flink > Issue Type: Bug > Components: Table SQL / Planner > Affects Versions: 1.10.0 > Reporter: Jeff Zhang > Priority: Critical > Fix For: 1.10.0 > > > I use the following streaming sql to query a kafka table whose metadata is > store in hive metastore via HiveCatalog. But it will throw hive related > exception which is very confusing. > SQL > {code} > SELECT * > FROM ( > SELECT *, > ROW_NUMBER() OVER( > ORDER BY event_ts) AS rownum > FROM source_kafka) > WHERE rownum <= 10 > {code} > Exception > {code} > Caused by: org.apache.flink.table.api.ValidationException: SQL validation > failed. java.lang.reflect.InvocationTargetException > at > org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:130) > at > org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:105) > at > org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:127) > at > org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:66) > at > org.apache.flink.table.api.internal.TableEnvironmentImpl.sqlQuery(TableEnvironmentImpl.java:464) > at > org.apache.zeppelin.flink.sql.AbstractStreamSqlJob.run(AbstractStreamSqlJob.java:103) > ... 13 more > Caused by: java.lang.RuntimeException: > java.lang.reflect.InvocationTargetException > at > org.apache.flink.table.planner.functions.utils.HiveFunctionUtils.invokeGetResultType(HiveFunctionUtils.java:77) > at > org.apache.flink.table.planner.functions.utils.HiveAggSqlFunction.lambda$createReturnTypeInference$0(HiveAggSqlFunction.java:82) > at > org.apache.calcite.sql.SqlOperator.inferReturnType(SqlOperator.java:470) > at > org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:437) > at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:303) > at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:219) > at > org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5600) > at > org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5587) > at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1691) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1676) > at > org.apache.calcite.sql.SqlCallBinding.getOperandType(SqlCallBinding.java:237) > at > org.apache.calcite.sql.type.OrdinalReturnTypeInference.inferReturnType(OrdinalReturnTypeInference.java:40) > at > org.apache.calcite.sql.type.SqlTypeTransformCascade.inferReturnType(SqlTypeTransformCascade.java:54) > at > org.apache.calcite.sql.SqlOperator.inferReturnType(SqlOperator.java:470) > at > org.apache.calcite.sql.SqlOperator.validateOperands(SqlOperator.java:437) > at > org.apache.calcite.sql.SqlOverOperator.deriveType(SqlOverOperator.java:86) > at > org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5600) > at > org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5587) > at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1691) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1676) > at > org.apache.calcite.sql.SqlAsOperator.deriveType(SqlAsOperator.java:133) > at > org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5600) > at > org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5587) > at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1691) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1676) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:479) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4105) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3389) > at > org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) > at > org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1008) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:968) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3122) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3104) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3376) > at > org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) > at > org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1008) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:968) > at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:943) > at > org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:650) > at > org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:126) > ... 18 more > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.apache.flink.table.planner.functions.utils.HiveFunctionUtils.invokeGetResultType(HiveFunctionUtils.java:73) > ... 63 more > Caused by: org.apache.flink.table.functions.hive.FlinkHiveUDFException: > Failed to get Hive result type from > org.apache.hadoop.hive.ql.udf.generic.GenericUDAFRowNumber > at > org.apache.flink.table.functions.hive.HiveGenericUDAF.getHiveResultType(HiveGenericUDAF.java:202) > ... 68 more > Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Only COMPLETE > mode supported for row_number function > at > org.apache.hadoop.hive.ql.udf.generic.GenericUDAFRowNumber$GenericUDAFAbstractRowNumberEvaluator.init(GenericUDAFRowNumber.java:100) > at > org.apache.flink.table.functions.hive.HiveGenericUDAF.init(HiveGenericUDAF.java:93) > at > org.apache.flink.table.functions.hive.HiveGenericUDAF.getHiveResultType(HiveGenericUDAF.java:196) > ... 68 more > ERROR > Took 2 sec. Last updated by anonymous at January 15 2020, 11:12:16 AM. > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)