Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-3700

Quote sql identities when creating flat table

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: v2.5.1
    • Fix Version/s: v2.6.0
    • Component/s: RDBMS Source
    • Labels:
      None

      Description

      When kyin operate with different data source, DDL/DML may be broken because datasource has some different specific reserved keyword. 

       

      Sql identity should be quoted when:

      1) Create flat table.

      2) Push down to different datasource (different RDBMS has different reserved keyword) .

       

      2018-10-05 03:05:04,143 ERROR [pool-25-thread-2] conv.SqlConverter : Failed to default convert sql, will use the input: SELECT COUNT(TIME_KEY), TIME_KEY FROM CUBE.OPERATIONS_TIME WHERE TIME_KEY IS NOT NULL GROUP BY TIME_KEY ORDER BY COUNT(TIME_KEY) DESC LIMIT 10
      org.apache.calcite.sql.parser.SqlParseException: Encountered "FROM CUBE" at line 1, column 34.
      Was expecting one of:
       <EOF> 
       "ORDER" ...
       "LIMIT" ...
       "OFFSET" ...
       "FETCH" ...
       "FROM" <IDENTIFIER> ...
       "FROM" <QUOTED_IDENTIFIER> ...
       "FROM" <BACK_QUOTED_IDENTIFIER> ...
       "FROM" <BRACKET_QUOTED_IDENTIFIER> ...
       "FROM" <UNICODE_QUOTED_IDENTIFIER> ...
       "FROM" "LATERAL" ...
       "FROM" "(" ...
       "FROM" "UNNEST" ...
       "FROM" "TABLE" ...
       "," ...
       "AS" ...
       <IDENTIFIER> ...
       <QUOTED_IDENTIFIER> ...
       <BACK_QUOTED_IDENTIFIER> ...
       <BRACKET_QUOTED_IDENTIFIER> ...
       <UNICODE_QUOTED_IDENTIFIER> ...
       "." ...
       "INTERSECT" ...
       "EXCEPT" ...
       "MINUS" ...
       "(" ...
       
       at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:349)
       at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:130)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hit_lacus Xiaoxiang Yu
                Reporter:
                hit_lacus Xiaoxiang Yu
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: