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

Simplify casts which are only widening nullability

    XMLWordPrintableJSON

    Details

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

      Description

      There are cases in which casts are added; but they are not neccessary.

        @Test public void testSimplifyRedundantCast() {
          RexNode expr = cast(isTrue(vBoolNotNull()), tBoolean(true));
          assertThat(expr.getType().isNullable(), is(true));
          RexNode result = simplify.simplifyUnknownAs(expr, RexUnknownAs.UNKNOWN);
          assertThat(result.getType().isNullable(), is(false));
        }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kgyrtkirk Zoltan Haindrich
                Reporter:
                kgyrtkirk Zoltan Haindrich
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: