ClickHouse/tests/queries/0_stateless/02498_analyzer_settings_push_down.sql
2023-01-26 12:46:58 +01:00

43 lines
1.2 KiB
SQL

SET allow_experimental_analyzer = 1;
DROP TABLE IF EXISTS test_table;
CREATE TABLE test_table (id UInt64, value Tuple(a UInt64)) ENGINE=MergeTree ORDER BY id;
INSERT INTO test_table VALUES (0, tuple(0));
-- { echoOn }
SELECT value FROM (SELECT tupleElement(value, 'a') AS value FROM test_table);
EXPLAIN QUERY TREE SELECT value FROM (
SELECT tupleElement(value, 'a') AS value FROM test_table
);
SELECT '--';
EXPLAIN QUERY TREE SELECT value FROM (
SELECT tupleElement(value, 'a') AS value FROM test_table
) SETTINGS optimize_functions_to_subcolumns = 1;
SELECT '--';
EXPLAIN QUERY TREE SELECT value FROM (
SELECT tupleElement(value, 'a') AS value FROM test_table SETTINGS optimize_functions_to_subcolumns = 0
) SETTINGS optimize_functions_to_subcolumns = 1;
SELECT '--';
EXPLAIN QUERY TREE SELECT value FROM (
SELECT tupleElement(value, 'a') AS value FROM test_table
) SETTINGS optimize_functions_to_subcolumns = 0;
SELECT '--';
EXPLAIN QUERY TREE SELECT value FROM (
SELECT tupleElement(value, 'a') AS value FROM test_table SETTINGS optimize_functions_to_subcolumns = 1
) SETTINGS optimize_functions_to_subcolumns = 0;
-- { echoOff }
DROP TABLE test_table;