You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/05/10 23:01:04 UTC

[jira] [Commented] (CALCITE-1785) aliases are being treated as keywords

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

Julian Hyde commented on CALCITE-1785:
--------------------------------------

VALUE isn't just a keyword. It's a *reserved* keyword. That means that you can't use it as an identifier (such as a table name, column name, or alias).

You can use it in quotes, though:

{code}
split_part(f."value", '-', -1) as state_code
{code}

> aliases are being treated as keywords
> -------------------------------------
>
>                 Key: CALCITE-1785
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1785
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.12.0
>            Reporter: Tony Zhao
>            Assignee: Julian Hyde
>
> I tried both version 1.11.0 and 1.12.0, this is the scala code to reproduce the bug
> {code}
> import org.apache.calcite.sql.parser.SqlParser
> val sqlStmt = """
> select distinct foo as bar,
> split_part(f.value, '-', -1) as state_code
> from sample_table a, table(flatten(a.location_slugs))
> """
> SqlParser.create(sqlStmt).parseQuery()
> {code}
> gives
> {code}
> org.apache.calcite.sql.parser.SqlParseException: Encountered ". value" at line 3, column 13.
> {code}
> This fails because value is in the keyword list, but it is actually an alias here and shouldn't be treated as a keyword.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)