ClickHouse/tests/queries/0_stateless/02843_date_predicate_optimizations_bugs.sql
Zhiguo Zhou 3579039733 Fix an unexpected behavior in #53152
The problematic case happens when an array column of date/datetime
is simultaneously specified in an Array Join clause without aliases
and in a time converter, such as toYYYYMM.

After applying Array Join without aliases, the column's name refers
to the flattened array items, however, its data type is recognized
as a ColumnArray still, which leads to the unexpected exception
throws when building the preimage for the time converters.

As a quick fix, we more strictly check the data types of the time
converters and quit the preimage optimization pass early.
2023-08-15 14:34:08 +08:00

10 lines
169 B
SQL

select
toYYYYMM(date) as date_,
n
from (select
[toDate('20230815'), toDate('20230816')] as date,
[1, 2] as n
) as data
array join date, n
where date_ >= 202303;