You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2025/12/26 11:41:04 UTC
(ignite-3) 01/02: Drop useless code
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a commit to branch ignite-27390
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 0c647ddb1afe51f33be0512e344350871e4531c3
Author: AMashenkov <am...@apache.org>
AuthorDate: Fri Dec 26 14:40:07 2025 +0300
Drop useless code
---
.../ignite/internal/sql/engine/util/RexUtils.java | 33 +---------------------
1 file changed, 1 insertion(+), 32 deletions(-)
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java
index c564c2e42e8..54001d42ebe 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java
@@ -1477,37 +1477,6 @@ public class RexUtils {
return source.getPrecision() <= target.getPrecision();
}
- return isLosslessCast(source, target);
- }
-
- // TODO: https://issues.apache.org/jira/browse/IGNITE-27390
- // This is copy of RexUtil.isLosslessCast from Calcite 1.40. We should replace RexUtils.isLosslessCast
- // with calcite's implementation.
- private static boolean isLosslessCast(RelDataType source, RelDataType target) {
- final SqlTypeName sourceSqlTypeName = source.getSqlTypeName();
- final SqlTypeName targetSqlTypeName = target.getSqlTypeName();
- // 1) Both INT numeric types
- if (SqlTypeFamily.INTEGER.getTypeNames().contains(sourceSqlTypeName)
- && SqlTypeFamily.INTEGER.getTypeNames().contains(targetSqlTypeName)) {
- return targetSqlTypeName.compareTo(sourceSqlTypeName) >= 0;
- }
- // 2) Both CHARACTER types: it depends on the precision (length)
- if (SqlTypeFamily.CHARACTER.getTypeNames().contains(sourceSqlTypeName)
- && SqlTypeFamily.CHARACTER.getTypeNames().contains(targetSqlTypeName)) {
- return targetSqlTypeName.compareTo(sourceSqlTypeName) >= 0
- && source.getPrecision() <= target.getPrecision();
- }
- // 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
- }
- final int targetPrecision = target.getPrecision();
- return targetPrecision == RelDataType.PRECISION_NOT_SPECIFIED || targetPrecision >= sourceLength;
- }
- // Return FALSE by default
- return false;
+ return RexUtil.isLosslessCast(source, target);
}
}