osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (CALCITE-2565) Suspicious code in org.apache.calcite.rex.RexBuilder#makeCastIntervalToExact


Vladimir Sitnikov created CALCITE-2565:
------------------------------------------

             Summary: Suspicious code in org.apache.calcite.rex.RexBuilder#makeCastIntervalToExact
                 Key: CALCITE-2565
                 URL: https://issues.apache.org/jira/browse/CALCITE-2565
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.17.0
            Reporter: Vladimir Sitnikov
            Assignee: Julian Hyde


{code:java}    final int scale = 0;
    BigDecimal divider = endUnit.multiplier.scaleByPowerOfTen(-scale);
    RexNode value = multiplyDivide(decodeIntervalOrDecimal(exp),
        multiplier, divider);
    if (scale > 0) { // <-- THIS IS ALWAYS FALSE
      RelDataType decimalType =
          getTypeFactory().createSqlType(
              SqlTypeName.DECIMAL,
              scale + exp.getType().getPrecision(),
              scale);
      value = encodeIntervalOrDecimal(value, decimalType, false);
    }
{code}

Is if(scale>0) a dead code?



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