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

Round-tripping a DECIMAL literal through Planner -> RelToSqlConverter -> Planner throws validation error

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.25.0
    • Component/s: None

      Description

      Take the following SQL:
      SELECT CAST('11111111111111111111111111111111.111111' AS DECIMAL(38,6)) AS "num"
      And, in the default Calcite SQL dialect with all defaults, send it through Planner parse -> valiate -> rel to get a RelNode. The RelNode will have a Project with the "111111111111111.11111" literal in there as a RexLiteral with Decimal type. 

       

      The use RelToSqlConverter to convert that RelNode back to SQL. The SQL now looks like 
      SELECT 11111111111111111111111111111111.111111 AS "num"
       

      If you attempt to parse and validate that SQL, you get "Numeric literal '11111111111111111111111111111111.111111' out of range" throw by SqlValidatorImpl.validateLiteral()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Chunwei Lei Chunwei Lei
                Reporter:
                swtalbot Steven Talbot
              • Votes:
                0 Vote for this issue
                Watchers:
                6 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 - 2h 20m
                  2h 20m