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

Paul Rogers commented on DRILL-6414:
------------------------------------

This is an important issue: for formats such as JSON, both {{a}} and {{A}} can 
be column names:
{noformat}
{a: 10, A: "30"}
{noformat}

Why anyone would do such a twisted thing is beyond me, but the point is, it is 
legal JSON.

The fun starts as this gets passed up the chain. When do we do case sensitive 
vs. insensitive. How about the following:

{noformat}
SELECT A FROM `myFile.json`
{noformat}

Sure, that can be case sensitive. How about this:

{noformat}
SELECT CAST(a AS DECIMAL) AS a, CAST(A AS INT) AS A FROM `myFile.json`
{noformat}

We've just defined columns in Drill itself. Should those two columns have case 
sensitive or case insensitive names? Should they follow the SQL rules (because 
they were defined in SQL) or JSON rules (because I'm just using Drill's way of 
expressing a schema)?

Then, in JDBC, when do we follow the case insensitive rule vs. the case 
sensitive rule? How does the JDBC developer know which rule will apply?

Might we instead detect the case sensitivity issue in a JSON file, say, and 
generate two columns rather than simply try to assign both {{a}} and {{A}} to 
the same vector? Maybe call the first one "a" and the second one "A$2" or some 
such. The user can then use Drill's schema rewrite mechanism (AKA casting and 
projection) to create Drill-friendly names:

{noformat}
SELECT a AS littleA, A$2 AS bigA FROM `myFile.json`
{noformat}

The point is, we'll need to be creative to solve this one, we can't do it as a 
simple "use a case sensitive comparison" bug fix.


> Allow Case Insensitive Comparisons in Drill
> -------------------------------------------
>
>                 Key: DRILL-6414
>                 URL: https://issues.apache.org/jira/browse/DRILL-6414
>             Project: Apache Drill
>          Issue Type: Improvement
>            Reporter: Volodymyr Tkach
>            Assignee: Volodymyr Tkach
>            Priority: Major
>
> Lets take a case:
> Table t1 with column c1 having a value 'abc'
> For a query like below drill should treat the comparison as case insensitive 
> and return 1 row.
> This is not an issue but we need to know if we can set case insensitivity at 
> system level.
> select * from t1 where c1 = 'ABC'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to