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

RexUtil.simplifyOrs() throws exception if terms has 1 RexNode

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.22.0
    • Component/s: core

      Description

      This is a regression caused by the refactoring in 1.20.0.

      When terms has only 1 element, it will throw an exception. We discovered the issue when trying to upgrade Calcite.

         public static RexNode simplifyOrs(RexBuilder rexBuilder,
             List<RexNode> terms) {
           return new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, EXECUTOR)
              .simplifyUnknownAs(rexBuilder.makeCall(SqlStdOperatorTable.OR, terms),
                   RexUnknownAs.UNKNOWN);
         }
      

      We can't assume the terms always has more than 1 element. Although this method is deprecated, I think we need to correct the regression. Maybe we don't need a test case, given it is a deprecated method.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                hyuan Haisheng Yuan
              • 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 - 20m
                  20m