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

Tony Zhao commented on CALCITE-1785:
------------------------------------

sure, so the table and flatten calls are 3rd party udfs that generate the 
column or alias "value". My question then is, should the parser still treat 
".value" as a reserved keyword even though it is being scoped to the table f? I 
am new to SQL parsing, so I am not sure which one is more correct. For now, I 
have added "VALUE" to nonReservedKeyWord list for the workaround.
Thanks in advance for your help,
T

> 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)

Reply via email to