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

Hints should not unparse as enclosed in parentheses

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.22.0
    • 1.23.0
    • None
    • None

    Description

      When using the new SQL hints feature:

       

      select /*+ cpu */ x from test limit 2;
      

      If one calls to SqlString() on the node:

       

       

      node.toSqlString(CalciteSqlDialect.DEFAULT).toString()
      

       

      We get:

       

      'SELECT /*+ ("cpu") */ "x" FROM "test" FETCH NEXT 2 ROWS ONLY'
      

      which is not valid SQL for a hint. It looks like the precedence options need to be modified when writing out the hint in SqlSelectOperator.unparse

       

      We do some rewriting of the sql statement and then re-parse it, so this is preventing us from using hints. I am happy to submit a patch if I am headed in the right direction with the description above. 

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            alexbaden Alex Baden
            Votes:
            0 Vote for this issue
            Watchers:
            4 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 - 10m
                10m