tanclary commented on code in PR #3697:
URL: https://github.com/apache/calcite/pull/3697#discussion_r1496632441
##########
core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java:
##########
@@ -118,6 +126,13 @@ private static final class CustomTypeSystem extends
RelDataTypeSystemImpl {
@Override public int getMaxNumericPrecision() {
return 38;
}
+
+ @Override public int getMaxPrecision(SqlTypeName typeName) {
+ if (typeName == SqlTypeName.TIMESTAMP) {
+ return SqlTypeName.MAX_DATETIME_PRECISION + 3; // Arbitrarily choose a
different precision.
Review Comment:
Where is the +3 coming from?
##########
core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java:
##########
@@ -118,6 +126,13 @@ private static final class CustomTypeSystem extends
RelDataTypeSystemImpl {
@Override public int getMaxNumericPrecision() {
return 38;
}
+
+ @Override public int getMaxPrecision(SqlTypeName typeName) {
+ if (typeName == SqlTypeName.TIMESTAMP) {
Review Comment:
why not just have a `MAX_TIMESTAMP_PRECISION`? Am I wrong in saying that
everytime we look for the max timestamp precision we're just retrieving the max
datetime and then adding 3? In that case we should just define it as a constant
and then this becomes unnecessary.
##########
core/src/test/java/org/apache/calcite/sql/type/RelDataTypeSystemTest.java:
##########
@@ -218,4 +233,32 @@ static class Fixture extends SqlTypeFixture {
assertEquals(28, dataType.getPrecision());
assertEquals(10, dataType.getScale());
}
+
+ @Test void testCustomMaxTimestampPrecisionTimeFunctionReturnTypeInference() {
Review Comment:
would be helpful to leave a comment with the jira case. there are lots of
examples with `Test case for ...` you can use
--
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]