Skip to content

Commit

Permalink
[yt provider] Less restrictions for BypassMerge optimizer (YQL-17618) (
Browse files Browse the repository at this point in the history
  • Loading branch information
rvu1024 authored Feb 8, 2024
1 parent 0ffd6c5 commit 92438cf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7002,22 +7002,17 @@ class TYtPhysicalOptProposalTransformer : public TOptimizeTransformerBase {
continue;
}

if (NYql::HasSetting(innerMerge.Settings().Ref(), EYtSettingType::KeepSorted)) {
if (!AllOf(innerMergeSection.Paths(), [](const auto& path) {
auto op = path.Table().template Maybe<TYtOutput>().Operation();
return op && (op.template Maybe<TYtTouch>() || (op.Raw()->HasResult() && op.Raw()->GetResult().IsWorld()));
})) {
continue;
}
auto mergeOutRowSpec = TYqlRowSpecInfo(innerMerge.Output().Item(0).RowSpec());
const bool sortedMerge = mergeOutRowSpec.IsSorted();
if (hasTakeSkip && sortedMerge && NYql::HasSetting(innerMerge.Settings().Ref(), EYtSettingType::KeepSorted)) {
continue;
}
if (hasTakeSkip && AnyOf(innerMergeSection.Paths(), [](const auto& path) { return !path.Ranges().template Maybe<TCoVoid>(); })) {
continue;
}

const bool unordered = IsUnorderedOutput(path.Table().Cast<TYtOutput>());
auto mergeOutRowSpec = TYqlRowSpecInfo(innerMerge.Output().Item(0).RowSpec());
if (innerMergeSection.Paths().Size() > 1) {
const bool sortedMerge = mergeOutRowSpec.IsSorted();
if (hasTakeSkip && sortedMerge) {
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions ydb/library/yql/tests/sql/sql2yql/canondata/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -24088,9 +24088,9 @@
],
"test_sql_format.test[in-in_exists_immediate_nested_subq]": [
{
"checksum": "8091fd156ecd71494b8c692e2122d2d5",
"size": 522,
"uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_in-in_exists_immediate_nested_subq_/formatted.sql"
"checksum": "af4233bf70e1ddee579cb1dbd2054020",
"size": 531,
"uri": "https://{canondata_backend}/1814674/98d868fbe8a73451900590bc9bc738f8e9f56225/resource.tar.gz#test_sql_format.test_in-in_exists_immediate_nested_subq_/formatted.sql"
}
],
"test_sql_format.test[in-in_immediate_subquery]": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* postgres can not */
/* syntax version 1 */
/* ignore runonopt plan diff */

use plato;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,16 +998,16 @@
],
"test.test[in-in_exists_immediate_nested_subq--Debug]": [
{
"checksum": "837e61271ef9460c6ecefcb5e423277a",
"size": 5121,
"uri": "https://{canondata_backend}/1936273/78bab576ef835300f10263ba394134a6f84a3c66/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Debug_/opt.yql"
"checksum": "6e5473ebe5a9fea564fc4d718143ce22",
"size": 5370,
"uri": "https://{canondata_backend}/1942525/f71b88a61ffc7fb9be7e8c9373c1022cb69b73ee/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Debug_/opt.yql"
}
],
"test.test[in-in_exists_immediate_nested_subq--Plan]": [
{
"checksum": "534764a6bc7c2d0781c2844c6a6ad5c7",
"size": 12069,
"uri": "https://{canondata_backend}/1942100/fa356a1514ea7f116ae252d00da37e6ef8360653/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Plan_/plan.txt"
"checksum": "4e7ef936526128d16ba84ae2e1524c76",
"size": 13041,
"uri": "https://{canondata_backend}/1942525/f71b88a61ffc7fb9be7e8c9373c1022cb69b73ee/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Plan_/plan.txt"
}
],
"test.test[in-in_exists_immediate_nested_subq--Results]": [
Expand Down

0 comments on commit 92438cf

Please sign in to comment.