-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
-- Planning tests for compressed chunk table filter pushdown with scalar array
-- operations.
\c :TEST_DBNAME :ROLE_SUPERUSER
-- helper function: float -> pseudorandom float [-0.5..0.5]
create or replace function mix(x anyelement) returns float8 as $$
    select hashfloat8(x::float8) / pow(2, 32)
$$ language sql;
-- a lower() function that is stable
create function stable_lower(x text) returns text as 'lower' language internal stable;
-- a lower() function that is volatile
create function volatile_lower(x text) returns text as 'lower' language internal volatile;
set max_parallel_workers_per_gather = 0;
create table saop(ts int, segmentby text, with_minmax text, with_bloom text);
select create_hypertable('saop', 'ts', chunk_time_interval => 50001);
 create_hypertable 
-------------------
 (1,public,saop,t)

alter table saop set (timescaledb.compress,
    timescaledb.compress_segmentby = 'segmentby',
    timescaledb.compress_orderby = 'with_minmax, ts');
insert into saop
select ts,
    ts % 23 segmentby,
    ts % 29 with_minmax,
    (mix(ts % 1483) * 1483)::int::text with_bloom
from generate_series(0, 100000) ts;
create index on saop(with_bloom);
select count(compress_chunk(x)) from show_chunks('saop') x;
 count 
-------
     2

vacuum full analyze saop;
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = any(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=8696.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=4348.00 loops=1)
         ->  Index Scan using compress_hyper_2_3_chunk_segmentby__ts_meta_min_1__ts_meta__idx on compress_hyper_2_3_chunk (actual rows=6.00 loops=1)
               Index Cond: (segmentby = ANY ('{1,10}'::text[]))
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=4348.00 loops=1)
         ->  Index Scan using compress_hyper_2_4_chunk_segmentby__ts_meta_min_1__ts_meta__idx on compress_hyper_2_4_chunk (actual rows=6.00 loops=1)
               Index Cond: (segmentby = ANY ('{1,10}'::text[]))

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where '1' = any(array[segmentby, segmentby]);
--- QUERY PLAN ---
 Append (actual rows=4348.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=2174.00 loops=1)
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=3.00 loops=1)
               Filter: ('1'::text = ANY (ARRAY[segmentby, segmentby]))
               Rows Removed by Filter: 66
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=2174.00 loops=1)
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=3.00 loops=1)
               Filter: ('1'::text = ANY (ARRAY[segmentby, segmentby]))
               Rows Removed by Filter: 66

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_minmax = any(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=6897.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=3449.00 loops=1)
         Vectorized Filter: (with_minmax = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 46552
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=3448.00 loops=1)
         Vectorized Filter: (with_minmax = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 46552
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47605
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47604
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13

set timescaledb.enable_sparse_index_bloom to off;
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 49866
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 49865
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

reset timescaledb.enable_sparse_index_bloom;
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array['1', '10']::varchar(255)[]);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47605
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47604
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom::varchar = any(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47605
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47604
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13

select * from (
    select 3 priority, 'C' "COLLATION"
    union all (select 2, collname from pg_collation where collname ilike 'en_us%' order by collencoding, collname limit 1)
    union all (select 1, collname from pg_collation where collname ilike 'en_us_utf%8%' order by collencoding, collname limit 1)
) c
order by priority limit 1 \gset
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where (with_bloom collate :"COLLATION") = any(array['1', '10']::varchar(255)[]);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Filter: ((with_bloom)::text = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 49866
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Filter: ((with_bloom)::text = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 49865
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom in ('1', '10');
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47605
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47604
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = all(array['1', '10']);
--- QUERY PLAN ---
 Result (actual rows=0.00 loops=1)
   One-Time Filter: false

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_minmax < any(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=6898.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=3450.00 loops=1)
         Filter: (with_minmax < ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 46551
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=3448.00 loops=1)
         Filter: (with_minmax < ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 46552
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_minmax < all(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=3449.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=1725.00 loops=1)
         Filter: (with_minmax < ALL ('{1,10}'::text[]))
         Rows Removed by Filter: 48276
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=1724.00 loops=1)
         Filter: (with_minmax < ALL ('{1,10}'::text[]))
         Rows Removed by Filter: 48276
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[segmentby, '10']);
--- QUERY PLAN ---
 Append (actual rows=250.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=126.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[segmentby, '10'::text]))
         Rows Removed by Filter: 46614
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=55.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, ARRAY[segmentby, '10'::text])
               Rows Removed by Filter: 14
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=124.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[segmentby, '10'::text]))
         Rows Removed by Filter: 47441
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=55.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, ARRAY[segmentby, '10'::text])
               Rows Removed by Filter: 14

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[segmentby, null]);
--- QUERY PLAN ---
 Append (actual rows=57.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=30.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[segmentby, NULL::text]))
         Rows Removed by Filter: 21492
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=24.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, ARRAY[segmentby, NULL::text])
               Rows Removed by Filter: 45
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=27.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[segmentby, NULL::text]))
         Rows Removed by Filter: 24147
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=25.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, ARRAY[segmentby, NULL::text])
               Rows Removed by Filter: 44

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[segmentby, null, with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=116.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=59.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[segmentby, NULL::text, with_minmax]))
         Rows Removed by Filter: 49942
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=57.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[segmentby, NULL::text, with_minmax]))
         Rows Removed by Filter: 49943
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[stable_lower(segmentby), stable_lower('1')]);
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=122.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=62.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[stable_lower(segmentby), stable_lower('1'::text)]))
         Rows Removed by Filter: 36982
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=42.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, ARRAY[stable_lower(segmentby), stable_lower('1'::text)])
               Rows Removed by Filter: 27
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=60.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[stable_lower(segmentby), stable_lower('1'::text)]))
         Rows Removed by Filter: 36461
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=39.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, ARRAY[stable_lower(segmentby), stable_lower('1'::text)])
               Rows Removed by Filter: 30

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[stable_lower(segmentby), stable_lower('1'), volatile_lower('10')]);
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=315.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=158.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[stable_lower(segmentby), stable_lower('1'::text), volatile_lower('10'::text)]))
         Rows Removed by Filter: 49843
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=157.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[stable_lower(segmentby), stable_lower('1'::text), volatile_lower('10'::text)]))
         Rows Removed by Filter: 49843
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[]::text[]);
--- QUERY PLAN ---
 Result (actual rows=0.00 loops=1)
   One-Time Filter: false

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(null::text[]);
--- QUERY PLAN ---
 Append (actual rows=0.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY (NULL::text[]))
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, NULL::text[])
               Rows Removed by Filter: 69
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY (NULL::text[]))
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, NULL::text[])
               Rows Removed by Filter: 69

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[null, null]);
--- QUERY PLAN ---
 Append (actual rows=0.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{NULL,NULL}'::text[]))
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{NULL,NULL}'::text[])
               Rows Removed by Filter: 69
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{NULL,NULL}'::text[]))
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{NULL,NULL}'::text[])
               Rows Removed by Filter: 69

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = any(array[with_bloom, with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=3504.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=1752.00 loops=1)
         Filter: (segmentby = ANY (ARRAY[with_bloom, with_minmax]))
         Rows Removed by Filter: 48249
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=1752.00 loops=1)
         Filter: (segmentby = ANY (ARRAY[with_bloom, with_minmax]))
         Rows Removed by Filter: 48248
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = all(array[with_bloom, with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=3.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=3.00 loops=1)
         Filter: (segmentby = ALL (ARRAY[with_bloom, with_minmax]))
         Rows Removed by Filter: 49998
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Filter: (segmentby = ALL (ARRAY[with_bloom, with_minmax]))
         Rows Removed by Filter: 50000
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

-- If the arguments of an operator can pushed down but require recheck, combining
-- them is wrong.
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where (with_bloom = '1') = (with_minmax = '1');
--- QUERY PLAN ---
 Append (actual rows=96490.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=48246.00 loops=1)
         Filter: ((with_bloom = '1'::text) = (with_minmax = '1'::text))
         Rows Removed by Filter: 1755
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=48244.00 loops=1)
         Filter: ((with_bloom = '1'::text) = (with_minmax = '1'::text))
         Rows Removed by Filter: 1756
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where (with_bloom = any(array['1', '10'])) = (with_minmax = any(array['1', '10']));
--- QUERY PLAN ---
 Append (actual rows=92870.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=46435.00 loops=1)
         Filter: ((with_bloom = ANY ('{1,10}'::text[])) = (with_minmax = ANY ('{1,10}'::text[])))
         Rows Removed by Filter: 3566
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=46435.00 loops=1)
         Filter: ((with_bloom = ANY ('{1,10}'::text[])) = (with_minmax = ANY ('{1,10}'::text[])))
         Rows Removed by Filter: 3565
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where (segmentby = '1') = (segmentby = '2');
--- QUERY PLAN ---
 Append (actual rows=91305.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=45653.00 loops=1)
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=63.00 loops=1)
               Filter: ((segmentby = '1'::text) = (segmentby = '2'::text))
               Rows Removed by Filter: 6
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=45652.00 loops=1)
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=63.00 loops=1)
               Filter: ((segmentby = '1'::text) = (segmentby = '2'::text))
               Rows Removed by Filter: 6

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where (segmentby = any(array['1', '2'])) = (segmentby = any(array['3', '4']));
--- QUERY PLAN ---
 Append (actual rows=82609.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=41305.00 loops=1)
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=57.00 loops=1)
               Filter: ((segmentby = ANY ('{1,2}'::text[])) = (segmentby = ANY ('{3,4}'::text[])))
               Rows Removed by Filter: 12
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=41304.00 loops=1)
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=57.00 loops=1)
               Filter: ((segmentby = ANY ('{1,2}'::text[])) = (segmentby = ANY ('{3,4}'::text[])))
               Rows Removed by Filter: 12

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(case when with_minmax = '1' then array['1'] else array['2'] end);
--- QUERY PLAN ---
 Append (actual rows=68.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=34.00 loops=1)
         Filter: (with_bloom = ANY (CASE WHEN (with_minmax = '1'::text) THEN '{1}'::text[] ELSE '{2}'::text[] END))
         Rows Removed by Filter: 49967
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=34.00 loops=1)
         Filter: (with_bloom = ANY (CASE WHEN (with_minmax = '1'::text) THEN '{1}'::text[] ELSE '{2}'::text[] END))
         Rows Removed by Filter: 49966
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(case when segmentby = '1' then array['1'] else array['2'] end);
--- QUERY PLAN ---
 Append (actual rows=67.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=34.00 loops=1)
         Filter: (with_bloom = ANY (CASE WHEN (segmentby = '1'::text) THEN '{1}'::text[] ELSE '{2}'::text[] END))
         Rows Removed by Filter: 26487
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=29.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, CASE WHEN (segmentby = '1'::text) THEN '{1}'::text[] ELSE '{2}'::text[] END)
               Rows Removed by Filter: 40
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=33.00 loops=1)
         Filter: (with_bloom = ANY (CASE WHEN (segmentby = '1'::text) THEN '{1}'::text[] ELSE '{2}'::text[] END))
         Rows Removed by Filter: 27315
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=29.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, CASE WHEN (segmentby = '1'::text) THEN '{1}'::text[] ELSE '{2}'::text[] END)
               Rows Removed by Filter: 40

-- Partial pushdown of AND scalar array operation.
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = all(array[with_minmax, with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=62.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=32.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY[with_minmax, with_minmax]))
         Rows Removed by Filter: 49969
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=30.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY[with_minmax, with_minmax]))
         Rows Removed by Filter: 49970
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = all(array['1', with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=3.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=2.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY['1'::text, with_minmax]))
         Rows Removed by Filter: 49999
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=1.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY['1'::text, with_minmax]))
         Rows Removed by Filter: 49999
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = '1' and with_bloom = all(array['1', with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=0.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY['1'::text, with_minmax]))
         Rows Removed by Filter: 2174
         ->  Index Scan using compress_hyper_2_3_chunk_segmentby__ts_meta_min_1__ts_meta__idx on compress_hyper_2_3_chunk (actual rows=3.00 loops=1)
               Index Cond: (segmentby = '1'::text)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY['1'::text, with_minmax]))
         Rows Removed by Filter: 2174
         ->  Index Scan using compress_hyper_2_4_chunk_segmentby__ts_meta_min_1__ts_meta__idx on compress_hyper_2_4_chunk (actual rows=3.00 loops=1)
               Index Cond: (segmentby = '1'::text)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = '1' or with_bloom = all(array['1', with_minmax]);
--- QUERY PLAN ---
 Append (actual rows=4351.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=2176.00 loops=1)
         Filter: ((segmentby = '1'::text) OR (with_bloom = ALL (ARRAY['1'::text, with_minmax])))
         Rows Removed by Filter: 47825
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=2175.00 loops=1)
         Filter: ((segmentby = '1'::text) OR (with_bloom = ALL (ARRAY['1'::text, with_minmax])))
         Rows Removed by Filter: 47825
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

-- Partial pushdown with volatile functions.
explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = any(array[stable_lower(segmentby), volatile_lower(segmentby)]);
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=57.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=30.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[stable_lower(segmentby), volatile_lower(segmentby)]))
         Rows Removed by Filter: 49971
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=27.00 loops=1)
         Filter: (with_bloom = ANY (ARRAY[stable_lower(segmentby), volatile_lower(segmentby)]))
         Rows Removed by Filter: 49973
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = stable_lower(segmentby) or with_bloom = volatile_lower(segmentby);
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=57.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=30.00 loops=1)
         Filter: ((with_bloom = stable_lower(segmentby)) OR (with_bloom = volatile_lower(segmentby)))
         Rows Removed by Filter: 49971
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=27.00 loops=1)
         Filter: ((with_bloom = stable_lower(segmentby)) OR (with_bloom = volatile_lower(segmentby)))
         Rows Removed by Filter: 49973
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where with_bloom = all(array[stable_lower(segmentby), volatile_lower(segmentby)]);
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=57.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=30.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY[stable_lower(segmentby), volatile_lower(segmentby)]))
         Rows Removed by Filter: 49971
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=27.00 loops=1)
         Filter: (with_bloom = ALL (ARRAY[stable_lower(segmentby), volatile_lower(segmentby)]))
         Rows Removed by Filter: 49973
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = '1' or with_bloom = all(array[stable_lower('1'), volatile_lower('1')]);
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=4413.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=2206.00 loops=1)
         Filter: ((segmentby = '1'::text) OR (with_bloom = ALL (ARRAY[stable_lower('1'::text), volatile_lower('1'::text)])))
         Rows Removed by Filter: 47795
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=2207.00 loops=1)
         Filter: ((segmentby = '1'::text) OR (with_bloom = ALL (ARRAY[stable_lower('1'::text), volatile_lower('1'::text)])))
         Rows Removed by Filter: 47793
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
select * from saop where segmentby = '1' or (with_bloom = stable_lower('1') and with_bloom = volatile_lower('1'));
--- QUERY PLAN ---
 Custom Scan (ChunkAppend) on saop (actual rows=4413.00 loops=1)
   Chunks excluded during startup: 0
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=2206.00 loops=1)
         Filter: ((segmentby = '1'::text) OR ((with_bloom = stable_lower('1'::text)) AND (with_bloom = volatile_lower('1'::text))))
         Rows Removed by Filter: 47795
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=2207.00 loops=1)
         Filter: ((segmentby = '1'::text) OR ((with_bloom = stable_lower('1'::text)) AND (with_bloom = volatile_lower('1'::text))))
         Rows Removed by Filter: 47793
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)

-- Some joins.
explain (analyze, buffers off, costs off, timing off, summary off)
with arrays as (select array[segmentby] a from saop group by segmentby order by segmentby limit 10)
select * from saop, arrays where segmentby = any(a);
--- QUERY PLAN ---
 Nested Loop (actual rows=43480.00 loops=1)
   ->  Limit (actual rows=10.00 loops=1)
         ->  Sort (actual rows=10.00 loops=1)
               Sort Key: saop_1.segmentby
               Sort Method: top-N heapsort 
               ->  Finalize HashAggregate (actual rows=23.00 loops=1)
                     Group Key: saop_1.segmentby
                     ->  Append (actual rows=138.00 loops=1)
                           ->  Custom Scan (VectorAgg) (actual rows=69.00 loops=1)
                                 ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=50001.00 loops=1)
                                       ->  Seq Scan on compress_hyper_2_3_chunk compress_hyper_2_3_chunk_1 (actual rows=69.00 loops=1)
                           ->  Custom Scan (VectorAgg) (actual rows=69.00 loops=1)
                                 ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=50000.00 loops=1)
                                       ->  Seq Scan on compress_hyper_2_4_chunk compress_hyper_2_4_chunk_1 (actual rows=69.00 loops=1)
   ->  Append (actual rows=4348.00 loops=10)
         ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=2174.00 loops=10)
               Filter: (segmentby = ANY ((ARRAY[saop_1.segmentby])))
               ->  Index Scan using compress_hyper_2_3_chunk_segmentby__ts_meta_min_1__ts_meta__idx on compress_hyper_2_3_chunk (actual rows=3.00 loops=10)
                     Index Cond: (segmentby = ANY ((ARRAY[saop_1.segmentby])))
         ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=2174.00 loops=10)
               Filter: (segmentby = ANY ((ARRAY[saop_1.segmentby])))
               ->  Index Scan using compress_hyper_2_4_chunk_segmentby__ts_meta_min_1__ts_meta__idx on compress_hyper_2_4_chunk (actual rows=3.00 loops=10)
                     Index Cond: (segmentby = ANY ((ARRAY[saop_1.segmentby])))

explain (analyze, buffers off, costs off, timing off, summary off)
with arrays as (select array[segmentby] a from saop group by segmentby order by segmentby limit 10)
select * from saop, arrays where with_minmax = any(a);
--- QUERY PLAN ---
 Nested Loop (actual rows=34482.00 loops=1)
   Join Filter: (saop.with_minmax = ANY (arrays.a))
   Rows Removed by Join Filter: 965528
   ->  Append (actual rows=100001.00 loops=1)
         ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=50001.00 loops=1)
               ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
         ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=50000.00 loops=1)
               ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)
   ->  Materialize (actual rows=10.00 loops=100001)
         ->  Subquery Scan on arrays (actual rows=10.00 loops=1)
               ->  Limit (actual rows=10.00 loops=1)
                     ->  Sort (actual rows=10.00 loops=1)
                           Sort Key: saop_1.segmentby
                           Sort Method: top-N heapsort 
                           ->  Finalize HashAggregate (actual rows=23.00 loops=1)
                                 Group Key: saop_1.segmentby
                                 ->  Append (actual rows=138.00 loops=1)
                                       ->  Custom Scan (VectorAgg) (actual rows=69.00 loops=1)
                                             ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=50001.00 loops=1)
                                                   ->  Seq Scan on compress_hyper_2_3_chunk compress_hyper_2_3_chunk_1 (actual rows=69.00 loops=1)
                                       ->  Custom Scan (VectorAgg) (actual rows=69.00 loops=1)
                                             ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=50000.00 loops=1)
                                                   ->  Seq Scan on compress_hyper_2_4_chunk compress_hyper_2_4_chunk_1 (actual rows=69.00 loops=1)

explain (analyze, buffers off, costs off, timing off, summary off)
with arrays as (select array[segmentby] a from saop group by segmentby order by segmentby limit 10)
select * from saop, arrays where with_bloom = any(a);
--- QUERY PLAN ---
 Nested Loop (actual rows=474.00 loops=1)
   Join Filter: (saop.with_bloom = ANY (arrays.a))
   Rows Removed by Join Filter: 999536
   ->  Append (actual rows=100001.00 loops=1)
         ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=50001.00 loops=1)
               ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=69.00 loops=1)
         ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=50000.00 loops=1)
               ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=69.00 loops=1)
   ->  Materialize (actual rows=10.00 loops=100001)
         ->  Subquery Scan on arrays (actual rows=10.00 loops=1)
               ->  Limit (actual rows=10.00 loops=1)
                     ->  Sort (actual rows=10.00 loops=1)
                           Sort Key: saop_1.segmentby
                           Sort Method: top-N heapsort 
                           ->  Finalize HashAggregate (actual rows=23.00 loops=1)
                                 Group Key: saop_1.segmentby
                                 ->  Append (actual rows=138.00 loops=1)
                                       ->  Custom Scan (VectorAgg) (actual rows=69.00 loops=1)
                                             ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=50001.00 loops=1)
                                                   ->  Seq Scan on compress_hyper_2_3_chunk compress_hyper_2_3_chunk_1 (actual rows=69.00 loops=1)
                                       ->  Custom Scan (VectorAgg) (actual rows=69.00 loops=1)
                                             ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=50000.00 loops=1)
                                                   ->  Seq Scan on compress_hyper_2_4_chunk compress_hyper_2_4_chunk_1 (actual rows=69.00 loops=1)

-- Array parameter of prepared statements.
prepare array_param as select * from saop where with_bloom = any($1);
set timescaledb.enable_chunk_append to off;
-- Generic plans.
set plan_cache_mode = force_generic_plan;
explain (analyze, buffers off, costs off, timing off, summary off)
execute array_param(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ($1))
         Rows Removed by Filter: 47605
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, $1)
               Rows Removed by Filter: 13
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ($1))
         Rows Removed by Filter: 47604
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, $1)
               Rows Removed by Filter: 13

explain (analyze, buffers off, costs off, timing off, summary off)
execute array_param(array[]::text[]);
--- QUERY PLAN ---
 Append (actual rows=0.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ($1))
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, $1)
               Rows Removed by Filter: 69
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ($1))
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, $1)
               Rows Removed by Filter: 69

explain (analyze, buffers off, costs off, timing off, summary off)
execute array_param(null::text[]);
--- QUERY PLAN ---
 Append (actual rows=0.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ($1))
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, $1)
               Rows Removed by Filter: 69
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ($1))
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, $1)
               Rows Removed by Filter: 69

-- Custom plans.
set plan_cache_mode = force_custom_plan;
explain (analyze, buffers off, costs off, timing off, summary off)
execute array_param(array['1', '10']);
--- QUERY PLAN ---
 Append (actual rows=270.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47605
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=135.00 loops=1)
         Vectorized Filter: (with_bloom = ANY ('{1,10}'::text[]))
         Rows Removed by Filter: 47604
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=56.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, '{1,10}'::text[])
               Rows Removed by Filter: 13

explain (analyze, buffers off, costs off, timing off, summary off)
execute array_param(array[]::text[]);
--- QUERY PLAN ---
 Result (actual rows=0.00 loops=1)
   One-Time Filter: false

explain (analyze, buffers off, costs off, timing off, summary off)
execute array_param(null::text[]);
--- QUERY PLAN ---
 Append (actual rows=0.00 loops=1)
   ->  Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY (NULL::text[]))
         ->  Seq Scan on compress_hyper_2_3_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, NULL::text[])
               Rows Removed by Filter: 69
   ->  Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
         Vectorized Filter: (with_bloom = ANY (NULL::text[]))
         ->  Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
               Filter: _timescaledb_functions.bloom1_contains_any(regress-test-bloom_with_bloom, NULL::text[])
               Rows Removed by Filter: 69

reset timescaledb.enable_chunk_append;
