[ https://issues.apache.org/jira/browse/IMPALA-7216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pooja Nilangekar resolved IMPALA-7216. -------------------------------------- Resolution: Fixed > Invalid SQL generated by toSql functions in CreateViewStmt & AlterViewStmt > -------------------------------------------------------------------------- > > Key: IMPALA-7216 > URL: https://issues.apache.org/jira/browse/IMPALA-7216 > Project: IMPALA > Issue Type: Bug > Reporter: Pooja Nilangekar > Assignee: Pooja Nilangekar > Priority: Major > > The toSql functions in CreateViewStmt and AlterViewStmt generate SQL by > appending types to the column definitions. This is invalid because view > definitions should not specify the type of a column. The column type should > be inherited from the source table. > > Example query to reproduce: > {code:java} > create view foo (a, b) as select int_col, bigint_col from functional.alltypes; > {code} > The SQL generated by the toSql() function: > {code:java} > CREATE VIEW foo(a INT, b BIGINT) AS SELECT int_col, bigint_col FROM > functional.alltypes > {code} > Executing the query generated by toSql(): > {code:java} > [localhost:21000] default> CREATE VIEW foo(a INT, b BIGINT) AS SELECT > int_col, bigint_col FROM functional.alltypes; > Query: CREATE VIEW foo(a INT, b BIGINT) AS SELECT int_col, bigint_col FROM > functional.alltypes > ERROR: AnalysisException: Syntax error in line 1: > CREATE VIEW foo(a INT, b BIGINT) AS SELECT int... > ^ > Encountered: INTEGER > Expected: COMMENT, COMMA > CAUSED BY: Exception: Syntax error > {code} > In other databases like MySQL and PostgreSQL, the view definition statements > can't explicitly set the column types. The type of a column in a view should > always be inherited from the source table. -- This message was sent by Atlassian JIRA (v7.6.3#76005)