From 467551c08c03dde48fcc5c827e78aa5ec619ed08 Mon Sep 17 00:00:00 2001
From: Zihao Xu <xzhseh@gmail.com>
Date: Tue, 27 Feb 2024 10:42:08 -0500
Subject: [PATCH] refactor(test): improve planner test suite for case when &
 add const evaluation test  (#15077)

---
 .../input/case_when_optimization.yaml         | 403 +++++++++--------
 .../output/case_when_optimization.yaml        | 410 ++++++++++--------
 2 files changed, 457 insertions(+), 356 deletions(-)

diff --git a/src/frontend/planner_test/tests/testdata/input/case_when_optimization.yaml b/src/frontend/planner_test/tests/testdata/input/case_when_optimization.yaml
index 53c2b4e58576d..272e1ded6e364 100644
--- a/src/frontend/planner_test/tests/testdata/input/case_when_optimization.yaml
+++ b/src/frontend/planner_test/tests/testdata/input/case_when_optimization.yaml
@@ -1,117 +1,117 @@
 - id: create_table
   sql: |
-    CREATE TABLE t1 (c1 INT, c2 INT, c3 INT);
+    create table t1 (c1 INT, c2 INT, c3 INT);
   expected_outputs: []
 - id: basic_optimization_pattern
   before:
     - create_table
   sql: |
-    SELECT
-      CASE c1
-        WHEN 1 THEN 'one'
-        WHEN 2 THEN 'two'
-        WHEN 3 THEN 'three'
-        WHEN 4 THEN 'four'
-        WHEN 5 THEN 'five'
-        WHEN 6 THEN 'six'
-        WHEN 7 THEN 'seven'
-        WHEN 8 THEN 'eight'
-        WHEN 9 THEN 'nine'
-        WHEN 10 THEN 'ten'
-        WHEN 11 THEN 'eleven'
-        WHEN 12 THEN 'twelve'
-        WHEN 13 THEN 'thirteen'
-        WHEN 14 THEN 'fourteen'
-        WHEN 15 THEN 'fifteen'
-        WHEN 16 THEN 'sixteen'
-        WHEN 17 THEN 'seventeen'
-        WHEN 18 THEN 'eighteen'
-        WHEN 19 THEN 'nineteen'
-        WHEN 20 THEN 'twenty'
-        WHEN 21 THEN 'twenty-one'
-        WHEN 22 THEN 'twenty-two'
-        WHEN 23 THEN 'twenty-three'
-        WHEN 24 THEN 'twenty-four'
-        WHEN 25 THEN 'twenty-five'
-        WHEN 26 THEN 'twenty-six'
-        WHEN 27 THEN 'twenty-seven'
-        WHEN 28 THEN 'twenty-eight'
-        WHEN 29 THEN 'twenty-nine'
-        WHEN 30 THEN 'thirty'
-        WHEN 31 THEN 'thirty-one'
-        WHEN 32 THEN 'thirty-two'
-        WHEN 33 THEN 'thirty-three'
-        WHEN 34 THEN 'thirty-four'
-        WHEN 35 THEN 'thirty-five'
-        WHEN 36 THEN 'thirty-six'
-        WHEN 37 THEN 'thirty-seven'
-        WHEN 38 THEN 'thirty-eight'
-        WHEN 39 THEN 'thirty-nine'
-        WHEN 40 THEN 'forty'
-        WHEN 41 THEN 'forty-one'
-        WHEN 42 THEN 'forty-two'
-        WHEN 43 THEN 'forty-three'
-        WHEN 44 THEN 'forty-four'
-        WHEN 45 THEN 'forty-five'
-        WHEN 46 THEN 'forty-six'
-        WHEN 47 THEN 'forty-seven'
-        WHEN 48 THEN 'forty-eight'
-        WHEN 49 THEN 'forty-nine'
-        WHEN 50 THEN 'fifty'
-        WHEN 51 THEN 'fifty-one'
-        WHEN 52 THEN 'fifty-two'
-        WHEN 53 THEN 'fifty-three'
-        WHEN 54 THEN 'fifty-four'
-        WHEN 55 THEN 'fifty-five'
-        WHEN 56 THEN 'fifty-six'
-        WHEN 57 THEN 'fifty-seven'
-        WHEN 58 THEN 'fifty-eight'
-        WHEN 59 THEN 'fifty-nine'
-        WHEN 60 THEN 'sixty'
-        WHEN 61 THEN 'sixty-one'
-        WHEN 62 THEN 'sixty-two'
-        WHEN 63 THEN 'sixty-three'
-        WHEN 64 THEN 'sixty-four'
-        WHEN 65 THEN 'sixty-five'
-        WHEN 66 THEN 'sixty-six'
-        WHEN 67 THEN 'sixty-seven'
-        WHEN 68 THEN 'sixty-eight'
-        WHEN 69 THEN 'sixty-nine'
-        WHEN 70 THEN 'seventy'
-        WHEN 71 THEN 'seventy-one'
-        WHEN 72 THEN 'seventy-two'
-        WHEN 73 THEN 'seventy-three'
-        WHEN 74 THEN 'seventy-four'
-        WHEN 75 THEN 'seventy-five'
-        WHEN 76 THEN 'seventy-six'
-        WHEN 77 THEN 'seventy-seven'
-        WHEN 78 THEN 'seventy-eight'
-        WHEN 79 THEN 'seventy-nine'
-        WHEN 80 THEN 'eighty'
-        WHEN 81 THEN 'eighty-one'
-        WHEN 82 THEN 'eighty-two'
-        WHEN 83 THEN 'eighty-three'
-        WHEN 84 THEN 'eighty-four'
-        WHEN 85 THEN 'eighty-five'
-        WHEN 86 THEN 'eighty-six'
-        WHEN 87 THEN 'eighty-seven'
-        WHEN 88 THEN 'eighty-eight'
-        WHEN 89 THEN 'eighty-nine'
-        WHEN 90 THEN 'ninety'
-        WHEN 91 THEN 'ninety-one'
-        WHEN 92 THEN 'ninety-two'
-        WHEN 93 THEN 'ninety-three'
-        WHEN 94 THEN 'ninety-four'
-        WHEN 95 THEN 'ninety-five'
-        WHEN 96 THEN 'ninety-six'
-        WHEN 97 THEN 'ninety-seven'
-        WHEN 98 THEN 'ninety-eight'
-        WHEN 99 THEN 'ninety-nine'
-        WHEN 100 THEN 'one hundred'
-      ELSE
+    select
+      case c1
+        when 1 then 'one'
+        when 2 then 'two'
+        when 3 then 'three'
+        when 4 then 'four'
+        when 5 then 'five'
+        when 6 then 'six'
+        when 7 then 'seven'
+        when 8 then 'eight'
+        when 9 then 'nine'
+        when 10 then 'ten'
+        when 11 then 'eleven'
+        when 12 then 'twelve'
+        when 13 then 'thirteen'
+        when 14 then 'fourteen'
+        when 15 then 'fifteen'
+        when 16 then 'sixteen'
+        when 17 then 'seventeen'
+        when 18 then 'eighteen'
+        when 19 then 'nineteen'
+        when 20 then 'twenty'
+        when 21 then 'twenty-one'
+        when 22 then 'twenty-two'
+        when 23 then 'twenty-three'
+        when 24 then 'twenty-four'
+        when 25 then 'twenty-five'
+        when 26 then 'twenty-six'
+        when 27 then 'twenty-seven'
+        when 28 then 'twenty-eight'
+        when 29 then 'twenty-nine'
+        when 30 then 'thirty'
+        when 31 then 'thirty-one'
+        when 32 then 'thirty-two'
+        when 33 then 'thirty-three'
+        when 34 then 'thirty-four'
+        when 35 then 'thirty-five'
+        when 36 then 'thirty-six'
+        when 37 then 'thirty-seven'
+        when 38 then 'thirty-eight'
+        when 39 then 'thirty-nine'
+        when 40 then 'forty'
+        when 41 then 'forty-one'
+        when 42 then 'forty-two'
+        when 43 then 'forty-three'
+        when 44 then 'forty-four'
+        when 45 then 'forty-five'
+        when 46 then 'forty-six'
+        when 47 then 'forty-seven'
+        when 48 then 'forty-eight'
+        when 49 then 'forty-nine'
+        when 50 then 'fifty'
+        when 51 then 'fifty-one'
+        when 52 then 'fifty-two'
+        when 53 then 'fifty-three'
+        when 54 then 'fifty-four'
+        when 55 then 'fifty-five'
+        when 56 then 'fifty-six'
+        when 57 then 'fifty-seven'
+        when 58 then 'fifty-eight'
+        when 59 then 'fifty-nine'
+        when 60 then 'sixty'
+        when 61 then 'sixty-one'
+        when 62 then 'sixty-two'
+        when 63 then 'sixty-three'
+        when 64 then 'sixty-four'
+        when 65 then 'sixty-five'
+        when 66 then 'sixty-six'
+        when 67 then 'sixty-seven'
+        when 68 then 'sixty-eight'
+        when 69 then 'sixty-nine'
+        when 70 then 'seventy'
+        when 71 then 'seventy-one'
+        when 72 then 'seventy-two'
+        when 73 then 'seventy-three'
+        when 74 then 'seventy-four'
+        when 75 then 'seventy-five'
+        when 76 then 'seventy-six'
+        when 77 then 'seventy-seven'
+        when 78 then 'seventy-eight'
+        when 79 then 'seventy-nine'
+        when 80 then 'eighty'
+        when 81 then 'eighty-one'
+        when 82 then 'eighty-two'
+        when 83 then 'eighty-three'
+        when 84 then 'eighty-four'
+        when 85 then 'eighty-five'
+        when 86 then 'eighty-six'
+        when 87 then 'eighty-seven'
+        when 88 then 'eighty-eight'
+        when 89 then 'eighty-nine'
+        when 90 then 'ninety'
+        when 91 then 'ninety-one'
+        when 92 then 'ninety-two'
+        when 93 then 'ninety-three'
+        when 94 then 'ninety-four'
+        when 95 then 'ninety-five'
+        when 96 then 'ninety-six'
+        when 97 then 'ninety-seven'
+        when 98 then 'ninety-eight'
+        when 99 then 'ninety-nine'
+        when 100 then 'one hundred'
+      else
         '114514'
-      END
-    FROM t1;
+      end
+    from t1;
   expected_outputs:
   - logical_plan
   - batch_plan
@@ -119,43 +119,43 @@
   before:
   - create_table
   sql: |
-    SELECT
-      CASE c1
-        WHEN 1 THEN c1 + 1
-        WHEN 2 THEN c2 + 1
-        WHEN 3 THEN c3 + 1
-        WHEN 4 THEN c1 + 2
-        WHEN 5 THEN c2 + 2
-        WHEN 6 THEN c3 + 2
-        WHEN 7 THEN c1 + 3
-        WHEN 8 THEN c2 + 3
-        WHEN 9 THEN c3 + 3
-        WHEN 10 THEN c1 + c2 + 1
-        WHEN 11 THEN c2 + c3 + 2
-        WHEN 12 THEN c3 + c1 + 2
-        WHEN 13 THEN c1 + c3
-        WHEN 14 THEN c2 + c2
-        WHEN 15 THEN c3 + c1
-        WHEN 16 THEN c1 + c2 + 2
-        WHEN 17 THEN c2 + c3 + 2
-        WHEN 18 THEN c3 + c1 + 2
-        WHEN 19 THEN c1 + c2 + c3 + 1
-        WHEN 20 THEN c2 + c3 + c1 + 1
-        WHEN 21 THEN c3 + c1 + c2 + 1
-        WHEN 22 THEN c1 + c2 + c3 + c1
-        WHEN 23 THEN c2 + c3 + c1 + c2
-        WHEN 24 THEN c3 + c1 + c2 + c3
-        WHEN 25 THEN c1 + 1
-        WHEN 26 THEN c2 + 1
-        WHEN 27 THEN c3 + 1
-        WHEN 28 THEN c1 + 2
-        WHEN 29 THEN c2 + 2
-        WHEN 30 THEN c3 + 2
-        WHEN 31 THEN c1 + 1030
-      ELSE
+    select
+      case c1
+        when 1 then c1 + 1
+        when 2 then c2 + 1
+        when 3 then c3 + 1
+        when 4 then c1 + 2
+        when 5 then c2 + 2
+        when 6 then c3 + 2
+        when 7 then c1 + 3
+        when 8 then c2 + 3
+        when 9 then c3 + 3
+        when 10 then c1 + c2 + 1
+        when 11 then c2 + c3 + 2
+        when 12 then c3 + c1 + 2
+        when 13 then c1 + c3
+        when 14 then c2 + c2
+        when 15 then c3 + c1
+        when 16 then c1 + c2 + 2
+        when 17 then c2 + c3 + 2
+        when 18 then c3 + c1 + 2
+        when 19 then c1 + c2 + c3 + 1
+        when 20 then c2 + c3 + c1 + 1
+        when 21 then c3 + c1 + c2 + 1
+        when 22 then c1 + c2 + c3 + c1
+        when 23 then c2 + c3 + c1 + c2
+        when 24 then c3 + c1 + c2 + c3
+        when 25 then c1 + 1
+        when 26 then c2 + 1
+        when 27 then c3 + 1
+        when 28 then c1 + 2
+        when 29 then c2 + 2
+        when 30 then c3 + 2
+        when 31 then c1 + 1030
+      else
         114514 + c1 + c2 + c3 + 1919810
-      END
-    FROM t1;
+      end
+    from t1;
   expected_outputs:
   - logical_plan
   - batch_plan
@@ -163,43 +163,90 @@
   before:
   - create_table
   sql: |
-    SELECT
-      CASE c1
-        WHEN 1 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 2 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 3 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 4 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 5 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 6 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 7 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 8 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 9 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 10 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 11 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 12 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 13 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 14 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 15 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 16 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 17 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 18 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 19 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 20 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 21 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 22 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 23 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 24 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 25 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 26 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 27 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 28 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 29 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 30 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 31 THEN 'πŸ˜‘πŸ˜‘πŸ˜‘θΏ™ζ˜―ηˆ±ζƒ…πŸ˜­πŸ˜­πŸ˜­'
-      ELSE
+    select
+      case c1
+        when 1 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 2 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 3 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 4 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 5 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 6 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 7 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 8 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 9 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 10 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 11 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 12 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 13 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 14 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 15 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 16 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 17 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 18 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 19 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 20 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 21 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 22 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 23 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 24 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 25 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 26 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 27 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 28 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 29 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 30 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 31 then 'πŸ˜‘πŸ˜‘πŸ˜‘θΏ™ζ˜―ηˆ±ζƒ…πŸ˜­πŸ˜­πŸ˜­'
+      else
         '❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯'
-      END
-    FROM t1;
+      end
+    from t1;
+  expected_outputs:
+  - logical_plan
+  - batch_plan
+- id: const_case_when_basic
+  sql: |
+    select
+      case 1
+        when 1 then 114514
+        else 1919810
+      end;
+  expected_outputs:
+  - logical_plan
+  - batch_plan
+- id: const_case_when_with_table
+  before:
+  - create_table
+  sql: |
+    select
+      case 1
+        when 1 then 114514
+        when 2 then 1919810
+        when 3 then 101010
+        else 111111
+      end
+    from t1;
+  expected_outputs:
+  - logical_plan
+  - batch_plan
+- id: const_case_when_with_functions
+  sql: |
+    select
+      case 2
+        when 1 then regexp_count('foobarbaz', 'b..', 3)
+        when 2 then regexp_count('ABCABCAXYaxy', '[a-c]', 1, 'i')
+        when 3 then regexp_count('ABCABCAXYaxy', 'A.')
+        else 0
+      end;
+  expected_outputs:
+  - logical_plan
+  - batch_plan
+- id: const_case_when_fallback_case
+  sql: |
+    select
+      case 1
+        when 0 then 114514
+        else 1919810
+      end;
   expected_outputs:
   - logical_plan
   - batch_plan
\ No newline at end of file
diff --git a/src/frontend/planner_test/tests/testdata/output/case_when_optimization.yaml b/src/frontend/planner_test/tests/testdata/output/case_when_optimization.yaml
index 92545c9654533..60d4c56f99517 100644
--- a/src/frontend/planner_test/tests/testdata/output/case_when_optimization.yaml
+++ b/src/frontend/planner_test/tests/testdata/output/case_when_optimization.yaml
@@ -1,117 +1,117 @@
 # This file is automatically generated. See `src/frontend/planner_test/README.md` for more information.
 - id: create_table
   sql: |
-    CREATE TABLE t1 (c1 INT, c2 INT, c3 INT);
+    create table t1 (c1 INT, c2 INT, c3 INT);
 - id: basic_optimization_pattern
   before:
   - create_table
   sql: |
-    SELECT
-      CASE c1
-        WHEN 1 THEN 'one'
-        WHEN 2 THEN 'two'
-        WHEN 3 THEN 'three'
-        WHEN 4 THEN 'four'
-        WHEN 5 THEN 'five'
-        WHEN 6 THEN 'six'
-        WHEN 7 THEN 'seven'
-        WHEN 8 THEN 'eight'
-        WHEN 9 THEN 'nine'
-        WHEN 10 THEN 'ten'
-        WHEN 11 THEN 'eleven'
-        WHEN 12 THEN 'twelve'
-        WHEN 13 THEN 'thirteen'
-        WHEN 14 THEN 'fourteen'
-        WHEN 15 THEN 'fifteen'
-        WHEN 16 THEN 'sixteen'
-        WHEN 17 THEN 'seventeen'
-        WHEN 18 THEN 'eighteen'
-        WHEN 19 THEN 'nineteen'
-        WHEN 20 THEN 'twenty'
-        WHEN 21 THEN 'twenty-one'
-        WHEN 22 THEN 'twenty-two'
-        WHEN 23 THEN 'twenty-three'
-        WHEN 24 THEN 'twenty-four'
-        WHEN 25 THEN 'twenty-five'
-        WHEN 26 THEN 'twenty-six'
-        WHEN 27 THEN 'twenty-seven'
-        WHEN 28 THEN 'twenty-eight'
-        WHEN 29 THEN 'twenty-nine'
-        WHEN 30 THEN 'thirty'
-        WHEN 31 THEN 'thirty-one'
-        WHEN 32 THEN 'thirty-two'
-        WHEN 33 THEN 'thirty-three'
-        WHEN 34 THEN 'thirty-four'
-        WHEN 35 THEN 'thirty-five'
-        WHEN 36 THEN 'thirty-six'
-        WHEN 37 THEN 'thirty-seven'
-        WHEN 38 THEN 'thirty-eight'
-        WHEN 39 THEN 'thirty-nine'
-        WHEN 40 THEN 'forty'
-        WHEN 41 THEN 'forty-one'
-        WHEN 42 THEN 'forty-two'
-        WHEN 43 THEN 'forty-three'
-        WHEN 44 THEN 'forty-four'
-        WHEN 45 THEN 'forty-five'
-        WHEN 46 THEN 'forty-six'
-        WHEN 47 THEN 'forty-seven'
-        WHEN 48 THEN 'forty-eight'
-        WHEN 49 THEN 'forty-nine'
-        WHEN 50 THEN 'fifty'
-        WHEN 51 THEN 'fifty-one'
-        WHEN 52 THEN 'fifty-two'
-        WHEN 53 THEN 'fifty-three'
-        WHEN 54 THEN 'fifty-four'
-        WHEN 55 THEN 'fifty-five'
-        WHEN 56 THEN 'fifty-six'
-        WHEN 57 THEN 'fifty-seven'
-        WHEN 58 THEN 'fifty-eight'
-        WHEN 59 THEN 'fifty-nine'
-        WHEN 60 THEN 'sixty'
-        WHEN 61 THEN 'sixty-one'
-        WHEN 62 THEN 'sixty-two'
-        WHEN 63 THEN 'sixty-three'
-        WHEN 64 THEN 'sixty-four'
-        WHEN 65 THEN 'sixty-five'
-        WHEN 66 THEN 'sixty-six'
-        WHEN 67 THEN 'sixty-seven'
-        WHEN 68 THEN 'sixty-eight'
-        WHEN 69 THEN 'sixty-nine'
-        WHEN 70 THEN 'seventy'
-        WHEN 71 THEN 'seventy-one'
-        WHEN 72 THEN 'seventy-two'
-        WHEN 73 THEN 'seventy-three'
-        WHEN 74 THEN 'seventy-four'
-        WHEN 75 THEN 'seventy-five'
-        WHEN 76 THEN 'seventy-six'
-        WHEN 77 THEN 'seventy-seven'
-        WHEN 78 THEN 'seventy-eight'
-        WHEN 79 THEN 'seventy-nine'
-        WHEN 80 THEN 'eighty'
-        WHEN 81 THEN 'eighty-one'
-        WHEN 82 THEN 'eighty-two'
-        WHEN 83 THEN 'eighty-three'
-        WHEN 84 THEN 'eighty-four'
-        WHEN 85 THEN 'eighty-five'
-        WHEN 86 THEN 'eighty-six'
-        WHEN 87 THEN 'eighty-seven'
-        WHEN 88 THEN 'eighty-eight'
-        WHEN 89 THEN 'eighty-nine'
-        WHEN 90 THEN 'ninety'
-        WHEN 91 THEN 'ninety-one'
-        WHEN 92 THEN 'ninety-two'
-        WHEN 93 THEN 'ninety-three'
-        WHEN 94 THEN 'ninety-four'
-        WHEN 95 THEN 'ninety-five'
-        WHEN 96 THEN 'ninety-six'
-        WHEN 97 THEN 'ninety-seven'
-        WHEN 98 THEN 'ninety-eight'
-        WHEN 99 THEN 'ninety-nine'
-        WHEN 100 THEN 'one hundred'
-      ELSE
+    select
+      case c1
+        when 1 then 'one'
+        when 2 then 'two'
+        when 3 then 'three'
+        when 4 then 'four'
+        when 5 then 'five'
+        when 6 then 'six'
+        when 7 then 'seven'
+        when 8 then 'eight'
+        when 9 then 'nine'
+        when 10 then 'ten'
+        when 11 then 'eleven'
+        when 12 then 'twelve'
+        when 13 then 'thirteen'
+        when 14 then 'fourteen'
+        when 15 then 'fifteen'
+        when 16 then 'sixteen'
+        when 17 then 'seventeen'
+        when 18 then 'eighteen'
+        when 19 then 'nineteen'
+        when 20 then 'twenty'
+        when 21 then 'twenty-one'
+        when 22 then 'twenty-two'
+        when 23 then 'twenty-three'
+        when 24 then 'twenty-four'
+        when 25 then 'twenty-five'
+        when 26 then 'twenty-six'
+        when 27 then 'twenty-seven'
+        when 28 then 'twenty-eight'
+        when 29 then 'twenty-nine'
+        when 30 then 'thirty'
+        when 31 then 'thirty-one'
+        when 32 then 'thirty-two'
+        when 33 then 'thirty-three'
+        when 34 then 'thirty-four'
+        when 35 then 'thirty-five'
+        when 36 then 'thirty-six'
+        when 37 then 'thirty-seven'
+        when 38 then 'thirty-eight'
+        when 39 then 'thirty-nine'
+        when 40 then 'forty'
+        when 41 then 'forty-one'
+        when 42 then 'forty-two'
+        when 43 then 'forty-three'
+        when 44 then 'forty-four'
+        when 45 then 'forty-five'
+        when 46 then 'forty-six'
+        when 47 then 'forty-seven'
+        when 48 then 'forty-eight'
+        when 49 then 'forty-nine'
+        when 50 then 'fifty'
+        when 51 then 'fifty-one'
+        when 52 then 'fifty-two'
+        when 53 then 'fifty-three'
+        when 54 then 'fifty-four'
+        when 55 then 'fifty-five'
+        when 56 then 'fifty-six'
+        when 57 then 'fifty-seven'
+        when 58 then 'fifty-eight'
+        when 59 then 'fifty-nine'
+        when 60 then 'sixty'
+        when 61 then 'sixty-one'
+        when 62 then 'sixty-two'
+        when 63 then 'sixty-three'
+        when 64 then 'sixty-four'
+        when 65 then 'sixty-five'
+        when 66 then 'sixty-six'
+        when 67 then 'sixty-seven'
+        when 68 then 'sixty-eight'
+        when 69 then 'sixty-nine'
+        when 70 then 'seventy'
+        when 71 then 'seventy-one'
+        when 72 then 'seventy-two'
+        when 73 then 'seventy-three'
+        when 74 then 'seventy-four'
+        when 75 then 'seventy-five'
+        when 76 then 'seventy-six'
+        when 77 then 'seventy-seven'
+        when 78 then 'seventy-eight'
+        when 79 then 'seventy-nine'
+        when 80 then 'eighty'
+        when 81 then 'eighty-one'
+        when 82 then 'eighty-two'
+        when 83 then 'eighty-three'
+        when 84 then 'eighty-four'
+        when 85 then 'eighty-five'
+        when 86 then 'eighty-six'
+        when 87 then 'eighty-seven'
+        when 88 then 'eighty-eight'
+        when 89 then 'eighty-nine'
+        when 90 then 'ninety'
+        when 91 then 'ninety-one'
+        when 92 then 'ninety-two'
+        when 93 then 'ninety-three'
+        when 94 then 'ninety-four'
+        when 95 then 'ninety-five'
+        when 96 then 'ninety-six'
+        when 97 then 'ninety-seven'
+        when 98 then 'ninety-eight'
+        when 99 then 'ninety-nine'
+        when 100 then 'one hundred'
+      else
         '114514'
-      END
-    FROM t1;
+      end
+    from t1;
   logical_plan: |-
     LogicalProject
     β”œβ”€exprs: ConstantLookup(t1.c1, 1:Int32, 'one':Varchar, 2:Int32, 'two':Varchar, 3:Int32, 'three':Varchar, 4:Int32, 'four':Varchar, 5:Int32, 'five':Varchar, 6:Int32, 'six':Varchar, 7:Int32, 'seven':Varchar, 8:Int32, 'eight':Varchar, 9:Int32, 'nine':Varchar, 10:Int32, 'ten':Varchar, 11:Int32, 'eleven':Varchar, 12:Int32, 'twelve':Varchar, 13:Int32, 'thirteen':Varchar, 14:Int32, 'fourteen':Varchar, 15:Int32, 'fifteen':Varchar, 16:Int32, 'sixteen':Varchar, 17:Int32, 'seventeen':Varchar, 18:Int32, 'eighteen':Varchar, 19:Int32, 'nineteen':Varchar, 20:Int32, 'twenty':Varchar, 21:Int32, 'twenty-one':Varchar, 22:Int32, 'twenty-two':Varchar, 23:Int32, 'twenty-three':Varchar, 24:Int32, 'twenty-four':Varchar, 25:Int32, 'twenty-five':Varchar, 26:Int32, 'twenty-six':Varchar, 27:Int32, 'twenty-seven':Varchar, 28:Int32, 'twenty-eight':Varchar, 29:Int32, 'twenty-nine':Varchar, 30:Int32, 'thirty':Varchar, 31:Int32, 'thirty-one':Varchar, 32:Int32, 'thirty-two':Varchar, 33:Int32, 'thirty-three':Varchar, 34:Int32, 'thirty-four':Varchar, 35:Int32, 'thirty-five':Varchar, 36:Int32, 'thirty-six':Varchar, 37:Int32, 'thirty-seven':Varchar, 38:Int32, 'thirty-eight':Varchar, 39:Int32, 'thirty-nine':Varchar, 40:Int32, 'forty':Varchar, 41:Int32, 'forty-one':Varchar, 42:Int32, 'forty-two':Varchar, 43:Int32, 'forty-three':Varchar, 44:Int32, 'forty-four':Varchar, 45:Int32, 'forty-five':Varchar, 46:Int32, 'forty-six':Varchar, 47:Int32, 'forty-seven':Varchar, 48:Int32, 'forty-eight':Varchar, 49:Int32, 'forty-nine':Varchar, 50:Int32, 'fifty':Varchar, 51:Int32, 'fifty-one':Varchar, 52:Int32, 'fifty-two':Varchar, 53:Int32, 'fifty-three':Varchar, 54:Int32, 'fifty-four':Varchar, 55:Int32, 'fifty-five':Varchar, 56:Int32, 'fifty-six':Varchar, 57:Int32, 'fifty-seven':Varchar, 58:Int32, 'fifty-eight':Varchar, 59:Int32, 'fifty-nine':Varchar, 60:Int32, 'sixty':Varchar, 61:Int32, 'sixty-one':Varchar, 62:Int32, 'sixty-two':Varchar, 63:Int32, 'sixty-three':Varchar, 64:Int32, 'sixty-four':Varchar, 65:Int32, 'sixty-five':Varchar, 66:Int32, 'sixty-six':Varchar, 67:Int32, 'sixty-seven':Varchar, 68:Int32, 'sixty-eight':Varchar, 69:Int32, 'sixty-nine':Varchar, 70:Int32, 'seventy':Varchar, 71:Int32, 'seventy-one':Varchar, 72:Int32, 'seventy-two':Varchar, 73:Int32, 'seventy-three':Varchar, 74:Int32, 'seventy-four':Varchar, 75:Int32, 'seventy-five':Varchar, 76:Int32, 'seventy-six':Varchar, 77:Int32, 'seventy-seven':Varchar, 78:Int32, 'seventy-eight':Varchar, 79:Int32, 'seventy-nine':Varchar, 80:Int32, 'eighty':Varchar, 81:Int32, 'eighty-one':Varchar, 82:Int32, 'eighty-two':Varchar, 83:Int32, 'eighty-three':Varchar, 84:Int32, 'eighty-four':Varchar, 85:Int32, 'eighty-five':Varchar, 86:Int32, 'eighty-six':Varchar, 87:Int32, 'eighty-seven':Varchar, 88:Int32, 'eighty-eight':Varchar, 89:Int32, 'eighty-nine':Varchar, 90:Int32, 'ninety':Varchar, 91:Int32, 'ninety-one':Varchar, 92:Int32, 'ninety-two':Varchar, 93:Int32, 'ninety-three':Varchar, 94:Int32, 'ninety-four':Varchar, 95:Int32, 'ninety-five':Varchar, 96:Int32, 'ninety-six':Varchar, 97:Int32, 'ninety-seven':Varchar, 98:Int32, 'ninety-eight':Varchar, 99:Int32, 'ninety-nine':Varchar, 100:Int32, 'one hundred':Varchar, '114514':Varchar) as $expr1
@@ -125,43 +125,43 @@
   before:
   - create_table
   sql: |
-    SELECT
-      CASE c1
-        WHEN 1 THEN c1 + 1
-        WHEN 2 THEN c2 + 1
-        WHEN 3 THEN c3 + 1
-        WHEN 4 THEN c1 + 2
-        WHEN 5 THEN c2 + 2
-        WHEN 6 THEN c3 + 2
-        WHEN 7 THEN c1 + 3
-        WHEN 8 THEN c2 + 3
-        WHEN 9 THEN c3 + 3
-        WHEN 10 THEN c1 + c2 + 1
-        WHEN 11 THEN c2 + c3 + 2
-        WHEN 12 THEN c3 + c1 + 2
-        WHEN 13 THEN c1 + c3
-        WHEN 14 THEN c2 + c2
-        WHEN 15 THEN c3 + c1
-        WHEN 16 THEN c1 + c2 + 2
-        WHEN 17 THEN c2 + c3 + 2
-        WHEN 18 THEN c3 + c1 + 2
-        WHEN 19 THEN c1 + c2 + c3 + 1
-        WHEN 20 THEN c2 + c3 + c1 + 1
-        WHEN 21 THEN c3 + c1 + c2 + 1
-        WHEN 22 THEN c1 + c2 + c3 + c1
-        WHEN 23 THEN c2 + c3 + c1 + c2
-        WHEN 24 THEN c3 + c1 + c2 + c3
-        WHEN 25 THEN c1 + 1
-        WHEN 26 THEN c2 + 1
-        WHEN 27 THEN c3 + 1
-        WHEN 28 THEN c1 + 2
-        WHEN 29 THEN c2 + 2
-        WHEN 30 THEN c3 + 2
-        WHEN 31 THEN c1 + 1030
-      ELSE
+    select
+      case c1
+        when 1 then c1 + 1
+        when 2 then c2 + 1
+        when 3 then c3 + 1
+        when 4 then c1 + 2
+        when 5 then c2 + 2
+        when 6 then c3 + 2
+        when 7 then c1 + 3
+        when 8 then c2 + 3
+        when 9 then c3 + 3
+        when 10 then c1 + c2 + 1
+        when 11 then c2 + c3 + 2
+        when 12 then c3 + c1 + 2
+        when 13 then c1 + c3
+        when 14 then c2 + c2
+        when 15 then c3 + c1
+        when 16 then c1 + c2 + 2
+        when 17 then c2 + c3 + 2
+        when 18 then c3 + c1 + 2
+        when 19 then c1 + c2 + c3 + 1
+        when 20 then c2 + c3 + c1 + 1
+        when 21 then c3 + c1 + c2 + 1
+        when 22 then c1 + c2 + c3 + c1
+        when 23 then c2 + c3 + c1 + c2
+        when 24 then c3 + c1 + c2 + c3
+        when 25 then c1 + 1
+        when 26 then c2 + 1
+        when 27 then c3 + 1
+        when 28 then c1 + 2
+        when 29 then c2 + 2
+        when 30 then c3 + 2
+        when 31 then c1 + 1030
+      else
         114514 + c1 + c2 + c3 + 1919810
-      END
-    FROM t1;
+      end
+    from t1;
   logical_plan: |-
     LogicalProject { exprs: [ConstantLookup(t1.c1, 1:Int32, (t1.c1 + 1:Int32), 2:Int32, (t1.c2 + 1:Int32), 3:Int32, (t1.c3 + 1:Int32), 4:Int32, (t1.c1 + 2:Int32), 5:Int32, (t1.c2 + 2:Int32), 6:Int32, (t1.c3 + 2:Int32), 7:Int32, (t1.c1 + 3:Int32), 8:Int32, (t1.c2 + 3:Int32), 9:Int32, (t1.c3 + 3:Int32), 10:Int32, ((t1.c1 + t1.c2) + 1:Int32), 11:Int32, ((t1.c2 + t1.c3) + 2:Int32), 12:Int32, ((t1.c3 + t1.c1) + 2:Int32), 13:Int32, (t1.c1 + t1.c3), 14:Int32, (t1.c2 + t1.c2), 15:Int32, (t1.c3 + t1.c1), 16:Int32, ((t1.c1 + t1.c2) + 2:Int32), 17:Int32, ((t1.c2 + t1.c3) + 2:Int32), 18:Int32, ((t1.c3 + t1.c1) + 2:Int32), 19:Int32, (((t1.c1 + t1.c2) + t1.c3) + 1:Int32), 20:Int32, (((t1.c2 + t1.c3) + t1.c1) + 1:Int32), 21:Int32, (((t1.c3 + t1.c1) + t1.c2) + 1:Int32), 22:Int32, (((t1.c1 + t1.c2) + t1.c3) + t1.c1), 23:Int32, (((t1.c2 + t1.c3) + t1.c1) + t1.c2), 24:Int32, (((t1.c3 + t1.c1) + t1.c2) + t1.c3), 25:Int32, (t1.c1 + 1:Int32), 26:Int32, (t1.c2 + 1:Int32), 27:Int32, (t1.c3 + 1:Int32), 28:Int32, (t1.c1 + 2:Int32), 29:Int32, (t1.c2 + 2:Int32), 30:Int32, (t1.c3 + 2:Int32), 31:Int32, (t1.c1 + 1030:Int32), ((((114514:Int32 + t1.c1) + t1.c2) + t1.c3) + 1919810:Int32)) as $expr1] }
     └─LogicalScan { table: t1, columns: [t1.c1, t1.c2, t1.c3, t1._row_id] }
@@ -175,43 +175,43 @@
   before:
   - create_table
   sql: |
-    SELECT
-      CASE c1
-        WHEN 1 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 2 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 3 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 4 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 5 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 6 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 7 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 8 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 9 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 10 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 11 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 12 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 13 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 14 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 15 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 16 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 17 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 18 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 19 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 20 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 21 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 22 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 23 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 24 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 25 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 26 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 27 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 28 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 29 THEN regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 30 THEN regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
-        WHEN 31 THEN 'πŸ˜‘πŸ˜‘πŸ˜‘θΏ™ζ˜―ηˆ±ζƒ…πŸ˜­πŸ˜­πŸ˜­'
-      ELSE
+    select
+      case c1
+        when 1 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 2 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 3 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 4 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 5 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 6 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 7 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 8 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 9 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 10 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 11 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 12 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 13 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 14 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 15 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 16 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 17 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 18 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 19 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 20 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 21 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 22 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 23 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 24 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 25 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 26 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 27 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 28 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 29 then regexp_replace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 30 then regexp_replace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯', 'baz(...)', 'θΏ™ζ˜―πŸ₯΅', 'ic')
+        when 31 then 'πŸ˜‘πŸ˜‘πŸ˜‘θΏ™ζ˜―ηˆ±ζƒ…πŸ˜­πŸ˜­πŸ˜­'
+      else
         '❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯'
-      END
-    FROM t1;
+      end
+    from t1;
   logical_plan: |-
     LogicalProject
     β”œβ”€exprs: ConstantLookup(t1.c1, 1:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 2:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 3:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 4:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 5:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 6:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 7:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 8:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 9:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 10:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 11:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 12:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 13:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 14:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 15:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 16:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 17:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 18:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 19:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 20:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 21:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 22:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 23:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 24:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 25:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 26:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 27:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 28:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 29:Int32, RegexpReplace('πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 30:Int32, RegexpReplace('πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­bazθΏ™δΈζ˜―ηˆ±ζƒ…β€οΈβ€πŸ”₯':Varchar, 'baz(...)':Varchar, 'θΏ™ζ˜―πŸ₯΅':Varchar, 'ic':Varchar), 31:Int32, 'πŸ˜‘πŸ˜‘πŸ˜‘θΏ™ζ˜―ηˆ±ζƒ…πŸ˜­πŸ˜­πŸ˜­':Varchar, '❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯':Varchar) as $expr1
@@ -220,3 +220,57 @@
     BatchExchange { order: [], dist: Single }
     └─BatchProject { exprs: [ConstantLookup(t1.c1, 1:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 2:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 3:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 4:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 5:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 6:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 7:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 8:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 9:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 10:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 11:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 12:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 13:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 14:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 15:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 16:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 17:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 18:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 19:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 20:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 21:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 22:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 23:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 24:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 25:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 26:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 27:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 28:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 29:Int32, 'πŸ’©πŸ’©πŸ’©πŸ’©πŸ’©fooπŸ€”οΈbarδΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 30:Int32, 'πŸ’—πŸ’—πŸ’—πŸ’—πŸ’—δΊ²ηˆ±ηš„πŸ˜­θΏ™ζ˜―πŸ₯΅ηˆ±ζƒ…❀️‍πŸ”₯':Varchar, 31:Int32, 'πŸ˜‘πŸ˜‘πŸ˜‘θΏ™ζ˜―ηˆ±ζƒ…πŸ˜­πŸ˜­πŸ˜­':Varchar, '❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯❀️‍πŸ”₯':Varchar) as $expr1] }
       └─BatchScan { table: t1, columns: [t1.c1], distribution: SomeShard }
+- id: const_case_when_basic
+  sql: |
+    select
+      case 1
+        when 1 then 114514
+        else 1919810
+      end;
+  logical_plan: |-
+    LogicalProject { exprs: [114514:Int32] }
+    └─LogicalValues { rows: [[]], schema: Schema { fields: [] } }
+  batch_plan: 'BatchValues { rows: [[114514:Int32]] }'
+- id: const_case_when_with_table
+  before:
+  - create_table
+  sql: |
+    select
+      case 1
+        when 1 then 114514
+        when 2 then 1919810
+        when 3 then 101010
+        else 111111
+      end
+    from t1;
+  logical_plan: |-
+    LogicalProject { exprs: [114514:Int32] }
+    └─LogicalScan { table: t1, columns: [t1.c1, t1.c2, t1.c3, t1._row_id] }
+  batch_plan: |-
+    BatchExchange { order: [], dist: Single }
+    └─BatchProject { exprs: [114514:Int32] }
+      └─BatchScan { table: t1, columns: [], distribution: SomeShard }
+- id: const_case_when_with_functions
+  sql: |
+    select
+      case 2
+        when 1 then regexp_count('foobarbaz', 'b..', 3)
+        when 2 then regexp_count('ABCABCAXYaxy', '[a-c]', 1, 'i')
+        when 3 then regexp_count('ABCABCAXYaxy', 'A.')
+        else 0
+      end;
+  logical_plan: |-
+    LogicalProject { exprs: [RegexpCount('ABCABCAXYaxy':Varchar, '[a-c]':Varchar, 1:Int32, 'i':Varchar) as $expr1] }
+    └─LogicalValues { rows: [[]], schema: Schema { fields: [] } }
+  batch_plan: 'BatchValues { rows: [[8:Int32]] }'
+- id: const_case_when_fallback_case
+  sql: |
+    select
+      case 1
+        when 0 then 114514
+        else 1919810
+      end;
+  logical_plan: |-
+    LogicalProject { exprs: [1919810:Int32] }
+    └─LogicalValues { rows: [[]], schema: Schema { fields: [] } }
+  batch_plan: 'BatchValues { rows: [[1919810:Int32]] }'