Skip to content

Commit

Permalink
Revert "Fix PG-syntax mixed-types joins (#5556)" (#5947)
Browse files Browse the repository at this point in the history
  • Loading branch information
marsaly79 authored Jun 26, 2024
1 parent 0a857b8 commit 23bc78b
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 195 deletions.
5 changes: 0 additions & 5 deletions ydb/library/yql/core/common_opt/yql_co_pgselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1765,11 +1765,6 @@ std::tuple<TVector<ui32>, TExprNode::TListType> BuildJoinGroups(TPositionHandle
break;
}

if (left->GetTypeAnn() != right->GetTypeAnn()) {
bad = true;
break;
}

bool leftOnLeft;
if (left->IsCallable("Member") && &left->Head() == &predicate->Head().Head()) {
auto inputPtr = memberToInput.FindPtr(left->Child(1)->Content());
Expand Down
4 changes: 0 additions & 4 deletions ydb/library/yql/core/common_opt/yql_flatmap_over_join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,6 @@ TExprNode::TPtr DecayCrossJoinIntoInner(TExprNode::TPtr equiJoin, const TExprNod
return equiJoin;
}

if (left->GetTypeAnn() != right->GetTypeAnn()) {
return equiJoin;
}

TSet<ui32> leftInputs, rightInputs;
TSet<TStringBuf> usedFields;
GatherJoinInputs(left, row, parentsMap, backRenameMap, labels, leftInputs, usedFields);
Expand Down
22 changes: 0 additions & 22 deletions ydb/library/yql/tests/sql/dq_file/part10/canondata/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -1877,28 +1877,6 @@
}
],
"test.test[pg-aggregate_combine--Results]": [],
"test.test[pg-join_mixed_types--Analyze]": [
{
"checksum": "5218503de8ae47338f8fb364127bedf9",
"size": 7433,
"uri": "https://{canondata_backend}/1925842/1afddaadfa4aa57d0e396b052de71d638933dcd4/resource.tar.gz#test.test_pg-join_mixed_types--Analyze_/plan.txt"
}
],
"test.test[pg-join_mixed_types--Debug]": [
{
"checksum": "0df0e7f9a4182bb4912483a5c1fe87db",
"size": 3066,
"uri": "https://{canondata_backend}/1925842/1afddaadfa4aa57d0e396b052de71d638933dcd4/resource.tar.gz#test.test_pg-join_mixed_types--Debug_/opt.yql_patched"
}
],
"test.test[pg-join_mixed_types--Plan]": [
{
"checksum": "5218503de8ae47338f8fb364127bedf9",
"size": 7433,
"uri": "https://{canondata_backend}/1925842/1afddaadfa4aa57d0e396b052de71d638933dcd4/resource.tar.gz#test.test_pg-join_mixed_types--Plan_/plan.txt"
}
],
"test.test[pg-join_mixed_types--Results]": [],
"test.test[pg-order_by_distinct_same_expr_agg_sublink-default.txt-Analyze]": [
{
"checksum": "c1f2d837c3623c81dd596a9877913fb8",
Expand Down
14 changes: 0 additions & 14 deletions ydb/library/yql/tests/sql/hybrid_file/part2/canondata/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -1903,20 +1903,6 @@
"uri": "https://{canondata_backend}/1936842/5461a7f0f4d722c81cba2eff5dd1d41bf3a77f80/resource.tar.gz#test.test_pg-insert--Plan_/plan.txt"
}
],
"test.test[pg-join_mixed_types--Debug]": [
{
"checksum": "687483f04fd8a538dd4587f805e558d5",
"size": 5602,
"uri": "https://{canondata_backend}/1925842/b16a3fb835f9baf17f7c68e238f1ff3fa411b08e/resource.tar.gz#test.test_pg-join_mixed_types--Debug_/opt.yql_patched"
}
],
"test.test[pg-join_mixed_types--Plan]": [
{
"checksum": "569223ae3507b171c9b19d3fceefb315",
"size": 8853,
"uri": "https://{canondata_backend}/1925842/b16a3fb835f9baf17f7c68e238f1ff3fa411b08e/resource.tar.gz#test.test_pg-join_mixed_types--Plan_/plan.txt"
}
],
"test.test[pg-join_using6-default.txt-Debug]": [
{
"checksum": "4ad19c912ddd72af2c79985283518a08",
Expand Down
7 changes: 0 additions & 7 deletions ydb/library/yql/tests/sql/sql2yql/canondata/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -12053,13 +12053,6 @@
"uri": "https://{canondata_backend}/1881367/79a71c1478c556da1931a7565c12bdd14cc63567/resource.tar.gz#test_sql2yql.test_pg-join_groups_/sql.yql"
}
],
"test_sql2yql.test[pg-join_mixed_types]": [
{
"checksum": "b364a4a34d7f99a7ffb8ac6b4b3197f3",
"size": 1691,
"uri": "https://{canondata_backend}/1936997/14bc828ad4bae6165180fbcaed4d8486bbb77859/resource.tar.gz#test_sql2yql.test_pg-join_mixed_types_/sql.yql"
}
],
"test_sql2yql.test[pg-join_tree_order]": [
{
"checksum": "ccdf19008cb38637422026d0ea06e9b8",
Expand Down
3 changes: 0 additions & 3 deletions ydb/library/yql/tests/sql/suites/pg/input_misc_types.txt

This file was deleted.

5 changes: 0 additions & 5 deletions ydb/library/yql/tests/sql/suites/pg/input_misc_types.txt.attr

This file was deleted.

1 change: 0 additions & 1 deletion ydb/library/yql/tests/sql/suites/pg/join_mixed_types.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions ydb/library/yql/tests/sql/suites/pg/join_mixed_types.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1857,27 +1857,6 @@
"uri": "https://{canondata_backend}/1809005/81aef895e3303f900cc0cb6245596fe9a0da6573/resource.tar.gz#test.test_pg-aggregate_combine--Results_/results.txt"
}
],
"test.test[pg-join_mixed_types--Debug]": [
{
"checksum": "87186caeeba9fdcbd4baa1e7b1d4415c",
"size": 5542,
"uri": "https://{canondata_backend}/1925842/a75b2a850dffc93078af24b6960712b9ee737f6e/resource.tar.gz#test.test_pg-join_mixed_types--Debug_/opt.yql"
}
],
"test.test[pg-join_mixed_types--Plan]": [
{
"checksum": "e61d62c499a0a562918ffa9a71d0abfa",
"size": 8853,
"uri": "https://{canondata_backend}/1925842/a75b2a850dffc93078af24b6960712b9ee737f6e/resource.tar.gz#test.test_pg-join_mixed_types--Plan_/plan.txt"
}
],
"test.test[pg-join_mixed_types--Results]": [
{
"checksum": "613fab0dfa1e220391713e252e265be9",
"size": 2314,
"uri": "https://{canondata_backend}/1925842/a75b2a850dffc93078af24b6960712b9ee737f6e/resource.tar.gz#test.test_pg-join_mixed_types--Results_/results.txt"
}
],
"test.test[pg-order_by_distinct_same_expr_agg_sublink-default.txt-Debug]": [
{
"checksum": "add068636ef7667f017803290484353e",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,25 @@
"Plans": [
{
"CTE Name": "precompute_0_0",
"Node Type": "Limit-Filter-CrossJoin-TableFullScan-ConstantExpr-ConstantExpr-InnerJoin (JoinDict)-ConstantExpr-ConstantExpr-InnerJoin (JoinDict)-ConstantExpr",
"Node Type": "Limit-CrossJoin-InnerJoin (MapJoin)-ConstantExpr-Filter-TableFullScan-ConstantExpr",
"Operators": [
{
"Inputs": [
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
Expand All @@ -54,84 +69,52 @@
"Inputs": [
{
"InternalOperatorId": 2
},
{
"InternalOperatorId": 6
}
],
"Name": "Filter",
"Predicate": "item.b.Sum0 == item.t.thousand And item.a.f1 + item.b.Sum0 + 999 == item.t.tenthous"
"Name": "CrossJoin"
},
{
"Condition": "thousand = Sum0",
"Inputs": [
{
"InternalOperatorId": 3
},
{
"InternalOperatorId": 9
"InternalOperatorId": 4
},
{
"InternalOperatorId": 9
"InternalOperatorId": 3
}
],
"Name": "CrossJoin"
"Name": "InnerJoin (MapJoin)"
},
{
"Inputs": [],
"Name": "TableFullScan",
"ReadColumns": [
"tenthous",
"thousand"
],
"ReadRanges": [
"unique1 (-\u221e, +\u221e)",
"unique2 (-\u221e, +\u221e)"
],
"Scan": "Parallel",
"Table": "postgres_jointest/join0.test_plan/tenk1"
},
{
"Inputs": [
{
"InternalOperatorId": 5
}
],
"Name": "ToFlow",
"ToFlow": "precompute_0_0"
},
{
"Inputs": [],
"Member": "precompute_0_0",
"Name": "Member"
},
{
"Inputs": [
{
"InternalOperatorId": 8
},
{
"InternalOperatorId": 10
"InternalOperatorId": 5
}
],
"Name": "InnerJoin (JoinDict)"
},
{
"Inputs": [],
"Name": "ToFlow",
"ToFlow": "precompute_0_0"
"Name": "Filter",
"Predicate": "Exist(item.thousand)"
},
{
"Inputs": [],
"Name": "ToFlow",
"ToFlow": "precompute_0_0"
},
{
"Inputs": [
{
"InternalOperatorId": 8
},
{
"InternalOperatorId": 10
}
"Name": "TableFullScan",
"ReadColumns": [
"tenthous",
"thousand"
],
"Name": "InnerJoin (JoinDict)"
"ReadRanges": [
"unique1 (-\u221e, +\u221e)",
"unique2 (-\u221e, +\u221e)"
],
"Scan": "Parallel",
"Table": "postgres_jointest/join0.test_plan/tenk1"
},
{
"Inputs": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,61 +29,10 @@
"PlanNodeType": "Connection",
"Plans": [
{
"Node Type": "Limit-Filter-CrossJoin-TableFullScan",
"Node Type": "Limit-InnerJoin (MapJoin)-Filter-TableFullScan",
"Operators": [
{
"Inputs": [
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
},
{
"InternalOperatorId": 1
}
Expand All @@ -92,21 +41,25 @@
"Name": "Limit"
},
{
"Condition": "unique1,stringu1 = i,j",
"Inputs": [
{
"InternalOperatorId": 2
},
{
"Other": "ConstantExpression"
}
],
"Name": "Filter",
"Predicate": "item.onek.unique1 == item.v.i And item.onek.stringu1 == item.v.j"
"Name": "InnerJoin (MapJoin)"
},
{
"Inputs": [
{
"InternalOperatorId": 3
}
],
"Name": "CrossJoin"
"Name": "Filter",
"Predicate": "Exist(item.stringu1) And Exist(item.unique1)"
},
{
"Inputs": [],
Expand Down

0 comments on commit 23bc78b

Please sign in to comment.