korlov42 commented on code in PR #941:
URL: https://github.com/apache/ignite-3/pull/941#discussion_r921059464
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/TypeUtils.java:
##########
@@ -249,7 +251,9 @@ public static Object toInternal(ExecutionContext<?> ectx,
Object val, Type stora
} else if (storageType == LocalTime.class) {
return (int) (((LocalTime) val).toNanoOfDay() / 1000 / 1000 /*
convert to millis */);
} else if (storageType == LocalDateTime.class) {
- return ((LocalDateTime) val).toEpochSecond(ZoneOffset.UTC);
+ var dt = (LocalDateTime) val;
+
+ return dt.toEpochSecond(ZoneOffset.UTC) * 1000 + dt.getNano() /
1000 / 1000 /* convert to millis */;
Review Comment:
fixed
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java:
##########
@@ -557,4 +565,52 @@ private void checkPositiveNumber(int num) {
private TableOptionInfo<?> dataStorageFieldOptionInfo(Entry<String,
Class<?>> e) {
return new TableOptionInfo<>(e.getKey(), e.getValue(), null, (cmd, o)
-> cmd.addDataStorageOption(e.getKey(), o));
}
+
+ /**
+ * Creates a value of required type from the literal.
+ */
+ private static Object fromLiteral(RelDataType columnType, SqlLiteral
literal) {
+ switch (columnType.getSqlTypeName()) {
+ case VARCHAR:
+ case CHAR:
+ return literal.getValueAs(String.class);
+ case DATE:
+ return
LocalDate.ofEpochDay(literal.getValueAs(DateString.class).getDaysSinceEpoch());
+ case TIME:
+ return
LocalTime.ofNanoOfDay(literal.getValueAs(TimeString.class).getMillisOfDay() *
1_000_000L);
Review Comment:
fixed
--
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]