hqbhoho opened a new issue, #12518:
URL: https://github.com/apache/gravitino/issues/12518
### Version
main branch
### Describe what's wrong
For a MySQL catalog, the metadata path and the projection-pushdown path
report different Trino types for the same column: `getTableMetadata` maps MySQL
`tinytext` / `text` / `mediumtext` / `enum` / `set` to an unbounded `varchar`,
while `applyProjection` forwards the internal connector's assignment types
as-is, which are derived from the JDBC column size (e.g. `varchar(255)` for
tinytext).
Since Trino 444 the planner verifies that both sides of an assignment have
the same type (trinodb/trino#21286), so pushing a projection down over such a
column now fails the query at planning time. Trino 443 and earlier silently
tolerated the same divergence (verified on both versions against the same MySQL
server). A plain `mysql` catalog is not affected, because there both types come
from the same column handle.
### Error message and/or stacktrace
```
GENERIC_INTERNAL_ERROR: Types don't match: varchar vs varchar(255),
for col_tinytext::[varchar] and col_tinytext_7::varchar(255)
```
### How to reproduce
`jdbc-mysql` catalog on Trino 478:
```sql
CREATE TABLE gt_mysql.db.t (id int, name varchar); -- unbounded varchar
becomes MySQL TEXT
SELECT *, if(name is null, '', name) FROM gt_mysql.db.t;
```
Triggering it takes referencing every column of the table, a projection
expression the internal connector cannot push down, and a bare text / enum /
set column in the output — the typical `SELECT *, <computed column>` query.
### Additional context
The fix is to restore the engine-assigned types (available from the
`Variable`s in the `projections` argument) when
`GravitinoMetadata#applyProjection` returns the assignments, the same way
`DefaultJdbcMetadata` types them in its own expression-pushdown branch.
Session-level mitigation: `SET SESSION allow_pushdown_into_connectors =
false` (disables all pushdown for the session).
--
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]