Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.36.0
Description
Lossless cast removal has been introduced in CALCITE-3712.
However, VARCHAR's precision is -1, which will not meet the lossless condition in RexUtil
// 3) From NUMERIC family to CHARACTER family: it depends on the precision/scale if (sourceSqlTypeName.getFamily() == SqlTypeFamily.NUMERIC && targetSqlTypeName.getFamily() == SqlTypeFamily.CHARACTER) { int sourceLength = source.getPrecision() + 1; // include sign if (source.getScale() != -1 && source.getScale() != 0) { sourceLength += source.getScale() + 1; // include decimal mark } return target.getPrecision() >= sourceLength; // target.getPrecision() is -1, which will make the optimization fail. }
Attachments
Issue Links
- links to