rionmonster commented on code in PR #28437:
URL: https://github.com/apache/flink/pull/28437#discussion_r4789350622


##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/inference/InputTypeStrategiesTest.java:
##########
@@ -117,6 +119,86 @@ protected Stream<TestSpec> testData() {
                         .expectErrorMessage(
                                 "Invalid number of arguments. At least 2 
arguments expected but 1 passed."),
 
+                // a constant literal that overflows the expected DECIMAL 
precision must raise a
+                // type error instead of being silently reduced to NULL
+                TestSpec.forStrategy(
+                                "literal decimal overflowing the expected 
precision",
+                                explicitSequence(DataTypes.DECIMAL(2, 2)))
+                        .calledWithArgumentTypes(DataTypes.DECIMAL(6, 3))
+                        .calledWithLiteralAt(0, new BigDecimal("123.456"))
+                        .expectErrorMessage(
+                                "The value '123.456' does not fit the expected 
data type"),
+
+                // a constant literal that only requires scale rounding still 
fits
+                TestSpec.forStrategy(
+                                "literal decimal rounded within the expected 
precision",

Review Comment:
   Done via a new test for0.995 spec against DECIMAL(2, 2) that expects the 
overflow error.



-- 
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]

Reply via email to