jarredhj0214 opened a new issue, #13547:
URL: https://github.com/apache/gravitino/issues/13547
### Version
main branch
### Describe what's wrong
MySQL supports DECIMAL precision up to 65, but Gravitino's `DecimalType`
only supports precision in the range `[1, 38]`.
`MysqlTypeConverter` currently converts every MySQL `DECIMAL` column
directly to `Types.DecimalType` using the precision and scale reported by JDBC.
For a MySQL column such as `DECIMAL(65,30)`, the converter attempts to create:
```java
Types.DecimalType.of(65, 30)
```
This violates the Gravitino `DecimalType` precision limit and prevents the
table from being loaded. Operations that depend on loading the table, including
granting privileges on the table, fail as a consequence.
MySQL `DECIMAL` columns whose precision exceeds 38 should be represented as
`ExternalType` while preserving their native precision, scale, and unsigned
attribute. `DECIMAL` columns with precision no greater than 38 should continue
using Gravitino `DecimalType`.
### Error message and/or stacktrace
```text
Decimal precision must be in range[1, 38]: precision: 65
```
### How to reproduce
1. Create a table in MySQL:
```sql
CREATE TABLE decimal_precision_test (
id BIGINT,
amount DECIMAL(65,30),
unsigned_amount DECIMAL(65,30) UNSIGNED
);
```
2. Configure a Gravitino JDBC MySQL catalog.
3. Load the table through Gravitino.
4. Observe that table loading fails while converting `DECIMAL(65,30)` to
Gravitino `DecimalType`.
5. Granting privileges on the table also fails because the table cannot be
loaded and validated.
### Additional context
Gravitino `DecimalType` intentionally limits precision to 38 for
compatibility with its common type system. The MySQL JDBC catalog should
therefore retain higher-precision MySQL decimals as catalog-specific
`ExternalType` values instead of rejecting the entire table.
--
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]