[jira] [Created] (FLINK-22999) Using the column 'user' in Table API is not possible

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-22999) Using the column 'user' in Table API is not possible

Shang Yuanchun (Jira)
Martijn Visser created FLINK-22999:
--------------------------------------

             Summary: Using the column 'user' in Table API is not possible
                 Key: FLINK-22999
                 URL: https://issues.apache.org/jira/browse/FLINK-22999
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
            Reporter: Martijn Visser


Using the following code:

{code:java}
        final StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env);

        final DataStream<Row> clickStream =
                env.fromElements(
                        Row.of("Bob", "ORDER_ENTERED", "1623758400"),
                        Row.of("Alice", "ORDER_ENTERED", "1623758700"),
                        Row.of("Bob", "ADDRESS_ENTERED", "1623759000"));

        final Table clickTable = tableEnv.fromDataStream(clickStream).as("user","pageType", "ts");

        tableEnv.createTemporaryView("ClickStream", clickTable);

        tableEnv.executeSql("CREATE VIEW FirstPageVisits AS SELECT user, pageType, ts FROM ClickStream WHERE pageType = 'ORDER_ENTERED'");

clickTable.execute().print();
{code}

Throws the following stacktrace:

{code:java}
Exception in thread "main" org.apache.flink.table.api.ValidationException: SQL validation failed. From line 1, column 8 to line 1, column 11: Column 'USER' not found in any table; did you mean 'user'?
        at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$validate(FlinkPlannerImpl.scala:164)
        at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:107)
        at org.apache.flink.table.planner.utils.Expander.expanded(Expander.java:86)
        at org.apache.flink.table.planner.operations.SqlToOperationConverter.convertViewQuery(SqlToOperationConverter.java:898)
        at org.apache.flink.table.planner.operations.SqlToOperationConverter.convertCreateView(SqlToOperationConverter.java:868)
        at org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:261)
        at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:101)
        at org.apache.flink.table.api.internal.TableEnvironmentImpl.executeSql(TableEnvironmentImpl.java:730)
        at org.apache.flink.table.examples.java.basics.StreamSQLExample.main(StreamSQLExample.java:69)
Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 8 to line 1, column 11: Column 'USER' not found in any table; did you mean 'user'?
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:467)
        at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:883)
        at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:868)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4861)
        at org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:254)
        at org.apache.calcite.sql.validate.SqlValidatorImpl$Expander.visit(SqlValidatorImpl.java:5833)
        at org.apache.calcite.sql.validate.SqlValidatorImpl$SelectExpander.visit(SqlValidatorImpl.java:5982)
        at org.apache.calcite.sql.validate.SqlValidatorImpl$SelectExpander.visit(SqlValidatorImpl.java:5967)
        at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:320)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectExpr(SqlValidatorImpl.java:5416)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:398)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4061)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3347)
        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:997)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:975)
        at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:232)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:952)
        at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:704)
        at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$validate(FlinkPlannerImpl.scala:159)
        ... 8 more
Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Column 'USER' not found in any table; did you mean 'user'?
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:467)
        at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:560)
        ... 28 more
{code}


 



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