我无法在CASE
语句中得到空结果。以下查询返回NULL
作为结果:
SELECT CASE WHEN ('test' IS NULL) THEN (SELECT 'null_result') ELSE (SELECT 'empty_result' WHERE 1<>1) END;
我想获得空结果(无任何行)。
答案 0 :(得分:1)
您可以在外部2019-05-27 10:49:18,418 ERROR org.apache.flink.runtime.executiongraph.ExecutionGraph - Job (3064130e1dccead0b037f193d3699c3b) switched from state FAILING to FAILED.
java.lang.IllegalArgumentException: json can not be null or empty
子句中过滤掉NULL
个值。
WHERE
或
SELECT CASE WHEN ('test' IS NULL) THEN (SELECT 'null_result') ELSE (SELECT 'empty_result' WHERE 1<>1) END
WHERE CASE WHEN ('test' IS NULL) THEN (SELECT 'null_result') ELSE (SELECT 'empty_result' WHERE 1<>1) END IS NOT NULL;