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

Volodymyr Vysotskyi commented on DRILL-4264:
--------------------------------------------

Drill handles field names and schema paths in different ways. For schema paths 
Drill uses Calcite. The required schema is returned by the method 
[getSchema()|https://github.com/mapr/incubator-calcite/blob/DrillCalcite1.4.0-mapr-1.4.0/core/src/main/java/org/apache/calcite/prepare/CalciteCatalogReader.java#L157].
 So for the input {{`dfs.data`}} needful chema will be returned from the first 
iteration of the cycle. For the case {{dfs.data}} in the first iteration will 
be assigned schema {{dfs}} and in the next iteration schema {{data}}.

Query 
{code:sql}
SELECT `rk.q`, `m.a.b` FROM test_table;
{code}
returns
{noformat}
---------------------------------------------------------------------------------------------------------
| rk.q<VARCHAR(OPTIONAL)>                           | m.a.b<INT(OPTIONAL)>      
                        |
---------------------------------------------------------------------------------------------------------
| a                                                 | null                      
                        |
---------------------------------------------------------------------------------------------------------
{noformat}
For this case Drill is looking for the field with name {{m.a.b}}.

Query
{code:sql}
SELECT t.`rk.q`, t.m.`a.b` FROM test_table t;
{code}
returns correct result:
{noformat}
---------------------------------------------------------------------------------------------------------
| rk.q<VARCHAR(OPTIONAL)>                           | EXPR$1<VARCHAR(OPTIONAL)> 
                        |
---------------------------------------------------------------------------------------------------------
| a                                                 | 1                         
                        |
---------------------------------------------------------------------------------------------------------
{noformat}

So yes, dot inside backticks is considered as a part of the field name and 
outside is considered as a separator.

> Dots in identifier are not escaped correctly
> --------------------------------------------
>
>                 Key: DRILL-4264
>                 URL: https://issues.apache.org/jira/browse/DRILL-4264
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Codegen
>            Reporter: Alex
>            Assignee: Volodymyr Vysotskyi
>
> If you have some json data like this...
> {code:javascript}
>     {
>       "0.0.1":{
>         "version":"0.0.1",
>         "date_created":"2014-03-15"
>       },
>       "0.1.2":{
>         "version":"0.1.2",
>         "date_created":"2014-05-21"
>       }
>     }
> {code}
> ... there is no way to select any of the rows since their identifiers contain 
> dots and when trying to select them, Drill throws the following error:
> Error: SYSTEM ERROR: UnsupportedOperationException: Unhandled field reference 
> "0.0.1"; a field reference identifier must not have the form of a qualified 
> name
> This must be fixed since there are many json data files containing dots in 
> some of the keys (e.g. when specifying version numbers etc)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to