Flinksql bug :Illegal mixing of types in CASE or COALESCE statement
报错信息
org.apache.flink.table.api.ValidationException: SQL validation failed. From line 66, column 23 to line 68, column 46: Illegal mixing of types in CASE or COALESCE statement
org.apache.calcite.runtime.CalciteContextException: From line 66, column 23 to line 68, column 46: Illegal mixing of types in CASE or COALESCE statement
org.apache.calcite.sql.validate.SqlValidatorException: Illegal mixing of types in CASE or COALESCE statement
发生地址
flinksql中的 COALESCE 函数 或 case 函数
报错原因:
case when 多条判断语句 输出数据类型不一致
实例 :
case when id = 1 then 1
when id = 2 then '2'
end
解决方案:
统一数据类型即可
case when id = 1 then 1
when id = 2 then case('2' as int )
end