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

Jinfeng Ni commented on CALCITE-528:
------------------------------------

SqlParser is taking Lex's case sensitivity.  However, SqlValidatorScope does 
not. It's fullQualify(SqlIdentifer identifier) will simply keep the original 
casing; it's essentially UNCHANGED.  For Lex other than Lex.ORACLE, since both 
SqlParser and SqlValidatorScope will keep the casing UNCHANGED, while 
SqlToRelConverter unfortunately enforce case-sensitive matching, that will make 
the code completely ignore the Lex's case insensitive policy, and hence hit the 
error of "column not found".

There are 2 options:
1) SqlValidator convert all SqlIdentifer to UPPER-CASE, if Lex's caseSensitive 
= false, even when Lex.unquotedCasing = "UNCHANGED". Then, the downstream 
operators could enforce case-sensitive matching, just like what 
SqlToRelConverter is doing today.  Also, the field names in row type should be 
converted to UPPER-CASE as well. 

2) SqlValidator  keep the current behavior, but all the consequent matching 
should know whether it's case-sensitive or case-in-sensitive. (I could see 
several places need change, in particular SqlToRelConverter).

Suggestion?


> Creating output row type of a Join does not obey case-sensitivity flags
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-528
>                 URL: https://issues.apache.org/jira/browse/CALCITE-528
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 0.9.1-incubating
>            Reporter: Aman Sinha
>            Assignee: Julian Hyde
>
> In JoinRelBase.createJoinType() which creates a row type of the output row, a 
> HashSet of String is used to keep track of unique field names.  The field 
> names  'column1'  and 'Column1' will both be stored.   This creates a problem 
> for systems which are treating identifiers as case-insensitive (such as 
> Drill) which rely on a Project below a Join to create unique names if the 
> join columns are the same name (regardless of case).  
> Ideally, the comparison for this should be done based on the criteria 
> specified in the Lex settings when instantiating the 
> SqlParser.ParserConfigImpl.  So, if the parser was created with MYSQL Lex 
> settings (see Lex.java), it should be obeyed by the 
> JoinRelBase.createJoinType().  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to