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

Suspicious code in org.apache.calcite.sql2rel.StandardConvertletTable#convertDatetimeMinus

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.17.0
    • 1.18.0
    • core
    • None

    Description

      https://github.com/apache/calcite/blob/ca858dd725dea6bf9b4a9059cf1c3ba98bd82f26/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L626-L640

          final RexNode[] casts = new RexNode[2];
          casts[0] =
              rexBuilder.makeCast(
                  cx.getTypeFactory().createTypeWithNullability(
                      int8Type,
                      exprs.get(0).getType().isNullable()),
                  exprs.get(0));
          casts[1] =
              rexBuilder.makeCast(
                  cx.getTypeFactory().createTypeWithNullability(
                      int8Type,
                      exprs.get(1).getType().isNullable()),
                  exprs.get(1));
          final RelDataType resType =
              cx.getValidator().getValidatedNodeType(call);
          return rexBuilder.makeCall(resType, op, exprs.subList(0, 2));
      

      casts array is never read.
      Are casts required there?
      Should Arrays.asList(casts) be used instead of exprs.subList(0, 2)?

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            vladimirsitnikov Vladimir Sitnikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: