Evgeny Stanilovsky created IGNITE-22697:
-------------------------------------------

             Summary: Sql. Comparison on BIGINT cast brings overflow
                 Key: IGNITE-22697
                 URL: https://issues.apache.org/jira/browse/IGNITE-22697
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 3.0.0-beta1
            Reporter: Evgeny Stanilovsky



{noformat}
create table tbl(v BIGINT);
insert into tbl values(9223372036854775807);
SELECT * FROM tbl WHERE v < 9223372036854775808::DECIMAL(19, 0);
{noformat}

will compile into:

{noformat}
try {
    final Long input_value = (Long) ctx.rowHandler().get(0, in1);
    final java.math.BigDecimal cast_value = input_value == null ? null : 
org.apache.ignite.internal.sql.engine.exec.exp.IgniteSqlFunctions.toBigDecimal(input_value.longValue(),
 19, 0);
    out.addField(cast_value == null ? null : 
Boolean.valueOf(org.apache.calcite.runtime.SqlFunctions.lt(cast_value, 
org.apache.ignite.internal.sql.engine.exec.exp.IgniteSqlFunctions.toBigDecimal("-9223372036854775808",
 19, 0))));
  } catch (Exception e) {
    throw new org.apache.ignite.sql.SqlException(
      262151,
      e);
  }
{noformat}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to