Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3247

In JDBC adapter, when generating SQL for Hive, transform SUBSTRING function to correct format

    XMLWordPrintableJSON

    Details

      Description

      Let's assume sql = SELECT SUBSTRING('ABC', 2)

      When we use HiveSqlDialect and transform "sql", we expect SUBSTRING(' abc', 2),but get SUBSTRING(' abc' FROM 2) which is incorrect  sql format in hive.

      So maybe HiveSqlDialect behavior should be changed when transform function SUBSTRING:

      1. SELECT SUBSTRING('ABC', 2)  =>  SELECT SUBSTRING('ABC', 2)
      2. SELECT SUBSTRING('ABC', 2, 3)  =>  SELECT SUBSTRING('ABC', 2, 3) 
      3. SELECT SUBSTRING('ABC' FROM 2) => SELECT SUBSTRING('ABC', 2) 
      4. SELECT SUBSTRING('ABC' FROM 2 FOR 3) => SELECT SUBSTRING('ABC', 2, 3) 

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                danny0405 Danny Chen
                Reporter:
                jackyWoo Jacky Woo
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m