xtern commented on code in PR #6697:
URL: https://github.com/apache/ignite-3/pull/6697#discussion_r2407422523
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/PrepareServiceImpl.java:
##########
@@ -984,4 +957,63 @@ boolean matches() {
return matches;
}
}
+
+ @TestOnly
+ @Nullable
+ public static RelDataType
deriveTypeFromDynamicParamValueTestOnly(@Nullable Object value) {
+ return deriveTypeFromDynamicParamValue(value);
+ }
+
+ // This method was moved here after refactoring.
+ // Why it can`t be changed into:
native2relationalType(Commons.typeFactory(), NativeTypes.fromObject(param))
Review Comment:
Personally, I think you should open a corresponding issue if you think
something needs to be improved, rather than adding questions in the comments in
the codebase.
> Why it can`t be changed into: native2relationalType(Commons.typeFactory(),
NativeTypes.fromObject(param))
I don't know why it was originally introduced, but we can't replace it with
proposed code because (at least) we changed DEFAULT precision/scale for dynamic
parameter of DECIMAL and TIME types.
See
#4566
#6274
For example with TIME dyn param you need always specify precision.
Consider the following example:
ID INT | t TIME(1)
1 | 00:00:00
SELECT id FROM tab WHERE t = ?
Let ? = 00:00:00.1
If we use the default precision (0), the normalized dynamic parameter will
be "00:00:00" and the results will include row with time 00:00:00, which is
incorrect.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]