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

SqlDatePartFunction#rewriteCall should check operands length

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.30.0
    • 1.31.0
    • core

    Description

      SqlDatePartFunction#rewriteCall does not check operands length for now, and it will be rewrite to EXTRACT unconditionally before validation.

      E.g.

      select week(); -- will throw ArrayIndexOutOfBoundsException
      select week(date '2022-04-27', 1); -- will just ignore second param
      

      However, these cases should throw validation exceptions, because week actually only accept 1 operand.

      Attachments

        Issue Links

          Activity

            People

              libenchao Benchao Li
              libenchao Benchao Li
              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 - 1h 40m
                  1h 40m