-- { echoOn } SELECT 'ARRAY JOIN with constant'; ARRAY JOIN with constant SELECT id, value, value_1 FROM test_table ARRAY JOIN [1, 2, 3] AS value_1; 0 Value 1 0 Value 2 0 Value 3 0 Value 1 0 Value 2 0 Value 3 SELECT '--'; -- SELECT id, value FROM test_table ARRAY JOIN [1, 2, 3] AS value; 0 1 0 2 0 3 0 1 0 2 0 3 SELECT '--'; -- WITH [1, 2, 3] AS constant_array SELECT id, value FROM test_table ARRAY JOIN constant_array AS value; 0 1 0 2 0 3 0 1 0 2 0 3 SELECT '--'; -- WITH [1, 2, 3] AS constant_array SELECT id, value, value_1 FROM test_table ARRAY JOIN constant_array AS value_1; 0 Value 1 0 Value 2 0 Value 3 0 Value 1 0 Value 2 0 Value 3 SELECT '--'; -- SELECT id, value, value_1, value_2 FROM test_table ARRAY JOIN [[1, 2, 3]] AS value_1 ARRAY JOIN value_1 AS value_2; 0 Value [1,2,3] 1 0 Value [1,2,3] 2 0 Value [1,2,3] 3 0 Value [1,2,3] 1 0 Value [1,2,3] 2 0 Value [1,2,3] 3 SELECT 1 AS value FROM test_table ARRAY JOIN [1,2,3] AS value; -- { serverError 179 } SELECT 'ARRAY JOIN with column'; ARRAY JOIN with column SELECT id, value, test_table.value_array FROM test_table ARRAY JOIN value_array; 0 Value 1 0 Value 2 0 Value 3 0 Value 4 0 Value 5 0 Value 6 SELECT '--'; -- SELECT id, value_array, value FROM test_table ARRAY JOIN value_array AS value; 0 [1,2,3] 1 0 [1,2,3] 2 0 [1,2,3] 3 0 [4,5,6] 4 0 [4,5,6] 5 0 [4,5,6] 6 SELECT '--'; -- SELECT id, value, value_array, value_array_element FROM test_table ARRAY JOIN value_array AS value_array_element; 0 Value [1,2,3] 1 0 Value [1,2,3] 2 0 Value [1,2,3] 3 0 Value [4,5,6] 4 0 Value [4,5,6] 5 0 Value [4,5,6] 6 SELECT '--'; -- SELECT id, value, value_array AS value_array_array_alias FROM test_table ARRAY JOIN value_array_array_alias; 0 Value [1,2,3] 0 Value [1,2,3] 0 Value [1,2,3] 0 Value [4,5,6] 0 Value [4,5,6] 0 Value [4,5,6] SELECT '--'; -- SELECT id AS value FROM test_table ARRAY JOIN value_array AS value; -- { serverError 179 } SELECT '--'; -- SELECT id, value, value_array AS value_array_array_alias, value_array_array_alias_element FROM test_table ARRAY JOIN value_array_array_alias AS value_array_array_alias_element; 0 Value [1,2,3] 1 0 Value [1,2,3] 2 0 Value [1,2,3] 3 0 Value [4,5,6] 4 0 Value [4,5,6] 5 0 Value [4,5,6] 6 SELECT '--'; -- SELECT id, value, value_array_array, value_array_array_inner_element, value_array_array_inner_element, value_array_array_inner_inner_element FROM test_table ARRAY JOIN value_array_array AS value_array_array_inner_element ARRAY JOIN value_array_array_inner_element AS value_array_array_inner_inner_element; 0 Value [[1,2,3]] [1,2,3] [1,2,3] 1 0 Value [[1,2,3]] [1,2,3] [1,2,3] 2 0 Value [[1,2,3]] [1,2,3] [1,2,3] 3 0 Value [[1,2,3],[4,5,6]] [1,2,3] [1,2,3] 1 0 Value [[1,2,3],[4,5,6]] [1,2,3] [1,2,3] 2 0 Value [[1,2,3],[4,5,6]] [1,2,3] [1,2,3] 3 0 Value [[1,2,3],[4,5,6]] [4,5,6] [4,5,6] 4 0 Value [[1,2,3],[4,5,6]] [4,5,6] [4,5,6] 5 0 Value [[1,2,3],[4,5,6]] [4,5,6] [4,5,6] 6