You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Quanlong Huang (JIRA)" <ji...@apache.org> on 2019/03/26 01:52:00 UTC

[jira] [Updated] (IMPALA-7216) Invalid SQL generated by toSql functions in CreateViewStmt & AlterViewStmt

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

Quanlong Huang updated IMPALA-7216:
-----------------------------------
    Fix Version/s: Impala 3.1.0
                   Impala 2.13.0

> 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
>             Fix For: Impala 2.13.0, Impala 3.1.0
>
>
> 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)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org