NobiGo commented on code in PR #3943:
URL: https://github.com/apache/calcite/pull/3943#discussion_r1739943477


##########
core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java:
##########
@@ -88,6 +90,14 @@ public SqlTypeFactoryImpl(RelDataTypeSystem typeSystem) {
     if (maxPrecision >= 0 && precision > maxPrecision) {
       precision = maxPrecision;
     }
+    if (typeName == SqlTypeName.DECIMAL) {
+      if (precision != RelDataType.PRECISION_NOT_SPECIFIED && precision <= 0) {
+        throw RESOURCE.invalidPrecisionForDecimalType(precision, 
maxPrecision).ex();
+      }
+      if (scale != RelDataType.SCALE_NOT_SPECIFIED && (scale < 0 || scale > 
precision)) {

Review Comment:
   Yes. At first, I tested it in different databases, but it still missed some 
features that may have been in newer versions. I am preparing to revert the 
unreasonable test cases in this PR(if so, this PR only left some unit tests 
about CAST a literal to SECAIMAL type). Do you think this PR is still 
necessary? If not, I am prepared to close this PR and Jira issue.



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