You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2018/11/22 10:17:00 UTC

[jira] [Created] (CALCITE-2695) Simplify casts which are only widening nullability

Zoltan Haindrich created CALCITE-2695:
-----------------------------------------

             Summary: Simplify casts which are only widening nullability
                 Key: CALCITE-2695
                 URL: https://issues.apache.org/jira/browse/CALCITE-2695
             Project: Calcite
          Issue Type: Improvement
            Reporter: Zoltan Haindrich
            Assignee: Zoltan Haindrich


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

{code}
  @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));
  }
{code}





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)