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

In JDBC adapter, when generating SQL for Hive, transform TRIM function to TRIM, LTRIM or RTRIM

    XMLWordPrintableJSON

    Details

      Description

      Let's assume sql = SELECT TRIM(' str ')

      When we use HiveSqlDialect and transform "sql", we expect SELECT TRIM(' str '),but get SELECT TRIM(BOTH ' ' FROM ' str ') which is incorrect  sql format in hive.

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

      1. SELECT TRIM(' str ')  =>  SELECT TRIM(' str ') 
      2. SELECT TRIM(BOTH ' ' from ' str ') => SELECT TRIM(' str ')
      3. SELECT TRIM(LEADING ' ' from ' str ') => SELECT LTRIM(' str ')
      4. SELECT TRIM(TRAILING ' ' from ' str ')=>  SELECT RTRIM(' str ') 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                jackyWoo Jacky Woo
              • Votes:
                0 Vote for this issue
                Watchers:
                5 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 - 50m
                  50m