Aaaaaaron commented on a change in pull request #2161:
URL: https://github.com/apache/calcite/pull/2161#discussion_r493171242
##########
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:
The "getMaxPrecisionScaleDecimal" means suppose to get a max Decimal,
but the Decimal(max, max) is not this meaning.
----------------------------------------------------------------
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]