korlov42 commented on code in PR #6274: URL: https://github.com/apache/ignite-3/pull/6274#discussion_r2230544072
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/TypeUtils.java: ########## @@ -643,6 +643,12 @@ public static boolean needCastInSearchBounds(IgniteTypeFactory typeFactory, RelD return false; } + // TIME, TIMESTAMP and TIMESTAMP_WLTZ can use index, ignoring precision. + if (fromType.getSqlTypeName() == toType.getSqlTypeName() + && (fromType.getSqlTypeName() == SqlTypeName.TIME || SqlTypeUtil.isTimestamp(fromType))) { Review Comment: ```suggestion && SqlTypeUtil.isDatetime(fromType)) { ``` ########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java: ########## @@ -1325,6 +1325,12 @@ public static boolean isLosslessCast(RexNode node) { && (source.getPrecision() <= target.getPrecision() || target.getPrecision() == RelDataType.PRECISION_NOT_SPECIFIED); } + // TIME, TIMESTAMP and TIMESTAMP_WLTZ can use index, ignoring precision. + if (source.getSqlTypeName() == target.getSqlTypeName() Review Comment: This breaks the contract of the method. The cast between temporal types lossless iff target precision >= source precision and this is the cast within the same type (perhaps, some casts from time to timestamp or from date to timestamp are lossless as well, but I would not add this for now) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org