dylanhz commented on code in PR #26802:
URL: https://github.com/apache/flink/pull/26802#discussion_r2211187990
##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/ValueDataTypeConverterTest.java:
##########
@@ -60,6 +60,9 @@ private static Stream<Arguments> testData() {
of(new BigDecimal("12.123"), DataTypes.DECIMAL(5, 3)),
of(new BigDecimal("1E+36"), DataTypes.DECIMAL(37, 0)),
of(new BigDecimal("0.000"), DataTypes.DECIMAL(4, 3)),
+ of(new BigDecimal("0.0"), DataTypes.DECIMAL(2, 1)),
+ of(new BigDecimal("0.11"), DataTypes.DECIMAL(3, 2)),
+ of(new BigDecimal("0.011"), DataTypes.DECIMAL(4, 3)),
Review Comment:
Thanks for your feedback!
1. For the first point: Test cases have been added. Normalization is not an
issue in Table API since BigDecimal will do the job. However, it's worth noting
that Calcite handles these inputs based on their literal string length and
assumes that they are already trimmed. Consequently, the two numbers are
treated as `DECIMAL(6, 2)` and `DECIMAL(2, 2)`. Maybe we can create a follow-up
issue for this.
2. For the second point: An error will be thrown by `DecimalType` during
validation, but I don't know where to catch the error within the test
framework. Do you have any suggestions about this if this test case is
necessary?
--
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]