Closed danhuawang closed 1 month ago
As decimal(0, 0)
is not a valid, maybe we should validate it when creating a decimal type in Gravitino.
@jerryshao @mchades , I prefer do a validate for decimal
since decimal(0,0)
is meaningless, WDYT?
@jerryshao @mchades , I prefer do a validate for
decimal
sincedecimal(0,0)
is meaningless, WDYT?
Can you describe how Decima(0,0)
behaves in different engines?
@jerryshao @mchades , I prefer do a validate for
decimal
sincedecimal(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
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);
}
Version
main branch
Describe what's wrong
in Mysql catalog, when create a table with Decimal(0,0) type column, it turn out to be created as decimal(10,0) column type in Iceberg catalog, when create a table with Decimal(0,0) type column, table created. in Postgres catalog and Hive catalog, create a table with Decimal(0,0) type column isn't allowed
Error message and/or stacktrace
N/A
How to reproduce
It shouldn't be allowed to create the table having this column type
Additional context
No response