[FLINK-39498][table] Day time interval with unsupported precision should fail in planning time rather than code gen#27979
[FLINK-39498][table] Day time interval with unsupported precision should fail in planning time rather than code gen#27979snuyanzin wants to merge 2 commits intoapache:masterfrom
Conversation
…uld fail in planning time rather than code gen
| case typeName if YEAR_INTERVAL_TYPES.contains(typeName) => | ||
| DataTypes.INTERVAL(DataTypes.MONTH).getLogicalType | ||
| case typeName if DAY_INTERVAL_TYPES.contains(typeName) => | ||
| if (relDataType.getPrecision > 3) { |
There was a problem hiding this comment.
it was wrong precision to check
fhueske
left a comment
There was a problem hiding this comment.
Thanks for the fix @snuyanzin.
+1 to merge!
| if (relDataType.getScale > 3) { | ||
| throw new TableException( | ||
| s"DAY_INTERVAL_TYPES precision is not supported: ${relDataType.getPrecision}") | ||
| s"DAY_INTERVAL_TYPES precision is not supported: ${relDataType.getScale}") |
There was a problem hiding this comment.
nits:
s"DAY_INTERVAL_TYPES precision is not supported: ${relDataType.getScale} (max supported: 3)"
or
s"Fractional second precision ${relDataType.getScale} is not supported for day-time interval types (max supported: 3)"
| } | ||
|
|
||
| @Test | ||
| def testTimestampAddWithUnsupportedPrecision(): Unit = { |
There was a problem hiding this comment.
can add testTimestampAddWithSupportedPrecision
add testSqlApi("TIMESTAMPADD(MILLISECOND, 1, timestamp '2016-02-24 12:42:25')", "2016-02-24 12:42:25.001") test is supported.
| assertThatExceptionOfType(classOf[TableException]) | ||
| .isThrownBy( | ||
| () => | ||
| testSqlApi("TIMESTAMPADD(MICROSECOND, 1, timestamp '2016-02-24 12:42:25')", "2016-06-16")) |
There was a problem hiding this comment.
.withMessageContaining("not supported")
or
.withMessageContaining("precision is not supported")
What is the purpose of the change
The query like
fails while code generation
at the same ime we have all the data to fail during planning
Brief change log
typefactory
Verifying this change
test added
Does this pull request potentially affect one of the following parts:
@Public(Evolving): ( no)Documentation
Was generative AI tooling used to co-author this PR?