FANNG1 commented on issue #4115:
URL: https://github.com/apache/gravitino/issues/4115#issuecomment-2268916770

   > > @jerryshao @mchades , I prefer do a validate for `decimal` since 
`decimal(0,0)` is meaningless, WDYT?
   > 
   > Can you describe how `Decima(0,0)` behaves in different engines?
   
   Spark doesn't check precision and scale, while Trino checks
   ```java
       public static DecimalType createDecimalType(int precision, int scale)
       {
           if (precision <= 0 || precision > MAX_PRECISION) {
               throw new TrinoException(INVALID_FUNCTION_ARGUMENT, 
format("DECIMAL precision must be in range [1, %d]: %s", MAX_PRECISION, 
precision));
           }
   
           if (scale < 0 || scale > precision) {
               throw new TrinoException(INVALID_FUNCTION_ARGUMENT, 
format("DECIMAL scale must be in range [0, precision (%s)]: %s", precision, 
scale));
           }
   
           if (precision <= MAX_SHORT_PRECISION) {
               return ShortDecimalType.getInstance(precision, scale);
           }
           return new LongDecimalType(precision, scale);
       }
   ```


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