Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
In Calcite, if the dialect's `supportsImplicitTypeCoercion` is set to `true` (the default value is `true`), Calcite will remove the cast in the `SqlImplementor#stripCastFromString()` method. For example, the following SQL:
```
FROM applydata_bigdata.kafka_topic_cluster_user_dept_month_one_day_msg_info
WHERE ymd > CAST('20240801' AS INTEGER)
ORDER BY ymd DESC
```
will be transformed into:
```
FROM "hive"."applydata_bigdata"."kafka_topic_cluster_user_dept_month_one_day_msg_info"
WHERE "ymd" > '20240801'
ORDER BY "ymd" IS NULL DESC, "ymd" DESC LIMIT 200
```
Here, the `CAST` is removed.
However, in Presto, different data types cannot be directly compared, which will result in an error.
To avoid this issue, `supportsImplicitTypeCoercion` should be set to `false` in `PrestoSqlDialect`.
Attachments
Attachments
Issue Links
- links to