[
https://issues.apache.org/jira/browse/FLINK-32363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martijn Visser closed FLINK-32363.
----------------------------------
Resolution: Duplicate
> calcite 1.21 supports type coercion but flink don't enable it in validate
> -------------------------------------------------------------------------
>
> Key: FLINK-32363
> URL: https://issues.apache.org/jira/browse/FLINK-32363
> Project: Flink
> Issue Type: Improvement
> Reporter: jackylau
> Priority: Major
>
> 1) calcite 1.21 supports type coercion and enabled default while flink
> disabled
> 2) spark /mysql can run it
> 3) although, we can make it run by select count(distinct `if`(1>5, 'x',
> cast(null as varchar)));
> i think we should enable it or offers a config to enable it
>
> {code:java}
> Flink SQL> select count(distinct `if`(1>5, 'x', null));
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.calcite.sql.validate.SqlValidatorException: Illegal use of
> 'NULL'{code}
> {code:java}
> // it can run in spark
> spark-sql (default)> select count(distinct `if`(1>5, 'x', null));
> 0
> {code}
>
> {code:java}
> private def createSqlValidator(catalogReader: CalciteCatalogReader) = {
> val validator = new FlinkCalciteSqlValidator(
> operatorTable,
> catalogReader,
> typeFactory,
> SqlValidator.Config.DEFAULT
> .withIdentifierExpansion(true)
> .withDefaultNullCollation(FlinkPlannerImpl.defaultNullCollation)
> .withTypeCoercionEnabled(false)
> ) // Disable implicit type coercion for now.
> validator
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)