Skip to content

Commit 92438cf

Browse files
authored
[yt provider] Less restrictions for BypassMerge optimizer (YQL-17618) (#1695)
1 parent 0ffd6c5 commit 92438cf

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

ydb/library/yql/providers/yt/provider/yql_yt_physical_optimize.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -7002,22 +7002,17 @@ class TYtPhysicalOptProposalTransformer : public TOptimizeTransformerBase {
70027002
continue;
70037003
}
70047004

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

70177014
const bool unordered = IsUnorderedOutput(path.Table().Cast<TYtOutput>());
7018-
auto mergeOutRowSpec = TYqlRowSpecInfo(innerMerge.Output().Item(0).RowSpec());
70197015
if (innerMergeSection.Paths().Size() > 1) {
7020-
const bool sortedMerge = mergeOutRowSpec.IsSorted();
70217016
if (hasTakeSkip && sortedMerge) {
70227017
continue;
70237018
}

ydb/library/yql/tests/sql/sql2yql/canondata/result.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -24088,9 +24088,9 @@
2408824088
],
2408924089
"test_sql_format.test[in-in_exists_immediate_nested_subq]": [
2409024090
{
24091-
"checksum": "8091fd156ecd71494b8c692e2122d2d5",
24092-
"size": 522,
24093-
"uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_in-in_exists_immediate_nested_subq_/formatted.sql"
24091+
"checksum": "af4233bf70e1ddee579cb1dbd2054020",
24092+
"size": 531,
24093+
"uri": "https://{canondata_backend}/1814674/98d868fbe8a73451900590bc9bc738f8e9f56225/resource.tar.gz#test_sql_format.test_in-in_exists_immediate_nested_subq_/formatted.sql"
2409424094
}
2409524095
],
2409624096
"test_sql_format.test[in-in_immediate_subquery]": [

ydb/library/yql/tests/sql/suites/in/in_exists_immediate_nested_subq.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* postgres can not */
2-
/* syntax version 1 */
2+
/* ignore runonopt plan diff */
33

44
use plato;
55

ydb/library/yql/tests/sql/yt_native_file/part1/canondata/result.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -998,16 +998,16 @@
998998
],
999999
"test.test[in-in_exists_immediate_nested_subq--Debug]": [
10001000
{
1001-
"checksum": "837e61271ef9460c6ecefcb5e423277a",
1002-
"size": 5121,
1003-
"uri": "https://{canondata_backend}/1936273/78bab576ef835300f10263ba394134a6f84a3c66/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Debug_/opt.yql"
1001+
"checksum": "6e5473ebe5a9fea564fc4d718143ce22",
1002+
"size": 5370,
1003+
"uri": "https://{canondata_backend}/1942525/f71b88a61ffc7fb9be7e8c9373c1022cb69b73ee/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Debug_/opt.yql"
10041004
}
10051005
],
10061006
"test.test[in-in_exists_immediate_nested_subq--Plan]": [
10071007
{
1008-
"checksum": "534764a6bc7c2d0781c2844c6a6ad5c7",
1009-
"size": 12069,
1010-
"uri": "https://{canondata_backend}/1942100/fa356a1514ea7f116ae252d00da37e6ef8360653/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Plan_/plan.txt"
1008+
"checksum": "4e7ef936526128d16ba84ae2e1524c76",
1009+
"size": 13041,
1010+
"uri": "https://{canondata_backend}/1942525/f71b88a61ffc7fb9be7e8c9373c1022cb69b73ee/resource.tar.gz#test.test_in-in_exists_immediate_nested_subq--Plan_/plan.txt"
10111011
}
10121012
],
10131013
"test.test[in-in_exists_immediate_nested_subq--Results]": [

0 commit comments

Comments
 (0)