Skip to content

Commit 96a6bd3

Browse files
author
avevad
committed
YQL-19192 Fix a bug in in-mem cross-join
commit_hash:053aa7fb2386f44720aa5fa726f3014791ea9b65
1 parent 52092f0 commit 96a6bd3

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,15 @@ TExprNode::TPtr ExpandEquiJoinImpl(const TExprNode& node, TExprContext& ctx) {
558558
if (joinKind == "Cross") {
559559
return ctx.Builder(node.Pos())
560560
.Callable("FlatMap")
561-
.Add(0, std::move(list1))
561+
.Callable(0, "Collect")
562+
.Add(0, std::move(list1))
563+
.Seal()
562564
.Lambda(1)
563565
.Param("left")
564566
.Callable("Map")
565-
.Add(0, std::move(list2))
567+
.Callable(0, "Collect")
568+
.Add(0, std::move(list2))
569+
.Seal()
566570
.Lambda(1)
567571
.Param("right")
568572
.Callable("AsStruct")

yql/essentials/tests/sql/minirun/part1/canondata/result.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,20 @@
601601
"uri": "https://{canondata_backend}/1936273/dc5c7fc322621a2828a94006237d3583f38248e5/resource.tar.gz#test.test_join-inmem_by_uncomparable_tuples-default.txt-Results_/results.txt"
602602
}
603603
],
604+
"test.test[join-yql-19192-default.txt-Debug]": [
605+
{
606+
"checksum": "b9c6aea35bc8b70c987653997335369d",
607+
"size": 746,
608+
"uri": "https://{canondata_backend}/1814674/dfd418faf4299c20acfad523d570f8cfb90f89ea/resource.tar.gz#test.test_join-yql-19192-default.txt-Debug_/opt.yql"
609+
}
610+
],
611+
"test.test[join-yql-19192-default.txt-Results]": [
612+
{
613+
"checksum": "6e4f62a8d64ea7bbe1a05464bcb80ba4",
614+
"size": 1233,
615+
"uri": "https://{canondata_backend}/1814674/dfd418faf4299c20acfad523d570f8cfb90f89ea/resource.tar.gz#test.test_join-yql-19192-default.txt-Results_/results.txt"
616+
}
617+
],
604618
"test.test[library-library_yqls--Debug]": [
605619
{
606620
"checksum": "b2bab6a1ef79eb44b255b25d32270957",

yql/essentials/tests/sql/sql2yql/canondata/result.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,6 +3443,13 @@
34433443
"uri": "https://{canondata_backend}/1942173/99e88108149e222741552e7e6cddef041d6a2846/resource.tar.gz#test_sql2yql.test_join-left_join_with_self_aggr_/sql.yql"
34443444
}
34453445
],
3446+
"test_sql2yql.test[join-yql-19192]": [
3447+
{
3448+
"checksum": "fffdf1cbb40643da9daf9bdf3edec121",
3449+
"size": 2305,
3450+
"uri": "https://{canondata_backend}/1937367/af84d06d0fb3153f82b596e7db07f2186d2ec3a2/resource.tar.gz#test_sql2yql.test_join-yql-19192_/sql.yql"
3451+
}
3452+
],
34463453
"test_sql2yql.test[join-yql-6199]": [
34473454
{
34483455
"checksum": "5421f92ec269e5d76133e1ca54b6d0d0",
@@ -9242,6 +9249,11 @@
92429249
"uri": "file://test_sql_format.test_join-left_join_with_self_aggr_/formatted.sql"
92439250
}
92449251
],
9252+
"test_sql_format.test[join-yql-19192]": [
9253+
{
9254+
"uri": "file://test_sql_format.test_join-yql-19192_/formatted.sql"
9255+
}
9256+
],
92459257
"test_sql_format.test[join-yql-6199]": [
92469258
{
92479259
"uri": "file://test_sql_format.test_join-yql-6199_/formatted.sql"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$samples1 = AsList(<|sampl: 1|>, <|sampl: 2|>);
2+
$sampling_cumulative_prob1 = AsList(<|color: 'blue', cum_prob: 3|>);
3+
4+
$cumulative_bounds = (
5+
SELECT
6+
LAG(cum_prob) OVER () AS lower_cum_bound
7+
FROM
8+
AS_TABLE($sampling_cumulative_prob1)
9+
);
10+
11+
SELECT
12+
s.sampl,
13+
cb.lower_cum_bound
14+
FROM
15+
AS_TABLE($samples1) AS s
16+
CROSS JOIN
17+
$cumulative_bounds AS cb
18+
;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$samples1 = AsList(<|sampl: 1|>, <|sampl: 2|>);
2+
$sampling_cumulative_prob1 = AsList(<|color: "blue", cum_prob: 3|>);
3+
4+
$cumulative_bounds = SELECT
5+
LAG(cum_prob) OVER () AS lower_cum_bound
6+
FROM AS_TABLE($sampling_cumulative_prob1);
7+
8+
SELECT
9+
s.sampl,
10+
cb.lower_cum_bound
11+
FROM AS_TABLE($samples1) AS s
12+
CROSS JOIN $cumulative_bounds AS cb;

0 commit comments

Comments
 (0)