Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.34.0, 1.35.0
Description
This program fails at compilation time:
SELECT CAST(CAST('32767.4' AS FLOAT) AS SMALLINT)
This happens in linq4j in Expressions.constant:
if ((clazz != Float.class && clazz != Double.class || !(value instanceof BigDecimal)) && !clazz.isInstance(value)) { String stringValue = String.valueOf(value); if (type == BigDecimal.class) { value = new BigDecimal(stringValue); } if (type == BigInteger.class) { value = new BigInteger(stringValue); } if (primitive != null) { value = primitive.parse(stringValue); // << error happens here } }
Attachments
Issue Links
- relates to
-
CALCITE-5990 Explicit cast to numeric type doesn't check overflow
- Closed
- links to