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

ASF GitHub Bot commented on DRILL-3510:
---------------------------------------

Github user vdiravka commented on a diff in the pull request:

    https://github.com/apache/drill/pull/520#discussion_r73758968
  
    --- Diff: 
exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillDatabaseMetaDataImpl.java
 ---
    @@ -219,11 +226,26 @@ public boolean storesMixedCaseQuotedIdentifiers() 
throws SQLException {
         return super.storesMixedCaseQuotedIdentifiers();
       }
     
    -  // TODO(DRILL-3510):  Update when Drill accepts standard SQL's double 
quote.
       @Override
       public String getIdentifierQuoteString() throws SQLException {
         throwIfClosed();
    -    return "`";
    +    boolean systemOption = false;
    +    boolean sessionOption = false;
    +    String sql = "select type, bool_val from sys.options where name = 
'parser.ansi_quotes'";
    +    ResultSet rs = executeSql(sql);
    +    while (rs.next()) {
    +      if (rs.getString(1).equals("SYSTEM")) {
    +        systemOption = rs.getBoolean(2);
    +      }
    +      if (rs.getString(1).equals("SESSION")) {
    +        sessionOption = rs.getBoolean(2);
    +      }
    +    }
    +    if (systemOption || sessionOption) {
    --- End diff --
    
    Missed it. Is corrected in a new commit. Thanks.


> Add ANSI_QUOTES option so that Drill's SQL Parser will recognize ANSI_SQL 
> identifiers 
> --------------------------------------------------------------------------------------
>
>                 Key: DRILL-3510
>                 URL: https://issues.apache.org/jira/browse/DRILL-3510
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: SQL Parser
>            Reporter: Jinfeng Ni
>            Assignee: Vitalii Diravka
>             Fix For: Future
>
>         Attachments: DRILL-3510.patch, DRILL-3510.patch
>
>
> Currently Drill's SQL parser uses backtick as identifier quotes, the same as 
> what MySQL does. However, this is different from ANSI SQL specification, 
> where double quote is used as identifier quotes.  
> MySQL has an option "ANSI_QUOTES", which could be switched on/off by user. 
> Drill should follow the same way, so that Drill users do not have to rewrite 
> their existing queries, if their queries use double quotes. 
> {code}
> SET sql_mode='ANSI_QUOTES';
> {code}
>    



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

Reply via email to