Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
Description
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
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'
// it can run in spark spark-sql (default)> select count(distinct `if`(1>5, 'x', null)); 0
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 }
Attachments
Issue Links
- duplicates
-
FLINK-17484 [FLIP-154] Enable type coercion
- Open