You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CTE intermittent failure with two JOINs (?) #29748
WITH cte1 as (
SELECT '1234' as x
), cte2 as (
SELECT '1234' as x
)
SELECT *
FROM events AS events
JOIN cte2 ON cte2.x = events.distinct_id
JOIN cte1 ON cte1.x = cte2.x
limit 1
The events table is created with ON CLUSTER i.e. distributed.
WITH cte1 as (
SELECT '1234' as x
), cte2 as (
SELECT '1234' as x
)
SELECT events.distinct_id
FROM events AS events
JOIN cte2 ON cte2.x = events.distinct_id
-- JOIN cte1 ON cte1.x = cte2.x
limit 1
it always works.
If I run:
WITH cte1 as (
SELECT '1234' as x
), cte2 as (
SELECT '1234' as x
)
SELECT events.distinct_id
FROM events AS events
JOIN cte2 ON cte2.x = events.distinct_id
JOIN cte1 ON cte1.x = cte2.x
limit 1
it intermittently works.
If I query with the same pattern with another table I do not get errors.
Expected behavior
CTE evaluation shouldn't be dependent on specific select fields (?)
Error message and/or stacktrace
As specified above.
Additional context
None except mainly I'm looking for debug pointers. i.e. sql to run on a specific shard may be appropriate for debugging?
Looks like this might be relevant in our case, it looks like the events table is Distributed which changes things a little, hopefully I'll get around to reproducing this locally.
Activity
[-]CTE intermittent failure[/-][+]CTE intermittent failure with two JOINs (?)[/+]chore(correlation): remove CTEs from correlation query
fix(correlation): add lower bounds for selected events (#6280)
hazzadous commentedon Jan 6, 2022
Looks like this might be relevant in our case, it looks like the
eventstable isDistributedwhich changes things a little, hopefully I'll get around to reproducing this locally.Close: #29748