[
https://issues.apache.org/jira/browse/DRILL-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13755866#comment-13755866
]
Jacques Nadeau commented on DRILL-197:
--------------------------------------
There is actually a pretty simple pattern. (not necessarily intuitive).
Quoted identifiers (table names, column names, schema names) require double
quotes. They are actually allowed without quotes when the string doesn't have
weird characters (such as period, space or dash or forward-slash). String
literals require single quotes.
The perverse part is that since _MAP is the identifier (and we don't have
sugared syntax) that it fronts a map within string literal keys (thus the
single quotes for ['<expr>']). I'm pretty sure ansi sql defines only single
quotes for string literals. I'm not sure on the spec for identifiers. I
remember using [] for identifiers in MS. Once we remove the whole map thing,
I'm not actually sure the rest would be a problem other than clearer error
messages.
Maybe [~julianhyde] can share more thoughts.
> Difference between single and double quotes not clear and error messages are
> opaque
> -----------------------------------------------------------------------------------
>
> Key: DRILL-197
> URL: https://issues.apache.org/jira/browse/DRILL-197
> Project: Apache Drill
> Issue Type: Bug
> Reporter: Ted Dunning
>
> The following query fails:
> {code}
> select _MAP["N_REGIONKEY"]
> from "nation.parquet"
> {code}
> but the following very similar query succeeds:
> {code}
> select _MAP['N_REGIONKEY']
> from "nation.parquet"
> {code}
> The difference is in the use of single or double quotes for the index of
> {{_MAP}}
> I certainly don't know what the difference is here, but it seems important to
> either resolve or document.
> Conversely, this query also fails, but this time because double quotes *have*
> to be used.
> {code}
> select _MAP['N_REGIONKEY']
> from 'nation.parquet';
> {code}
> This is pretty perverse.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira