AMashenkov commented on code in PR #941:
URL: https://github.com/apache/ignite-3/pull/941#discussion_r921032343
##########
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:
```suggestion
return
LocalTime.ofNanoOfDay(TimeUnit.MILLISECONDS.toNanos(literal.getValueAs(TimeString.class).getMillisOfDay()));
```
--
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]