Repository navigation
Conversation
| return table_side; | ||
| } | ||
|
|
||
| void buildJoinClause(ActionsDAGPtr join_expression_dag, |
There was a problem hiding this comment.
join_expression_dag seemed to be unused, removed the argument
|
This is an automated comment for commit 49fce41 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
|
| @@ -0,0 +1 @@ | |||
| SELECT * FROM ( SELECT 1 as a ) as t1 JOIN ( SELECT 1 as a) as t2 ON arrayJoin([t1.a]) = t2.a; -- { serverError INVALID_JOIN_ON_EXPRESSION } | |||
There was a problem hiding this comment.
Why we need to disable this ? Seems that this can be useful if you have array key in some table.
There was a problem hiding this comment.
Sometimes it's difficult to wrap head around how it works.
SELECT *
FROM ( SELECT 1 as a, 'a' as attr ) as t1
JOIN ( SELECT * FROM Values('a UInt32, attr String', (1, 'A'), (2, 'B')) ) as t2
ON arrayJoin([t1.a, t1.a + 1]) = t2.a
;
-- ┌─a─┬─attr─┬─t2.a─┬─t2.attr─┐
-- │ 1 │ a │ 1 │ A │
-- │ 1 │ a │ 1 │ A │
-- │ 1 │ a │ 2 │ B │
-- │ 1 │ a │ 2 │ B │
-- └───┴──────┴──────┴─────────┘This result I can explain like we copy rows from t1 and result is the same if it would be joined
a, attr, a+1
1, 'a', 1
1, 'a', 2
by column a+1
But in the following query
SELECT *
FROM ( SELECT 1 as a, 'a' as attr ) as t1
JOIN ( SELECT * FROM Values('a UInt32, attr String', (1, 'A'), (2, 'B')) ) as t2
ON arrayJoin([t1.a, t1.a * 10]) = t2.a
FORMAT PrettyCompactMonoBlock
;
-- ┌─a─┬─attr─┬─t2.a─┬─t2.attr─┐
-- │ 1 │ a │ 1 │ A │
-- │ 1 │ a │ 1 │ A │
-- └───┴──────┴──────┴─────────┘it's unclear why row joined 2 times.
Also it doesn't work for non-constant column so far
SELECT *
FROM ( SELECT materialize(1) as a ) as t1
JOIN ( SELECT 1 as a ) as t2
ON arrayJoin([t1.a]) = t2.a
-- DB::Exception: Cannot find column a_0 in ActionsDAG result. (UNKNOWN_IDENTIFIER)There was a problem hiding this comment.
I think that arrayJoin need to be applied to left or right table before actual JOIN happens.
In your first query, this need to work something like this:
SELECT * FROM (SELECT arrayJoin([1, 1 + 1]) AS a, 'a' as attr) AS t1
INNER JOIN (SELECT * FROM Values('a UInt32, attr String', (1, 'A'), (2, 'B')) ) as t2
ON t1.a = t2.a;
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
...