Files
email-tracker/external/duckdb/test/optimizer/statistics/statistics_struct.test
2025-10-24 19:21:19 -05:00

28 lines
703 B
SQL

# name: test/optimizer/statistics/statistics_struct.test
# description: Statistics propagation test with structs
# group: [statistics]
statement ok
CREATE TABLE structs AS SELECT {'i': i} c FROM range(4) tbl(i);
statement ok
PRAGMA explain_output = OPTIMIZED_ONLY;
# we can statically determine IS NULL/IS NOT NULL are false, if there are no null values for this column
query II
EXPLAIN SELECT c IS NULL FROM structs;
----
logical_opt <!REGEX>:.*IS_NULL.*
# the same applies to c['i']
query II
EXPLAIN SELECT c['i'] IS NULL FROM structs;
----
logical_opt <!REGEX>:.*IS_NULL.*
# filter is out of range
query II
EXPLAIN SELECT * FROM structs WHERE c['i']=4;
----
logical_opt <REGEX>:.*EMPTY_RESULT.*