Aaaaaaron commented on a change in pull request #2161:
URL: https://github.com/apache/calcite/pull/2161#discussion_r493296381



##########
File path: core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java
##########
@@ -1668,12 +1668,19 @@ public static boolean isAtomic(RelDataType type) {
         || SqlTypeUtil.isBoolean(type);
   }
 
-  /** Returns a DECIMAL type with the maximum precision/scale for the current
+  /** Returns a DECIMAL type with the maximum precision for the current
    * type system. */
   public static RelDataType getMaxPrecisionScaleDecimal(RelDataTypeFactory 
factory) {
     int maxPrecision = factory.getTypeSystem().getMaxNumericPrecision();
     int maxScale = factory.getTypeSystem().getMaxNumericScale();
 
+    // maxScale should not greater than maxPrecision.
+    // If they are equal, e.g. Decimal(19,19)
+    // means we can only have decimal places.
+    while (maxScale >= maxPrecision) {
+      maxScale = maxScale / 2;
+    }

Review comment:
       > I got the impression that many systems support max precision scale as 
`decimal(38, 18)`.
   
   Hi @danny0405, IMO the specific number here is not so important (like18  or 
19), we just need return a big decimal here, so can we finalize a number just 
like Decimal(38, 18)?
   




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to