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:03 UTC
(ignite-3) branch ignite-27390 created (now a75c65bc433)
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a change to branch ignite-27390
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
at a75c65bc433 Minor
This branch includes the following new commits:
new 0c647ddb1af Drop useless code
new a75c65bc433 Minor
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(ignite-3) 02/02: Minor
Posted by am...@apache.org.
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 a75c65bc43374c1f46c4e92d20abdf9481b4127a
Author: AMashenkov <am...@apache.org>
AuthorDate: Fri Dec 26 14:40:35 2025 +0300
Minor
---
.../apache/ignite/internal/sql/engine/util/RexUtils.java | 15 ++++-----------
1 file changed, 4 insertions(+), 11 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 54001d42ebe..f30e88a76ed 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
@@ -1458,23 +1458,16 @@ public class RexUtils {
return false;
}
- if (SqlTypeUtil.isExactNumeric(source) && target.getSqlTypeName() == SqlTypeName.DECIMAL) {
- int tp = target.getPrecision();
- int ts = target.getScale();
- int sp = source.getPrecision();
- int ss = source.getScale();
-
- return ts >= ss && (tp - ts) >= (sp - ss);
- }
-
+ // Extended support for CHARACTER with PRECISION_NOT_SPECIFIED
if (SqlTypeFamily.CHARACTER.getTypeNames().contains(source.getSqlTypeName())
&& SqlTypeFamily.CHARACTER.getTypeNames().contains(target.getSqlTypeName())) {
return target.getSqlTypeName().compareTo(source.getSqlTypeName()) >= 0
&& (source.getPrecision() <= target.getPrecision() || target.getPrecision() == RelDataType.PRECISION_NOT_SPECIFIED);
}
- if (source.getSqlTypeName() == target.getSqlTypeName() && SqlTypeUtil.isDatetime(source)) {
- return source.getPrecision() <= target.getPrecision();
+ // Add support for temporal types
+ if (source.getSqlTypeName() == target.getSqlTypeName() && SqlTypeName.DATETIME_TYPES.contains(source.getSqlTypeName())) {
+ return (source.getPrecision() <= target.getPrecision() || target.getPrecision() == RelDataType.PRECISION_NOT_SPECIFIED);
}
return RexUtil.isLosslessCast(source, target);
(ignite-3) 01/02: Drop useless code
Posted by am...@apache.org.
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);
}
}