heng qian created CALCITE-7398:
----------------------------------

             Summary: Fix incorrect cast from Long to int in 
VariantNonNull.cast() for BIGINT type
                 Key: CALCITE-7398
                 URL: https://issues.apache.org/jira/browse/CALCITE-7398
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: heng qian


In `VariantNonNull.java`, the `cast()` method has a bug in the `BIGINT` case at 
line 289:

  ```java
  case BIGINT: {
      long l = (int) value;  // Bug: should be (long) value
      ...
  }

  The value field for BIGINT type is stored as Long (verified by the 
constructor's assertion assert value instanceof Long). However, the code 
incorrectly casts it to int before assigning to the long variable.

  This causes a variant value with BIGINT runtime type to be null, since the 
cast function throws exception in this place.



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

Reply via email to