Skip to content

Conversation

@rluvaton
Copy link
Member

@rluvaton rluvaton commented Oct 20, 2025

Half of the changes are new tests

Which issue does this PR close?

N/A

Part of:

Benchmark is in:

Rationale for this change

Optimize for Lookup table like CASE WHEN:

CASE company
    WHEN 1 THEN 'Apple'
    WHEN 5 THEN 'Samsung'
    WHEN 2 THEN 'Motorola'
    WHEN 3 THEN 'LG'
    ELSE 'Other'
END

What changes are included in this PR?

Implement the case when as a lookup table

Are these changes tested?

Yes, a lot

Are there any user-facing changes?

Nope


Benchmark results

(run against main before the #18152 was merged)

Env

$ neofetch
            .-/+oossssoo+/-.               ubuntu@ip-
        `:+ssssssssssssssssss+:`           -----------------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 24.04.3 LTS x86_64
    .ossssssssssssssssssdMMMNysssso.       Host: c5d.metal 00001
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 6.14.0-1011-aws
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 hour, 34 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 818 (dpkg), 4 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.2.21
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Terminal: /dev/pts/0
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Xeon Platinum 8275CL (96) @ 3.900GHz
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Memory: 1959MiB / 193026MiB
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

Formatted output

Lookup table from i32 to utf8

Details
Entries Match distribution In range Nulls Before After Speedup factor Improvement percent
5 only first 2 are true 0.1 0 342.42 µs 124.29 µs 2.76 63.70%
5 only first 2 are true 0.1 0.1 486.07 µs 132.26 µs 3.68 72.79%
5 only first 2 are true 0.1 0.5 452.28 µs 136.54 µs 3.31 69.81%
5 only first 2 are true 0.5 0 341.64 µs 124.24 µs 2.75 63.63%
5 only first 2 are true 0.5 0.1 485.5 µs 131.59 µs 3.69 72.90%
5 only first 2 are true 0.5 0.5 452.87 µs 136.07 µs 3.33 69.95%
5 only first 2 are true 0.9 0 342.3 µs 124.26 µs 2.75 63.70%
5 only first 2 are true 0.9 0.1 486.23 µs 131.58 µs 3.70 72.94%
5 only first 2 are true 1 0 342.17 µs 124.18 µs 2.76 63.71%
5 all equally true 0.1 0 572.16 µs 128.25 µs 4.46 77.59%
5 all equally true 0.1 0.1 729.22 µs 137.72 µs 5.29 81.11%
5 all equally true 0.1 0.5 613.92 µs 143.11 µs 4.29 76.69%
5 all equally true 0.5 0 581.46 µs 128.06 µs 4.54 77.98%
5 all equally true 0.5 0.1 729.15 µs 137.51 µs 5.30 81.14%
5 all equally true 0.5 0.5 614.96 µs 142.61 µs 4.31 76.81%
5 all equally true 0.9 0 582.95 µs 128.05 µs 4.55 78.03%
5 all equally true 0.9 0.1 729.73 µs 137.78 µs 5.30 81.12%
5 all equally true 1 0 582.91 µs 128.10 µs 4.55 78.02%
10 only first 2 are true 0.1 0 343.09 µs 124.25 µs 2.76 63.79%
10 only first 2 are true 0.1 0.1 485.82 µs 131.55 µs 3.69 72.92%
10 only first 2 are true 0.1 0.5 452.13 µs 135.86 µs 3.33 69.95%
10 only first 2 are true 0.5 0 341.8 µs 124.47 µs 2.75 63.58%
10 only first 2 are true 0.5 0.1 485.93 µs 131.76 µs 3.69 72.89%
10 only first 2 are true 0.5 0.5 451.78 µs 134.69 µs 3.35 70.19%
10 only first 2 are true 0.9 0 341.35 µs 124.23 µs 2.75 63.61%
10 only first 2 are true 0.9 0.1 486.49 µs 131.61 µs 3.70 72.95%
10 only first 2 are true 1 0 341.9 µs 124.23 µs 2.75 63.67%
10 all equally true 0.1 0 805.49 µs 128.42 µs 6.27 84.06%
10 all equally true 0.1 0.1 1.02 ms 139.42 µs 7.35 86.40%
10 all equally true 0.1 0.5 831.82 µs 148.33 µs 5.61 82.17%
10 all equally true 0.5 0 804.29 µs 127.81 µs 6.29 84.11%
10 all equally true 0.5 0.1 1.03 ms 139.43 µs 7.37 86.43%
10 all equally true 0.5 0.5 834.77 µs 147.32 µs 5.67 82.35%
10 all equally true 0.9 0 804.09 µs 127.89 µs 6.29 84.10%
10 all equally true 0.9 0.1 1.03 ms 139.37 µs 7.38 86.45%
10 all equally true 1 0 804.72 µs 127.62 µs 6.31 84.14%
20 only first 2 are true 0.1 0 341.46 µs 124.65 µs 2.74 63.50%
20 only first 2 are true 0.1 0.1 485.44 µs 131.55 µs 3.69 72.90%
20 only first 2 are true 0.1 0.5 451.93 µs 135.37 µs 3.34 70.05%
20 only first 2 are true 0.5 0 341.68 µs 124.20 µs 2.75 63.65%
20 only first 2 are true 0.5 0.1 485.82 µs 131.71 µs 3.69 72.89%
20 only first 2 are true 0.5 0.5 453.28 µs 134.95 µs 3.36 70.23%
20 only first 2 are true 0.9 0 342.09 µs 124.31 µs 2.75 63.66%
20 only first 2 are true 0.9 0.1 486.23 µs 131.68 µs 3.69 72.92%
20 only first 2 are true 1 0 344.5 µs 124.08 µs 2.78 63.98%
20 all equally true 0.1 0 1.17 ms 129.57 µs 9.07 88.97%
20 all equally true 0.1 0.1 1.52 ms 139.71 µs 10.88 90.81%
20 all equally true 0.1 0.5 1.23 ms 162.51 µs 7.56 86.77%
20 all equally true 0.5 0 1.17 ms 129.42 µs 9.05 88.95%
20 all equally true 0.5 0.1 1.53 ms 139.46 µs 10.94 90.86%
20 all equally true 0.5 0.5 1.23 ms 160.13 µs 7.69 86.99%
20 all equally true 0.9 0 1.17 ms 130.18 µs 9.00 88.89%
20 all equally true 0.9 0.1 1.53 ms 141.68 µs 10.79 90.73%
20 all equally true 1 0 1.17 ms 129.26 µs 9.05 88.95%

Lookup table from utf8 to i32

Details
Entries Match distribution In range Nulls Before After Speedup factor Improvement percent
5 only first 2 are true 0.1 0 446.57 µs 111.66 µs 4.00 75.00%
5 only first 2 are true 0.1 0.1 566.38 µs 118.01 µs 4.80 79.16%
5 only first 2 are true 0.1 0.5 516.01 µs 100.55 µs 5.13 80.51%
5 only first 2 are true 0.5 0 446.29 µs 111.84 µs 3.99 74.94%
5 only first 2 are true 0.5 0.1 566.8 µs 118.37 µs 4.79 79.12%
5 only first 2 are true 0.5 0.5 518.22 µs 100.57 µs 5.15 80.59%
5 only first 2 are true 0.9 0 446.05 µs 111.87 µs 3.99 74.92%
5 only first 2 are true 0.9 0.1 566.68 µs 118.22 µs 4.79 79.14%
5 only first 2 are true 1 0 445.79 µs 111.64 µs 3.99 74.96%
5 all equally true 0.1 0 807.39 µs 116.74 µs 6.92 85.54%
5 all equally true 0.1 0.1 966.6 µs 124.14 µs 7.79 87.16%
5 all equally true 0.1 0.5 804.4 µs 103.10 µs 7.80 87.18%
5 all equally true 0.5 0 806.04 µs 117.15 µs 6.88 85.47%
5 all equally true 0.5 0.1 965.02 µs 123.88 µs 7.79 87.16%
5 all equally true 0.5 0.5 807.47 µs 103.09 µs 7.83 87.23%
5 all equally true 0.9 0 807.35 µs 118.56 µs 6.81 85.32%
5 all equally true 0.9 0.1 968.4 µs 125.36 µs 7.72 87.06%
5 all equally true 1 0 808.66 µs 116.90 µs 6.92 85.54%
10 only first 2 are true 0.1 0 445.58 µs 111.32 µs 4.00 75.02%
10 only first 2 are true 0.1 0.1 565.28 µs 117.99 µs 4.79 79.13%
10 only first 2 are true 0.1 0.5 516.07 µs 100.66 µs 5.13 80.50%
10 only first 2 are true 0.5 0 444.97 µs 111.74 µs 3.98 74.89%
10 only first 2 are true 0.5 0.1 567.15 µs 118.50 µs 4.79 79.11%
10 only first 2 are true 0.5 0.5 517.95 µs 100.56 µs 5.15 80.59%
10 only first 2 are true 0.9 0 446 µs 111.74 µs 3.99 74.95%
10 only first 2 are true 0.9 0.1 567.03 µs 118.47 µs 4.79 79.11%
10 only first 2 are true 1 0 446.02 µs 111.67 µs 3.99 74.96%
10 all equally true 0.1 0 1.4 ms 116.93 µs 11.96 91.64%
10 all equally true 0.1 0.1 1.61 ms 123.50 µs 13.07 92.35%
10 all equally true 0.1 0.5 1.3 ms 102.04 µs 12.72 92.14%
10 all equally true 0.5 0 1.38 ms 116.69 µs 11.87 91.57%
10 all equally true 0.5 0.1 1.62 ms 123.70 µs 13.11 92.37%
10 all equally true 0.5 0.5 1.3 ms 102.63 µs 12.69 92.12%
10 all equally true 0.9 0 1.4 ms 116.34 µs 12.01 91.67%
10 all equally true 0.9 0.1 1.62 ms 123.65 µs 13.13 92.38%
10 all equally true 1 0 1.4 ms 115.50 µs 12.13 91.76%
20 only first 2 are true 0.1 0 444.8 µs 111.29 µs 4.00 74.98%
20 only first 2 are true 0.1 0.1 565.22 µs 117.95 µs 4.79 79.13%
20 only first 2 are true 0.1 0.5 515.85 µs 100.57 µs 5.13 80.50%
20 only first 2 are true 0.5 0 444.99 µs 111.71 µs 3.98 74.90%
20 only first 2 are true 0.5 0.1 567.19 µs 118.40 µs 4.79 79.13%
20 only first 2 are true 0.5 0.5 517.09 µs 100.73 µs 5.13 80.52%
20 only first 2 are true 0.9 0 444.54 µs 111.77 µs 3.98 74.86%
20 only first 2 are true 0.9 0.1 566.4 µs 118.35 µs 4.79 79.11%
20 only first 2 are true 1 0 444.98 µs 111.97 µs 3.97 74.84%
20 all equally true 0.1 0 2.38 ms 116.41 µs 20.47 95.12%
20 all equally true 0.1 0.1 2.74 ms 121.93 µs 22.45 95.55%
20 all equally true 0.1 0.5 2.16 ms 101.35 µs 21.31 95.31%
20 all equally true 0.5 0 2.37 ms 116.09 µs 20.45 95.11%
20 all equally true 0.5 0.1 2.74 ms 122.10 µs 22.45 95.55%
20 all equally true 0.5 0.5 2.16 ms 101.41 µs 21.33 95.31%
20 all equally true 0.9 0 2.37 ms 116.09 µs 20.42 95.10%
20 all equally true 0.9 0.1 2.75 ms 122.30 µs 22.50 95.56%
20 all equally true 1 0 2.37 ms 116.22 µs 20.43 95.11%

criterion output:

Benchmark results
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [128.08 µs 128.25 µs 128.47 µs]
                        change: [-77.646% -77.585% -77.523%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 15 outliers among 100 measurements (15.00%)
  5 (5.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [116.61 µs 116.74 µs 116.88 µs]
                        change: [-85.584% -85.541% -85.494%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  2 (2.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [124.21 µs 124.29 µs 124.40 µs]
                        change: [-63.787% -63.703% -63.618%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  3 (3.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [111.57 µs 111.66 µs 111.77 µs]
                        change: [-75.040% -74.996% -74.953%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [128.15 µs 128.42 µs 128.70 µs]
                        change: [-84.100% -84.057% -84.018%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [116.49 µs 116.93 µs 117.40 µs]
                        change: [-91.665% -91.637% -91.610%] (p = 0.00 < 0.05)
                        Performance has improved.
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [124.18 µs 124.25 µs 124.32 µs]
                        change: [-63.877% -63.785% -63.700%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [111.27 µs 111.32 µs 111.38 µs]
                        change: [-75.062% -75.017% -74.972%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  7 (7.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [129.47 µs 129.57 µs 129.71 µs]
                        change: [-88.994% -88.969% -88.947%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  1 (1.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [115.77 µs 116.41 µs 117.19 µs]
                        change: [-95.137% -95.115% -95.094%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  3 (3.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [124.45 µs 124.65 µs 124.88 µs]
                        change: [-63.587% -63.495% -63.392%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [111.20 µs 111.29 µs 111.41 µs]
                        change: [-75.032% -74.980% -74.925%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  4 (4.00%) high mild
  12 (12.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [137.62 µs 137.72 µs 137.85 µs]
                        change: [-81.149% -81.114% -81.080%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  2 (2.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [123.72 µs 124.14 µs 124.62 µs]
                        change: [-87.199% -87.157% -87.110%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  17 (17.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [132.00 µs 132.26 µs 132.54 µs]
                        change: [-72.864% -72.790% -72.722%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [117.86 µs 118.01 µs 118.19 µs]
                        change: [-79.210% -79.164% -79.123%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  3 (3.00%) high mild
  14 (14.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [139.31 µs 139.42 µs 139.56 µs]
                        change: [-86.426% -86.396% -86.369%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  1 (1.00%) high mild
  12 (12.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [123.41 µs 123.50 µs 123.58 µs]
                        change: [-92.365% -92.349% -92.335%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [131.40 µs 131.55 µs 131.70 µs]
                        change: [-72.995% -72.922% -72.862%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  4 (4.00%) low severe
  3 (3.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [117.82 µs 117.99 µs 118.18 µs]
                        change: [-79.171% -79.127% -79.084%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 20 outliers among 100 measurements (20.00%)
  17 (17.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [139.56 µs 139.71 µs 139.88 µs]
                        change: [-90.824% -90.806% -90.787%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [121.79 µs 121.93 µs 122.13 µs]
                        change: [-95.551% -95.545% -95.537%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [131.45 µs 131.55 µs 131.68 µs]
                        change: [-72.952% -72.901% -72.849%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  4 (4.00%) high mild
  12 (12.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [117.77 µs 117.95 µs 118.16 µs]
                        change: [-79.183% -79.132% -79.083%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 18 outliers among 100 measurements (18.00%)
  4 (4.00%) high mild
  14 (14.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [142.92 µs 143.11 µs 143.32 µs]
                        change: [-76.751% -76.689% -76.631%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [103.01 µs 103.10 µs 103.20 µs]
                        change: [-87.210% -87.183% -87.150%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [136.35 µs 136.54 µs 136.72 µs]
                        change: [-69.862% -69.811% -69.768%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [100.48 µs 100.55 µs 100.63 µs]
                        change: [-80.552% -80.514% -80.470%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [148.15 µs 148.33 µs 148.53 µs]
                        change: [-82.208% -82.168% -82.129%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [101.98 µs 102.04 µs 102.11 µs]
                        change: [-92.159% -92.140% -92.121%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [135.62 µs 135.86 µs 136.11 µs]
                        change: [-70.018% -69.951% -69.891%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [100.56 µs 100.66 µs 100.78 µs]
                        change: [-80.545% -80.495% -80.448%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [162.30 µs 162.51 µs 162.73 µs]
                        change: [-86.797% -86.769% -86.742%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [101.28 µs 101.35 µs 101.43 µs]
                        change: [-95.315% -95.307% -95.296%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [135.24 µs 135.37 µs 135.50 µs]
                        change: [-70.108% -70.046% -69.984%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [100.50 µs 100.57 µs 100.64 µs]
                        change: [-80.547% -80.504% -80.464%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [127.93 µs 128.06 µs 128.22 µs]
                        change: [-78.023% -77.976% -77.936%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  1 (1.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [117.03 µs 117.15 µs 117.27 µs]
                        change: [-85.495% -85.466% -85.438%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [124.19 µs 124.24 µs 124.30 µs]
                        change: [-63.716% -63.634% -63.552%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [111.71 µs 111.84 µs 111.99 µs]
                        change: [-74.989% -74.940% -74.897%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 27 outliers among 100 measurements (27.00%)
  13 (13.00%) low severe
  4 (4.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [127.65 µs 127.81 µs 128.00 µs]
                        change: [-84.142% -84.109% -84.075%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  3 (3.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [116.32 µs 116.69 µs 117.17 µs]
                        change: [-91.627% -91.573% -91.515%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  1 (1.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [124.30 µs 124.47 µs 124.67 µs]
                        change: [-63.643% -63.584% -63.525%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  1 (1.00%) high mild
  16 (16.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [111.57 µs 111.74 µs 111.93 µs]
                        change: [-74.941% -74.888% -74.840%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [129.27 µs 129.42 µs 129.60 µs]
                        change: [-88.965% -88.945% -88.927%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 19 outliers among 100 measurements (19.00%)
  3 (3.00%) high mild
  16 (16.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [115.99 µs 116.09 µs 116.19 µs]
                        change: [-95.120% -95.111% -95.103%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [124.12 µs 124.20 µs 124.31 µs]
                        change: [-63.736% -63.650% -63.558%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 15 outliers among 100 measurements (15.00%)
  6 (6.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [111.56 µs 111.71 µs 111.88 µs]
                        change: [-74.957% -74.896% -74.827%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [137.42 µs 137.51 µs 137.60 µs]
                        change: [-81.179% -81.141% -81.105%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 15 outliers among 100 measurements (15.00%)
  3 (3.00%) low severe
  7 (7.00%) low mild
  3 (3.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [123.76 µs 123.88 µs 124.00 µs]
                        change: [-87.183% -87.163% -87.143%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [131.53 µs 131.59 µs 131.66 µs]
                        change: [-72.950% -72.896% -72.845%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [118.16 µs 118.37 µs 118.60 µs]
                        change: [-79.167% -79.116% -79.055%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  12 (12.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [139.29 µs 139.43 µs 139.58 µs]
                        change: [-86.468% -86.429% -86.385%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [123.56 µs 123.70 µs 123.86 µs]
                        change: [-92.393% -92.373% -92.353%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [131.64 µs 131.76 µs 131.91 µs]
                        change: [-72.956% -72.885% -72.810%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  4 (4.00%) high mild
  13 (13.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [118.24 µs 118.50 µs 118.77 µs]
                        change: [-79.167% -79.106% -79.050%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [139.41 µs 139.46 µs 139.52 µs]
                        change: [-90.879% -90.862% -90.845%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  8 (8.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [121.95 µs 122.10 µs 122.28 µs]
                        change: [-95.557% -95.546% -95.533%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  4 (4.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [131.58 µs 131.71 µs 131.87 µs]
                        change: [-72.935% -72.889% -72.850%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  2 (2.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [118.20 µs 118.40 µs 118.64 µs]
                        change: [-79.170% -79.125% -79.082%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [142.46 µs 142.61 µs 142.79 µs]
                        change: [-76.856% -76.810% -76.763%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  2 (2.00%) low mild
  4 (4.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [103.02 µs 103.09 µs 103.17 µs]
                        change: [-87.259% -87.233% -87.205%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [135.88 µs 136.07 µs 136.30 µs]
                        change: [-70.013% -69.954% -69.895%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [100.50 µs 100.57 µs 100.65 µs]
                        change: [-80.633% -80.593% -80.551%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [147.17 µs 147.32 µs 147.49 µs]
                        change: [-82.386% -82.352% -82.315%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [102.54 µs 102.63 µs 102.73 µs]
                        change: [-92.137% -92.119% -92.099%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [134.61 µs 134.69 µs 134.78 µs]
                        change: [-70.271% -70.187% -70.123%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  2 (2.00%) low mild
  6 (6.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [100.45 µs 100.56 µs 100.67 µs]
                        change: [-80.633% -80.585% -80.535%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [159.96 µs 160.13 µs 160.31 µs]
                        change: [-87.017% -86.991% -86.966%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  13 (13.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [101.36 µs 101.41 µs 101.47 µs]
                        change: [-95.318% -95.311% -95.301%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [134.81 µs 134.95 µs 135.09 µs]
                        change: [-70.282% -70.228% -70.174%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  4 (4.00%) low mild
  7 (7.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [100.61 µs 100.73 µs 100.85 µs]
                        change: [-80.563% -80.520% -80.473%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [127.91 µs 128.05 µs 128.20 µs]
                        change: [-78.087% -78.034% -77.983%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [118.06 µs 118.56 µs 119.10 µs]
                        change: [-85.370% -85.315% -85.256%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [124.19 µs 124.26 µs 124.32 µs]
                        change: [-63.792% -63.699% -63.621%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  9 (9.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [111.69 µs 111.87 µs 112.07 µs]
                        change: [-74.973% -74.920% -74.872%] (p = 0.00 < 0.05)
                        Performance has improved.
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [127.74 µs 127.89 µs 128.07 µs]
                        change: [-84.129% -84.095% -84.058%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [116.19 µs 116.34 µs 116.51 µs]
                        change: [-91.690% -91.672% -91.653%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [124.18 µs 124.23 µs 124.29 µs]
                        change: [-63.657% -63.606% -63.545%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  1 (1.00%) low severe
  1 (1.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [111.52 µs 111.74 µs 111.95 µs]
                        change: [-74.998% -74.946% -74.896%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [129.91 µs 130.18 µs 130.51 µs]
                        change: [-88.921% -88.889% -88.859%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 15 outliers among 100 measurements (15.00%)
  15 (15.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [116.00 µs 116.09 µs 116.19 µs]
                        change: [-95.111% -95.104% -95.095%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [124.20 µs 124.31 µs 124.45 µs]
                        change: [-63.756% -63.662% -63.556%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  3 (3.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [111.60 µs 111.77 µs 111.94 µs]
                        change: [-74.990% -74.857% -74.664%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [137.66 µs 137.78 µs 137.93 µs]
                        change: [-81.153% -81.119% -81.083%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  4 (4.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [124.95 µs 125.36 µs 125.78 µs]
                        change: [-87.088% -87.055% -87.017%] (p = 0.00 < 0.05)
                        Performance has improved.
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [131.52 µs 131.58 µs 131.66 µs]
                        change: [-72.988% -72.939% -72.888%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  6 (6.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [118.03 µs 118.22 µs 118.44 µs]
                        change: [-79.185% -79.138% -79.089%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [139.27 µs 139.37 µs 139.49 µs]
                        change: [-86.483% -86.448% -86.421%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  10 (10.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [123.54 µs 123.65 µs 123.76 µs]
                        change: [-92.400% -92.383% -92.365%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  2 (2.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [131.51 µs 131.61 µs 131.72 µs]
                        change: [-73.003% -72.947% -72.901%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  2 (2.00%) low severe
  5 (5.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [118.27 µs 118.47 µs 118.70 µs]
                        change: [-79.156% -79.107% -79.060%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [141.51 µs 141.68 µs 141.89 µs]
                        change: [-90.749% -90.730% -90.712%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 21 outliers among 100 measurements (21.00%)
  2 (2.00%) low severe
  3 (3.00%) high mild
  16 (16.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [122.13 µs 122.30 µs 122.49 µs]
                        change: [-95.563% -95.555% -95.548%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [131.58 µs 131.68 µs 131.80 µs]
                        change: [-72.976% -72.918% -72.855%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  5 (5.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [118.14 µs 118.35 µs 118.58 µs]
                        change: [-79.153% -79.105% -79.050%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [127.98 µs 128.10 µs 128.25 µs]
                        change: [-78.069% -78.024% -77.986%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [116.73 µs 116.90 µs 117.07 µs]
                        change: [-85.570% -85.544% -85.516%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [124.02 µs 124.18 µs 124.31 µs]
                        change: [-63.838% -63.708% -63.602%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  1 (1.00%) low severe
  2 (2.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [111.48 µs 111.64 µs 111.83 µs]
                        change: [-75.031% -74.957% -74.892%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [127.48 µs 127.62 µs 127.80 µs]
                        change: [-84.177% -84.141% -84.108%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [115.30 µs 115.50 µs 115.67 µs]
                        change: [-91.778% -91.756% -91.738%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [124.17 µs 124.23 µs 124.30 µs]
                        change: [-63.781% -63.665% -63.581%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [111.50 µs 111.67 µs 111.87 µs]
                        change: [-75.016% -74.963% -74.910%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [129.18 µs 129.26 µs 129.36 µs]
                        change: [-88.983% -88.953% -88.915%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  10 (10.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [116.02 µs 116.22 µs 116.50 µs]
                        change: [-95.113% -95.105% -95.096%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [124.01 µs 124.08 µs 124.15 µs]
                        change: [-64.080% -63.983% -63.877%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [111.80 µs 111.97 µs 112.15 µs]
                        change: [-74.884% -74.837% -74.784%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe

</details>

@github-actions github-actions bot added the physical-expr Changes to the physical-expr crates label Oct 20, 2025
I don't like that it is in `sort_properties.rs` but this struct is used in `get_properties` which seems like the most appropriate place
@rluvaton rluvaton changed the title perf: optimize CASE WHEN lookup table - WIP perf: optimize CASE WHEN lookup table Oct 21, 2025
…to improve-performance-for-literal-mapping

# Conflicts:
#	datafusion/physical-expr/benches/case_when.rs
@rluvaton rluvaton marked this pull request as ready for review October 21, 2025 17:45
@rluvaton rluvaton changed the title perf: optimize CASE WHEN lookup table perf: optimize CASE WHEN lookup table (2.5-22.5 times faster) Oct 22, 2025
github-merge-queue bot pushed a commit that referenced this pull request Oct 22, 2025
## Which issue does this PR close?

N/A

But extracted from:
- #18183 

## Rationale for this change

I want to add optimization for lookup based `CASE WHEN` like:

```sql
CASE company
    WHEN 1 THEN 'Apple'
    WHEN 5 THEN 'Samsung'
    WHEN 2 THEN 'Motorola'
    WHEN 3 THEN 'LG'
    ELSE 'Other'
END
```

## What changes are included in this PR?

Added multiple benchmarks for testing lookup table from int to string
and vice verca

with different size of lookup table (5, 10, 20), different probabilities
for having values generated to exist in the lookup map, and
probabilities for the number of nulls

## Are these changes tested?

N/A

## Are there any user-facing changes?

nope



<details>
<summary>Current results</summary>

```
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [572.27 µs 572.51 µs 572.78 µs]
                        change: [-0.4311% -0.1953% +0.0524%] (p = 0.09 > 0.05)
                        No change in performance detected.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [808.11 µs 808.63 µs 809.30 µs]
                        change: [+0.2857% +0.4440% +0.6288%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [341.97 µs 342.52 µs 343.21 µs]
                        change: [-0.0740% +0.1913% +0.4541%] (p = 0.13 > 0.05)
                        No change in performance detected.
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [446.34 µs 446.58 µs 446.83 µs]
                        change: [-0.0381% +0.1947% +0.3941%] (p = 0.08 > 0.05)
                        No change in performance detected.
Found 12 outliers among 100 measurements (12.00%)
  8 (8.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [804.30 µs 804.79 µs 805.33 µs]
                        change: [+0.7523% +0.9613% +1.1731%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.1s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [1.3972 ms 1.3979 ms 1.3987 ms]
                        change: [-0.4150% -0.2455% -0.0613%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  7 (7.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [342.75 µs 342.96 µs 343.22 µs]
                        change: [+0.0122% +0.2433% +0.4781%] (p = 0.02 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [445.39 µs 445.56 µs 445.75 µs]
                        change: [-0.4254% -0.2538% -0.0547%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) high mild
  3 (3.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.9s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [1.1731 ms 1.1738 ms 1.1746 ms]
                        change: [+0.3589% +0.5605% +0.7873%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low mild
  5 (5.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [2.3819 ms 2.3832 ms 2.3845 ms]
                        change: [+0.0355% +0.1016% +0.1663%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [341.53 µs 341.68 µs 341.85 µs]
                        change: [-0.4361% -0.2031% +0.0398%] (p = 0.08 > 0.05)
                        No change in performance detected.
Found 9 outliers among 100 measurements (9.00%)
  2 (2.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0
                        time:   [444.97 µs 445.12 µs 445.30 µs]
                        change: [-0.3776% -0.2148% -0.0460%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  2 (2.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [728.94 µs 729.23 µs 729.58 µs]
                        change: [+0.2335% +0.4019% +0.5791%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 14 outliers among 100 measurements (14.00%)
  1 (1.00%) low mild
  8 (8.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [966.21 µs 967.02 µs 968.03 µs]
                        change: [+0.2251% +0.3997% +0.6015%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [485.63 µs 485.86 µs 486.11 µs]
                        change: [+0.0990% +0.2832% +0.4909%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [565.86 µs 566.24 µs 566.70 µs]
                        change: [+0.1038% +0.2811% +0.4814%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 14 outliers among 100 measurements (14.00%)
  5 (5.00%) high mild
  9 (9.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.2s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [1.0237 ms 1.0243 ms 1.0250 ms]
                        change: [+0.3817% +0.6095% +0.8366%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  4 (4.00%) high mild
  8 (8.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.2s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [1.6139 ms 1.6145 ms 1.6151 ms]
                        change: [-0.3413% -0.1799% -0.0094%] (p = 0.03 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [485.50 µs 485.75 µs 486.07 µs]
                        change: [+0.0362% +0.2597% +0.4990%] (p = 0.02 < 0.05)
                        Change within noise threshold.
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [564.83 µs 565.13 µs 565.49 µs]
                        change: [-0.2292% -0.0443% +0.1429%] (p = 0.68 > 0.05)
                        No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
  5 (5.00%) high mild
  8 (8.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.7s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [1.5206 ms 1.5214 ms 1.5223 ms]
                        change: [+0.1219% +0.2845% +0.4382%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [2.7355 ms 2.7372 ms 2.7392 ms]
                        change: [+0.1862% +0.2633% +0.3492%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 16 outliers among 100 measurements (16.00%)
  6 (6.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [485.64 µs 485.87 µs 486.12 µs]
                        change: [-0.1317% +0.0342% +0.1974%] (p = 0.72 > 0.05)
                        No change in performance detected.
Found 17 outliers among 100 measurements (17.00%)
  10 (10.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1
                        time:   [564.95 µs 565.22 µs 565.52 µs]
                        change: [-0.2459% -0.0804% +0.1093%] (p = 0.42 > 0.05)
                        No change in performance detected.
Found 11 outliers among 100 measurements (11.00%)
  5 (5.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [613.55 µs 613.90 µs 614.30 µs]
                        change: [-0.1978% +0.0206% +0.2512%] (p = 0.88 > 0.05)
                        No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
  2 (2.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [804.94 µs 805.27 µs 805.64 µs]
                        change: [-0.3371% -0.2017% -0.0566%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  6 (6.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [451.36 µs 451.55 µs 451.75 µs]
                        change: [-0.1076% +0.0692% +0.2464%] (p = 0.48 > 0.05)
                        No change in performance detected.
Found 10 outliers among 100 measurements (10.00%)
  6 (6.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [516.12 µs 516.36 µs 516.64 µs]
                        change: [-0.2179% +0.0030% +0.2181%] (p = 0.96 > 0.05)
                        No change in performance detected.
Found 15 outliers among 100 measurements (15.00%)
  5 (5.00%) high mild
  10 (10.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [831.48 µs 831.89 µs 832.37 µs]
                        change: [+0.2730% +0.4416% +0.6047%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.6s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [1.2999 ms 1.3006 ms 1.3014 ms]
                        change: [+0.1551% +0.3508% +0.5933%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  7 (7.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [451.54 µs 451.76 µs 452.00 µs]
                        change: [-0.0486% +0.1303% +0.3100%] (p = 0.17 > 0.05)
                        No change in performance detected.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [516.47 µs 516.73 µs 517.04 µs]
                        change: [-0.2732% -0.0578% +0.1455%] (p = 0.66 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  4 (4.00%) high mild
  10 (10.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.2s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [1.2276 ms 1.2283 ms 1.2290 ms]
                        change: [+0.3032% +0.4998% +0.6974%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [2.1643 ms 2.1656 ms 2.1671 ms]
                        change: [-0.2215% -0.1512% -0.0757%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 16 outliers among 100 measurements (16.00%)
  7 (7.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [451.48 µs 451.71 µs 451.96 µs]
                        change: [-0.4533% -0.2697% -0.0701%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  7 (7.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5
                        time:   [516.17 µs 516.42 µs 516.71 µs]
                        change: [-0.3951% -0.1759% +0.0285%] (p = 0.10 > 0.05)
                        No change in performance detected.
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [581.53 µs 581.85 µs 582.22 µs]
                        change: [-0.4681% -0.2375% +0.0205%] (p = 0.03 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  6 (6.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [806.04 µs 806.40 µs 806.83 µs]
                        change: [-0.3328% -0.1863% -0.0288%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [341.42 µs 341.59 µs 341.78 µs]
                        change: [-0.5843% -0.3707% -0.1573%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 11 outliers among 100 measurements (11.00%)
  6 (6.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [445.02 µs 445.20 µs 445.42 µs]
                        change: [-0.3079% -0.1435% +0.0361%] (p = 0.10 > 0.05)
                        No change in performance detected.
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [804.03 µs 804.52 µs 805.10 µs]
                        change: [+0.0833% +0.2480% +0.4237%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.1s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [1.3958 ms 1.3964 ms 1.3970 ms]
                        change: [-0.3882% -0.2616% -0.1751%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [341.66 µs 341.85 µs 342.06 µs]
                        change: [-0.5154% -0.3585% -0.2438%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [445.08 µs 445.29 µs 445.53 µs]
                        change: [-0.1558% +0.0148% +0.1858%] (p = 0.88 > 0.05)
                        No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
  7 (7.00%) high mild
  6 (6.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.9s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [1.1700 ms 1.1709 ms 1.1719 ms]
                        change: [+0.0124% +0.2123% +0.4009%] (p = 0.02 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [2.3757 ms 2.3775 ms 2.3800 ms]
                        change: [+0.0656% +0.1579% +0.2573%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  6 (6.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [341.47 µs 341.77 µs 342.10 µs]
                        change: [-0.2178% +0.0125% +0.2362%] (p = 0.92 > 0.05)
                        No change in performance detected.
Found 10 outliers among 100 measurements (10.00%)
  5 (5.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0
                        time:   [445.57 µs 445.82 µs 446.09 µs]
                        change: [-0.0565% +0.1035% +0.2671%] (p = 0.23 > 0.05)
                        No change in performance detected.
Found 9 outliers among 100 measurements (9.00%)
  5 (5.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [728.22 µs 728.56 µs 728.96 µs]
                        change: [-0.3534% -0.1796% +0.0062%] (p = 0.03 < 0.05)
                        Change within noise threshold.
Found 13 outliers among 100 measurements (13.00%)
  4 (4.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [965.27 µs 965.67 µs 966.17 µs]
                        change: [-0.2803% -0.1597% -0.0369%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  5 (5.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [485.15 µs 485.40 µs 485.69 µs]
                        change: [-0.1787% +0.0020% +0.1849%] (p = 0.98 > 0.05)
                        No change in performance detected.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [566.91 µs 567.13 µs 567.37 µs]
                        change: [-0.1075% +0.0721% +0.2537%] (p = 0.47 > 0.05)
                        No change in performance detected.
Found 11 outliers among 100 measurements (11.00%)
  3 (3.00%) high mild
  8 (8.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.2s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [1.0272 ms 1.0278 ms 1.0286 ms]
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.2s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [1.6216 ms 1.6224 ms 1.6232 ms]
Found 8 outliers among 100 measurements (8.00%)
  2 (2.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [485.95 µs 486.18 µs 486.46 µs]
Found 13 outliers among 100 measurements (13.00%)
  5 (5.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [566.82 µs 567.07 µs 567.34 µs]
Found 15 outliers among 100 measurements (15.00%)
  7 (7.00%) high mild
  8 (8.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.7s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [1.5252 ms 1.5263 ms 1.5276 ms]
Found 10 outliers among 100 measurements (10.00%)
  7 (7.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [2.7479 ms 2.7492 ms 2.7507 ms]
Found 15 outliers among 100 measurements (15.00%)
  8 (8.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [485.18 µs 485.54 µs 486.05 µs]
Found 13 outliers among 100 measurements (13.00%)
  4 (4.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1
                        time:   [566.81 µs 567.09 µs 567.43 µs]
Found 15 outliers among 100 measurements (15.00%)
  7 (7.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [614.34 µs 614.75 µs 615.29 µs]
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [808.13 µs 808.56 µs 809.05 µs]
Found 11 outliers among 100 measurements (11.00%)
  7 (7.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [452.21 µs 452.46 µs 452.79 µs]
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [518.11 µs 518.36 µs 518.62 µs]
Found 13 outliers among 100 measurements (13.00%)
  7 (7.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [834.45 µs 834.88 µs 835.36 µs]
Found 9 outliers among 100 measurements (9.00%)
  6 (6.00%) high mild
  3 (3.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.6s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [1.3037 ms 1.3045 ms 1.3053 ms]
Found 8 outliers among 100 measurements (8.00%)
  7 (7.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [451.25 µs 451.57 µs 451.99 µs]
Found 11 outliers among 100 measurements (11.00%)
  5 (5.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [517.62 µs 517.86 µs 518.12 µs]
Found 11 outliers among 100 measurements (11.00%)
  5 (5.00%) high mild
  6 (6.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.2s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [1.2297 ms 1.2310 ms 1.2328 ms]
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [2.1666 ms 2.1676 ms 2.1686 ms]
Found 8 outliers among 100 measurements (8.00%)
  7 (7.00%) high mild
  1 (1.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [452.46 µs 452.66 µs 452.88 µs]
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5
                        time:   [517.20 µs 517.44 µs 517.72 µs]
Found 17 outliers among 100 measurements (17.00%)
  6 (6.00%) high mild
  11 (11.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [582.53 µs 583.31 µs 584.58 µs]
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [807.24 µs 807.65 µs 808.09 µs]
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [341.89 µs 342.06 µs 342.25 µs]
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [445.32 µs 445.54 µs 445.80 µs]
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [804.09 µs 804.53 µs 805.00 µs]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.1s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [1.3968 ms 1.3975 ms 1.3983 ms]
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [341.27 µs 341.43 µs 341.60 µs]
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [445.54 µs 445.86 µs 446.24 µs]
Found 14 outliers among 100 measurements (14.00%)
  6 (6.00%) high mild
  8 (8.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.9s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [1.1703 ms 1.1710 ms 1.1717 ms]
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [2.3708 ms 2.3724 ms 2.3743 ms]
Found 11 outliers among 100 measurements (11.00%)
  8 (8.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [341.94 µs 342.15 µs 342.41 µs]
Found 9 outliers among 100 measurements (9.00%)
  5 (5.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0
                        time:   [445.15 µs 445.42 µs 445.74 µs]
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [729.65 µs 729.94 µs 730.26 µs]
Found 11 outliers among 100 measurements (11.00%)
  6 (6.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [966.46 µs 966.97 µs 967.58 µs]
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [486.14 µs 486.36 µs 486.61 µs]
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [566.81 µs 567.07 µs 567.34 µs]
Found 13 outliers among 100 measurements (13.00%)
  6 (6.00%) high mild
  7 (7.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.2s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [1.0273 ms 1.0278 ms 1.0283 ms]
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.2s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [1.6239 ms 1.6248 ms 1.6258 ms]
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [485.73 µs 486.04 µs 486.43 µs]
Found 14 outliers among 100 measurements (14.00%)
  6 (6.00%) high mild
  8 (8.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [567.22 µs 567.54 µs 567.93 µs]
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.7s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [1.5275 ms 1.5282 ms 1.5290 ms]
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [2.7513 ms 2.7532 ms 2.7553 ms]
Found 10 outliers among 100 measurements (10.00%)
  4 (4.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [486.38 µs 486.58 µs 486.78 µs]
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1
                        time:   [566.15 µs 566.42 µs 566.75 µs]
Found 13 outliers among 100 measurements (13.00%)
  7 (7.00%) high mild
  6 (6.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [582.47 µs 582.74 µs 583.04 µs]
Found 14 outliers among 100 measurements (14.00%)
  9 (9.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [807.70 µs 808.17 µs 808.74 µs]
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) high mild
  9 (9.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [341.62 µs 341.80 µs 342.03 µs]
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [445.48 µs 445.87 µs 446.40 µs]
Found 13 outliers among 100 measurements (13.00%)
  6 (6.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [804.56 µs 805.03 µs 805.52 µs]
Found 6 outliers among 100 measurements (6.00%)
  5 (5.00%) high mild
  1 (1.00%) high severe
Benchmarking lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 7.1s, enable flat sampling, or reduce sample count to 50.
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [1.3995 ms 1.4004 ms 1.4015 ms]
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [341.46 µs 341.64 µs 341.85 µs]
Found 9 outliers among 100 measurements (9.00%)
  6 (6.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [445.91 µs 446.16 µs 446.47 µs]
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) high mild
  6 (6.00%) high severe
Benchmarking lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.9s, enable flat sampling, or reduce sample count to 60.
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [1.1708 ms 1.1716 ms 1.1725 ms]
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) high mild
  3 (3.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [2.3735 ms 2.3748 ms 2.3763 ms]
Found 12 outliers among 100 measurements (12.00%)
  5 (5.00%) high mild
  7 (7.00%) high severe
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [342.14 µs 342.31 µs 342.53 µs]
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) high mild
  5 (5.00%) high severe
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0
                        time:   [444.92 µs 445.09 µs 445.29 µs]
Found 15 outliers among 100 measurements (15.00%)
  6 (6.00%) high mild
  9 (9.00%) high severe
```

</details>
@pepijnve
Copy link
Contributor

pepijnve commented Dec 3, 2025

Implementation lgtm. The test failure looks like a transient network issue. Clippy lint still needs fixing.

@rluvaton
Copy link
Member Author

rluvaton commented Dec 3, 2025

@alamb since it looks like @pepijnve has no more comments and you delegate the review to him and you have write access, can you please approve

@alamb can you please approve?

paste = { workspace = true }
petgraph = "0.8.3"
tokio = { workspace = true }
half = { workspace = true }
Copy link
Contributor

@pepijnve pepijnve Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, but it looks like these should be kept in alphabetical order.

@alamb
Copy link
Contributor

alamb commented Dec 4, 2025

I will check this one out shortly

@alamb

This comment was marked as outdated.

@alamb-ghbot

This comment was marked as outdated.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started looking at this code -- it looks like quite a cool idea

@alamb-ghbot

This comment was marked as outdated.

@alamb
Copy link
Contributor

alamb commented Dec 4, 2025

run benchmark case_when

@alamb-ghbot
Copy link

🤖 ./gh_compare_branch_bench.sh Benchmark Script Running
Linux aal-dev 6.14.0-1018-gcp #19~24.04.1-Ubuntu SMP Wed Sep 24 23:23:09 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing improve-performance-for-literal-mapping (537642b) to 7b4593f diff
BENCH_NAME=case_when
BENCH_COMMAND=cargo bench --bench case_when
BENCH_FILTER=
BENCH_BRANCH_NAME=improve-performance-for-literal-mapping
Results will be posted here when complete

@alamb-ghbot
Copy link

🤖: Benchmark completed

Details

group                                                                                                                             improve-performance-for-literal-mapping    main
-----                                                                                                                             ---------------------------------------    ----
case_when 8192x100: CASE WHEN c1 < 0 THEN 0 WHEN c1 < 1000 THEN 1 ... WHEN c1 < n * 1000 THEN n ELSE n + 1 END                    1.00    125.0±1.43µs        ? ?/sec        1.00    124.4±1.37µs        ? ?/sec
case_when 8192x100: CASE WHEN c1 <= 500 THEN 1 ELSE 0 END                                                                         1.01     14.8±0.28µs        ? ?/sec        1.00     14.7±0.10µs        ? ?/sec
case_when 8192x100: CASE WHEN c1 <= 500 THEN c2 ELSE c3 END                                                                       1.00     17.6±0.35µs        ? ?/sec        1.01     17.7±0.40µs        ? ?/sec
case_when 8192x100: CASE WHEN c1 <= 500 THEN c2 [ELSE NULL] END                                                                   1.00      6.5±0.03µs        ? ?/sec        1.02      6.7±0.12µs        ? ?/sec
case_when 8192x100: CASE WHEN c1 == 0 THEN 0 WHEN c1 == 1 THEN 1 ... WHEN c1 == n THEN n ELSE n + 1 END                           1.00     48.0±0.57ms        ? ?/sec        1.00     47.9±0.38ms        ? ?/sec
case_when 8192x100: CASE c1 WHEN 0 THEN 0 WHEN 1 THEN 1 ... WHEN n THEN n ELSE n + 1 END                                          1.00     66.6±0.25µs        ? ?/sec        794.98    53.0±0.77ms        ? ?/sec
case_when 8192x100: CASE c1 WHEN 1 THEN c2 WHEN 2 THEN c3 END                                                                     1.04     30.0±0.55µs        ? ?/sec        1.00     28.9±0.66µs        ? ?/sec
case_when 8192x100: CASE c2 WHEN 0 THEN 0 WHEN 1000 THEN 1 ... WHEN n * 1000 THEN n ELSE n + 1 END                                1.00     61.0±0.83µs        ? ?/sec        1.80    109.6±2.79µs        ? ?/sec
case_when 8192x3: CASE WHEN c1 < 0 THEN 0 WHEN c1 < 1000 THEN 1 ... WHEN c1 < n * 1000 THEN n ELSE n + 1 END                      1.01    124.8±1.62µs        ? ?/sec        1.00    124.2±5.28µs        ? ?/sec
case_when 8192x3: CASE WHEN c1 <= 500 THEN 1 ELSE 0 END                                                                           1.00     14.7±0.21µs        ? ?/sec        1.00     14.7±0.06µs        ? ?/sec
case_when 8192x3: CASE WHEN c1 <= 500 THEN c2 ELSE c3 END                                                                         1.03     17.5±0.33µs        ? ?/sec        1.00     17.0±0.33µs        ? ?/sec
case_when 8192x3: CASE WHEN c1 <= 500 THEN c2 [ELSE NULL] END                                                                     1.00      6.6±0.07µs        ? ?/sec        1.00      6.6±0.06µs        ? ?/sec
case_when 8192x3: CASE WHEN c1 == 0 THEN 0 WHEN c1 == 1 THEN 1 ... WHEN c1 == n THEN n ELSE n + 1 END                             1.00     47.9±0.63ms        ? ?/sec        1.00     48.0±1.18ms        ? ?/sec
case_when 8192x3: CASE c1 WHEN 0 THEN 0 WHEN 1 THEN 1 ... WHEN n THEN n ELSE n + 1 END                                            1.00     67.0±0.80µs        ? ?/sec        790.23    53.0±1.73ms        ? ?/sec
case_when 8192x3: CASE c1 WHEN 1 THEN c2 WHEN 2 THEN c3 END                                                                       1.03     29.6±0.57µs        ? ?/sec        1.00     28.6±0.58µs        ? ?/sec
case_when 8192x3: CASE c2 WHEN 0 THEN 0 WHEN 1000 THEN 1 ... WHEN n * 1000 THEN n ELSE n + 1 END                                  1.00     60.9±0.85µs        ? ?/sec        1.78    108.6±1.04µs        ? ?/sec
case_when 8192x50: CASE WHEN c1 < 0 THEN 0 WHEN c1 < 1000 THEN 1 ... WHEN c1 < n * 1000 THEN n ELSE n + 1 END                     1.00    124.4±1.29µs        ? ?/sec        1.00    124.7±1.59µs        ? ?/sec
case_when 8192x50: CASE WHEN c1 <= 500 THEN 1 ELSE 0 END                                                                          1.01     15.0±1.09µs        ? ?/sec        1.00     14.9±0.08µs        ? ?/sec
case_when 8192x50: CASE WHEN c1 <= 500 THEN c2 ELSE c3 END                                                                        1.01     17.5±0.45µs        ? ?/sec        1.00     17.3±0.20µs        ? ?/sec
case_when 8192x50: CASE WHEN c1 <= 500 THEN c2 [ELSE NULL] END                                                                    1.00      6.6±0.01µs        ? ?/sec        1.02      6.7±0.04µs        ? ?/sec
case_when 8192x50: CASE WHEN c1 == 0 THEN 0 WHEN c1 == 1 THEN 1 ... WHEN c1 == n THEN n ELSE n + 1 END                            1.00     47.6±0.37ms        ? ?/sec        1.01     48.1±1.09ms        ? ?/sec
case_when 8192x50: CASE c1 WHEN 0 THEN 0 WHEN 1 THEN 1 ... WHEN n THEN n ELSE n + 1 END                                           1.00     67.1±0.45µs        ? ?/sec        787.97    52.9±0.57ms        ? ?/sec
case_when 8192x50: CASE c1 WHEN 1 THEN c2 WHEN 2 THEN c3 END                                                                      1.02     29.1±0.26µs        ? ?/sec        1.00     28.6±0.51µs        ? ?/sec
case_when 8192x50: CASE c2 WHEN 0 THEN 0 WHEN 1000 THEN 1 ... WHEN n * 1000 THEN n ELSE n + 1 END                                 1.00     61.4±1.05µs        ? ?/sec        1.77    108.7±2.11µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0           1.00    131.0±1.23µs        ? ?/sec        3.12    408.8±3.30µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1         1.00    142.5±8.64µs        ? ?/sec        3.28    468.1±4.02µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5         1.00    143.7±1.33µs        ? ?/sec        2.38    342.0±5.83µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0           1.00    132.6±5.83µs        ? ?/sec        3.11    412.3±2.62µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1         1.00   142.4±11.06µs        ? ?/sec        3.30    470.0±6.99µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5         1.00    143.2±1.13µs        ? ?/sec        2.39    342.1±3.36µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0           1.00    132.0±6.23µs        ? ?/sec        3.12    412.5±3.87µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1         1.00    141.4±2.80µs        ? ?/sec        3.31    468.1±3.72µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0             1.00    132.3±4.64µs        ? ?/sec        3.11    411.0±5.30µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0      1.00    124.6±2.37µs        ? ?/sec        1.35    168.7±0.56µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1    1.00    129.7±2.19µs        ? ?/sec        1.88    243.8±3.77µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5    1.00    129.8±2.76µs        ? ?/sec        1.67    216.9±2.01µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0      1.00    122.9±1.60µs        ? ?/sec        1.38    169.5±3.08µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1    1.00    130.6±2.85µs        ? ?/sec        1.87    243.5±1.87µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5    1.00    129.4±1.52µs        ? ?/sec        1.67    216.6±1.95µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0      1.00    124.3±3.45µs        ? ?/sec        1.36    169.0±2.22µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1    1.00    130.7±4.38µs        ? ?/sec        1.88   246.2±14.66µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0        1.00    124.7±3.73µs        ? ?/sec        1.36    169.0±3.36µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0           1.00    131.2±3.62µs        ? ?/sec        4.24    556.7±5.11µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1         1.00    140.7±1.03µs        ? ?/sec        4.29    602.9±3.12µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5         1.00    153.6±1.92µs        ? ?/sec        2.76    424.4±4.36µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0           1.00    131.1±2.86µs        ? ?/sec        4.25    557.2±6.48µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1         1.00    141.3±1.92µs        ? ?/sec        4.27    603.7±3.51µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5         1.00    153.4±1.69µs        ? ?/sec        2.77    424.5±7.36µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0           1.00    130.8±1.10µs        ? ?/sec        4.25    556.2±6.78µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1         1.00    141.0±1.83µs        ? ?/sec        4.26    600.9±4.00µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0             1.00    130.8±1.50µs        ? ?/sec        4.23    553.7±2.72µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0      1.00    124.6±4.11µs        ? ?/sec        1.36    169.5±3.17µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1    1.00    130.5±2.87µs        ? ?/sec        1.86    243.2±1.15µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5    1.00    130.7±5.59µs        ? ?/sec        1.66    216.6±2.29µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0      1.00    123.7±2.67µs        ? ?/sec        1.36    168.6±1.16µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1    1.00    129.9±2.37µs        ? ?/sec        1.87    242.9±1.78µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5    1.00    129.7±1.50µs        ? ?/sec        1.67    216.4±1.07µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0      1.00    124.7±3.65µs        ? ?/sec        1.35    168.8±1.27µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1    1.00    130.9±2.74µs        ? ?/sec        1.86    244.1±5.79µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0        1.00    124.4±4.21µs        ? ?/sec        1.36    169.2±2.51µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0            1.00    131.6±2.18µs        ? ?/sec        2.23    293.6±3.32µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1          1.00    142.7±4.98µs        ? ?/sec        2.50    356.3±5.29µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5          1.00    137.1±2.15µs        ? ?/sec        1.99    272.4±3.38µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0            1.00    131.4±1.02µs        ? ?/sec        2.23    292.8±2.38µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1          1.00    139.3±1.77µs        ? ?/sec        2.56    356.0±1.84µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5          1.00    136.8±1.76µs        ? ?/sec        2.00    273.8±8.96µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0            1.00    131.3±1.23µs        ? ?/sec        2.24    293.6±4.73µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1          1.00    139.0±0.99µs        ? ?/sec        2.56    355.7±4.15µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0              1.00    131.1±1.01µs        ? ?/sec        2.24    293.4±3.81µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0       1.00    124.7±3.28µs        ? ?/sec        1.35    168.8±1.24µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1     1.00    130.4±2.94µs        ? ?/sec        1.87    243.6±2.63µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5     1.00    129.5±1.45µs        ? ?/sec        1.67    216.6±1.72µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0       1.00    124.4±3.34µs        ? ?/sec        1.36    168.8±1.38µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1     1.00    130.3±2.67µs        ? ?/sec        1.86    242.6±1.48µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5     1.00    129.3±1.38µs        ? ?/sec        1.67    216.2±0.65µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0       1.00    125.5±6.83µs        ? ?/sec        1.35    168.8±0.90µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1     1.00    130.3±2.49µs        ? ?/sec        1.88    245.0±9.11µs        ? ?/sec
lookup_table_case_when/case when i32 -> utf8, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0         1.00    124.5±3.38µs        ? ?/sec        1.36    168.7±0.80µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0           1.00    163.7±4.41µs        ? ?/sec        5.25    859.9±9.74µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1         1.00    168.3±2.90µs        ? ?/sec        5.46   919.1±11.05µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5         1.00    151.8±2.95µs        ? ?/sec        4.16    631.3±8.73µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0           1.00    168.7±4.09µs        ? ?/sec        5.09    858.5±4.29µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1         1.00    170.4±2.41µs        ? ?/sec        5.38    916.4±6.35µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5         1.00    150.5±1.42µs        ? ?/sec        4.19   630.4±14.12µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0           1.00    161.7±1.80µs        ? ?/sec        5.31    858.9±7.17µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1         1.00    168.4±2.69µs        ? ?/sec        5.45    917.9±4.94µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0             1.00    161.7±1.17µs        ? ?/sec        5.31    858.0±4.18µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0      1.00    152.1±1.11µs        ? ?/sec        1.52    231.0±1.74µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1    1.00    159.4±0.95µs        ? ?/sec        2.15    342.8±7.83µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5    1.00    146.1±1.05µs        ? ?/sec        2.09    305.6±2.35µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0      1.00    152.4±1.27µs        ? ?/sec        1.51    230.7±1.20µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1    1.00    159.9±2.43µs        ? ?/sec        2.15   344.3±14.72µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5    1.00    146.3±1.43µs        ? ?/sec        2.09    305.8±2.56µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0      1.00    152.6±2.82µs        ? ?/sec        1.52    232.0±4.93µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1    1.00    160.5±2.10µs        ? ?/sec        2.14    343.6±6.20µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 10 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0        1.00    161.9±3.86µs        ? ?/sec        1.43    231.1±1.43µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0           1.00    168.6±7.59µs        ? ?/sec        7.31  1232.9±10.27µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1         1.00    164.2±2.11µs        ? ?/sec        7.49   1230.2±6.80µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5         1.00    147.8±1.57µs        ? ?/sec        5.63    832.3±7.13µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0           1.00    161.8±3.23µs        ? ?/sec        7.60  1230.1±13.80µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1         1.00    164.3±1.45µs        ? ?/sec        7.46  1225.4±10.88µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5         1.00    148.3±1.32µs        ? ?/sec        5.61    832.0±9.57µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0           1.00    161.6±3.51µs        ? ?/sec        7.61   1229.5±9.72µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1         1.00    163.9±1.23µs        ? ?/sec        7.49  1228.3±27.16µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0             1.00    161.3±1.94µs        ? ?/sec        7.62   1228.9±7.85µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0      1.00    152.8±1.58µs        ? ?/sec        1.51    231.1±2.62µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1    1.00    160.3±2.04µs        ? ?/sec        2.13    341.7±2.60µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5    1.00    148.4±4.54µs        ? ?/sec        2.06    305.4±1.92µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0      1.00    153.1±5.55µs        ? ?/sec        1.51    230.9±2.61µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1    1.00    161.3±2.39µs        ? ?/sec        2.11    341.2±2.17µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5    1.00    155.7±2.96µs        ? ?/sec        1.97    306.3±3.07µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0      1.00    152.4±1.45µs        ? ?/sec        1.51    230.6±1.05µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1    1.00    161.0±4.86µs        ? ?/sec        2.13    342.5±4.39µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 20 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0        1.00    153.1±1.82µs        ? ?/sec        1.51    230.8±2.47µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0            1.00    162.0±1.17µs        ? ?/sec        3.42    553.7±7.82µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.1          1.00    168.0±2.06µs        ? ?/sec        3.77    634.3±6.69µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.1, nulls: 0.5          1.00    151.7±1.40µs        ? ?/sec        3.17    481.6±6.50µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0            1.00    163.3±1.81µs        ? ?/sec        3.38    551.7±4.27µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.1          1.00    168.6±1.84µs        ? ?/sec        3.76   634.9±11.66µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.5, nulls: 0.5          1.00    151.4±1.85µs        ? ?/sec        3.17    480.5±5.66µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0            1.00    162.7±0.79µs        ? ?/sec        3.40    553.4±6.10µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 0.9, nulls: 0.1          1.00    168.2±1.67µs        ? ?/sec        3.77    634.5±6.40µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, all equally true/case_when 8192 rows: in_range: 1, nulls: 0              1.00    163.1±1.89µs        ? ?/sec        3.39    553.0±6.68µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0       1.00    153.7±2.41µs        ? ?/sec        1.50    230.9±1.25µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.1     1.00    161.1±8.72µs        ? ?/sec        2.12    342.2±6.59µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.1, nulls: 0.5     1.00    146.9±1.42µs        ? ?/sec        2.08    305.6±2.63µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0       1.00    152.7±1.38µs        ? ?/sec        1.51    230.9±3.18µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.1     1.00    159.2±1.51µs        ? ?/sec        2.15    342.5±8.50µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.5, nulls: 0.5     1.00    146.1±1.00µs        ? ?/sec        2.10    306.3±4.54µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0       1.00    152.0±0.90µs        ? ?/sec        1.52    231.4±3.82µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 0.9, nulls: 0.1     1.00    158.5±0.72µs        ? ?/sec        2.15    341.4±1.86µs        ? ?/sec
lookup_table_case_when/case when utf8 -> i32, 5 entries, only first 2 are true/case_when 8192 rows: in_range: 1, nulls: 0         1.00    152.7±1.43µs        ? ?/sec        1.51    231.2±1.82µs        ? ?/sec

@rluvaton
Copy link
Member Author

rluvaton commented Dec 5, 2025

I didn't know you can use specific rust test in run benchmark!
Great!

And I LOVE the new bot logo

@pepijnve
Copy link
Contributor

pepijnve commented Dec 5, 2025

Looking at the benchmark results, a nice extension/followup to this work might be to pattern match

CASE
    WHEN <expr> == <literal> THEN <literal>
    WHEN <expr> == <literal> THEN <literal>
    ....
    WHEN <expr> == <literal> THEN <literal>
    ELSE <literal>
END

and transform it to CASE <expr> WHEN <literal> THEN <literal> ... so that the two become identical

case_when 8192x50: CASE WHEN c1 == 0 THEN 0 WHEN c1 == 1 THEN 1 ... WHEN c1 == n THEN n ELSE n + 1 END                            1.00     47.6±0.37ms        ? ?/sec        1.01     48.1±1.09ms
case_when 8192x50: CASE c1 WHEN 0 THEN 0 WHEN 1 THEN 1 ... WHEN n THEN n ELSE n + 1 END                                           1.00     67.1±0.45µs        ? ?/sec        787.97    52.9±0.57ms

A similar further followup I'm considering is applying the same "compile lookup data structure" technique for patterns like

CASE
    WHEN <expr> < <literal1> THEN <literal>
    WHEN <expr> < <literal2> THEN <literal>
    ....
    WHEN <expr> < <literaln> THEN <literal>
    ELSE <literal>
END

assuming <literal1> < <literal2> < ... < <literaln> which could be quite beneficial for histograms.

@rluvaton
Copy link
Member Author

rluvaton commented Dec 5, 2025

Looking at the benchmark results, a nice extension/followup to this work might be to pattern match

CASE
    WHEN <expr> == <literal> THEN <literal>
    WHEN <expr> == <literal> THEN <literal>
    ....
    WHEN <expr> == <literal> THEN <literal>
    ELSE <literal>
END

and transform it to CASE <expr> WHEN <literal> THEN <literal> ... so that the two become identical

I already have impl for that.

Note that you need to make sure the when expr is deterministic to avoid changing behavior.

@pepijnve
Copy link
Contributor

pepijnve commented Dec 5, 2025

I already have impl for that.

Nice! I'll hold off working on the the comparison variant until that lands then since the pattern matching will be highly similar.

@alamb
Copy link
Contributor

alamb commented Dec 5, 2025

I didn't know you can use specific rust test in run benchmark! Great!

And I LOVE the new bot logo

Thank you . I am quite pleased with that myself 😁

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @rluvaton and @pepijnve -- I found this code really well written, easy to understand, and easy to navigate

There are several places where I think we should not be ignoring errors (.ok()?) as I think that will make it hard to understand / debug failures in the future

I have some other small suggestions but nothing I think that is required to merge

I also did some code coverage runs

cargo llvm-cov test --html  --test sqllogictests
cargo llvm-cov test --html --all-features -p datafusion-physical-expr

And I think there isn't good coverage for CASE with WHEN values of strings / boolean values. I'll make a PR to add some more of that.

Thank you again -- this is really cool

{
// Since it is not common to have dictionary encoded boolean arrays
// at all than it is ok to do the cast here to simplify the implementation.
let converted = arrow::compute::cast(array.as_ref(), &DataType::Boolean)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could make this code simpler by always calling cast to boolean (which is a noop for an already BooleanArray).

However, this structure will have more specific errors, so I don't think any changes are required

}
}

fn try_get_bytes_iterator(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend pulling this into a utility / other type method -- it might be helpful when implementing other string-like functions

Perhaps datafusion/physical-expr/src/utils/bytes_iter.rs or something

) -> datafusion_common::Result<Box<dyn Iterator<Item = Option<&[u8]>> + '_>> {
Ok(match array.values().data_type() {
DataType::Utf8 => Box::new(
array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit is that method is inconsistent with the branch for Utf8 above which uses as_string::<i32>()

I recommend having this code follow the same pattern as above as it is less verbose

        DataType::Utf8 => Box::new(array.as_string::<i32>().into_iter().map(|item| {

This comment applies to the other types here too

/// ```
///
/// # Improvement idea
/// TODO - we should think of unwrapping the `IN` expressions into multiple equality comparisons
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend filing a ticket to track this idea (and leave a link here), otherwise this TODO may never be found

{
let when_data_type = when[0].data_type();

// If not all the WHEN literals are the same data type we cannot use this optimization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the time we get here I would expect that all when literals are the same type (so I would expect this code not to be called)

.chain(std::iter::once(&else_value))
.cloned(),
)
.ok()?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why (silently) ignore any errors? (I don't expect that this would ever fail given the checks above, but it might help debugging to explicitly return an internal error or something in this case

Silently ignoring the error (via .ok()) seems like it could mask errors that are preventing this optimization from actually happening. Also, we had some problems in the past with performance when using ok() because each DataFusionError requires a string allocation, so creating one and ignoring it causes non trivial overhead.

Since this code is called once per expression, I suspect it isn't a big performance problem, but I do think the masking of errors is concerning

// Zero-copy conversion
let take_indices = UInt32Array::from(take_indices);

// An optimize version would depend on the type of the values_to_take_from
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the take kernel already implements the optimization this comment is referring to (this is one of the benefits of re-using the arrow kernels). Thus I think this comment no longer applies

DataType::Dictionary(_, value_type)
if value_type.as_ref() == &self.data_type =>
{
// Cast here to simplify the implementation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above, you can probably reduce the size of this code by always calling cast

/// not implementing actual [`PartialEq`] as it is not dyn compatible so we cannot implement it for
/// `dyn` [`literal_lookup_table::WhenLiteralIndexMap`].
///
/// So we always return true as the data is derived from `PhysicalExpr` s which are already compared
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is ok to return true here but don't quite follow this argument (aka I recommend updating this comment and the one for hash)

It seems to me it is ok to return true here because a CaseExpr has a body and an eval method:

https://github.com/apache/datafusion/blob/0cc93a6a750ef3082e8fa94c8d8248d980e49e5f/datafusion/physical-expr/src/expressions/case.rs#L249-L254

Since the eval field is deterministically determined (only) from the body then if the body is equal, we are guaranteed that eval will also be the same and no further checks are required

@alamb
Copy link
Contributor

alamb commented Dec 7, 2025

github-merge-queue bot pushed a commit that referenced this pull request Dec 8, 2025
…#19143)

## Which issue does this PR close?

- follow on to #18183 from
@rluvaton and @pepijnve

## Rationale for this change

I want to ensure we have test coverage for constant value lookup tables
in the SLT tests



## What changes are included in this PR?

1. Add some more slt tests that use constant value lookup tables (e.g.
when the case values are all constants)

I also ran
```shell
cargo llvm-cov test --html  --test sqllogictests -- case
```

To ensure this was covering the new code

## Are these changes tested?
Only tests
## Are there any user-facing changes?
NO
@alamb
Copy link
Contributor

alamb commented Dec 8, 2025

I merged up from main to resolve a conflict

@alamb
Copy link
Contributor

alamb commented Dec 9, 2025

I think we have waited long enough for this one -- thank you @rluvaton and @pepijnve for sticking with it!

@alamb alamb added this pull request to the merge queue Dec 9, 2025
Merged via the queue into apache:main with commit d85595e Dec 9, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Make DataFusion faster physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants