korlov42 commented on code in PR #6160: URL: https://github.com/apache/ignite-3/pull/6160#discussion_r2182089065
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java: ########## @@ -397,6 +397,21 @@ public boolean isDeterministic() { InferTypes.FIRST_KNOWN, MINUS_OPERATOR_TYPES_CHECKER); + private static RelDataType deriveDatetimePlusMinusIntervalType( + RelDataTypeFactory typeFactory, + RelDataType datetimeType, + RelDataType intervalType, + boolean nullable + ) { + if (datetimeType.getSqlTypeName().allowsPrecScale(true, false) Review Comment: I would added an assertion that `datetimeType` is datetime indeed. The same for interval ########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java: ########## @@ -397,6 +397,21 @@ public boolean isDeterministic() { InferTypes.FIRST_KNOWN, MINUS_OPERATOR_TYPES_CHECKER); + private static RelDataType deriveDatetimePlusMinusIntervalType( + RelDataTypeFactory typeFactory, + RelDataType datetimeType, + RelDataType intervalType, + boolean nullable + ) { + if (datetimeType.getSqlTypeName().allowsPrecScale(true, false) + && intervalType.getScale() > datetimeType.getPrecision()) { + // Using a fraction of a second from an interval as the precision of the expression. + return typeFactory.createSqlType(datetimeType.getSqlTypeName(), intervalType.getScale()); Review Comment: what about nullability? -- 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