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

Rui Li commented on FLINK-16291:
--------------------------------

The {{*}} identifier needs special handling in the parser. So let's ban 
{{count}} in hive module for now.

> Count(*) doesn't work with Hive module
> --------------------------------------
>
>                 Key: FLINK-16291
>                 URL: https://issues.apache.org/jira/browse/FLINK-16291
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / Hive, Table SQL / Planner
>            Reporter: Rui Li
>            Assignee: Rui Li
>            Priority: Critical
>             Fix For: 1.11.0
>
>
> The following test
> {code}
>       @Test
>       public void test() throws Exception {
>               hiveShell.execute("create table foo (x int)");
>               TableEnvironment tableEnv = getTableEnvWithHiveCatalog();
>               tableEnv.unloadModule("core");
>               tableEnv.loadModule("hive", new 
> HiveModule(hiveCatalog.getHiveVersion()));
>               tableEnv.loadModule("core", CoreModule.INSTANCE);
>               TableUtils.collectToList(tableEnv.sqlQuery("select count(*) 
> from foo"));
>       }
> {code}
> fails with
> {noformat}
> Caused by: org.apache.calcite.runtime.CalciteContextException: At line 1, 
> column 14: Unknown identifier '*'
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>       at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>       at 
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)
>       at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:834)
>       at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:819)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4840)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5666)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5586)
>       at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:317)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1690)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1675)
>       at 
> org.apache.calcite.sql.SqlOperator.constructArgTypeList(SqlOperator.java:593)
>       at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:237)
>       at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:219)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5599)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5586)
>       at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:139)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1690)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1675)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:478)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4104)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3388)
> {noformat}



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

Reply via email to