aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvvvv <vvvv@yandex-team.com>2025-01-20 16:38:10 +0300
committervvvv <vvvv@yandex-team.com>2025-01-20 17:00:30 +0300
commit6b3e7777077b0112e088056abc7093db18d7bec0 (patch)
treedd79c706aadcb821936dfcf375a58b6adb2d00fd
parentb6a2451a8ed4ad6c210751fcf6ae3d28998235f1 (diff)
downloadydb-6b3e7777077b0112e088056abc7093db18d7bec0.tar.gz
Introduced TableSource wrapper and Blocks/Peephole mode for minirun tests
init commit_hash:22d9a4470f726b8efcd86aaf043bfa5552c2b35e
-rw-r--r--yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp48
-rw-r--r--yql/essentials/core/type_ann/type_ann_core.cpp32
-rw-r--r--yql/essentials/core/yql_expr_constraint.cpp2
-rw-r--r--yql/essentials/providers/common/mkql/yql_provider_mkql.cpp4
-rw-r--r--yql/essentials/sql/v1/context.cpp1
-rw-r--r--yql/essentials/sql/v1/context.h1
-rw-r--r--yql/essentials/sql/v1/select.cpp17
-rw-r--r--yql/essentials/sql/v1/source.h2
-rw-r--r--yql/essentials/sql/v1/sql_query.cpp6
-rw-r--r--yql/essentials/sql/v1/sql_translation.cpp2
-rw-r--r--yql/essentials/tests/common/test_framework/test_file_common.py2
-rw-r--r--yql/essentials/tests/common/test_framework/test_utils.py17
-rw-r--r--yql/essentials/tests/sql/minirun/part0/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part1/canondata/result.json21
-rw-r--r--yql/essentials/tests/sql/minirun/part1/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part2/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part3/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part4/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part5/canondata/result.json21
-rw-r--r--yql/essentials/tests/sql/minirun/part5/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part6/canondata/result.json21
-rw-r--r--yql/essentials/tests/sql/minirun/part6/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part7/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part8/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/part9/canondata/result.json21
-rw-r--r--yql/essentials/tests/sql/minirun/part9/test.py8
-rw-r--r--yql/essentials/tests/sql/minirun/pure.py40
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/result.json48
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-empty_as_table_/formatted.sql6
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-filter_/formatted.sql7
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_/formatted.sql6
-rw-r--r--yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_filter_/formatted.sql8
-rw-r--r--yql/essentials/tests/sql/suites/blocks/default.cfg2
-rw-r--r--yql/essentials/tests/sql/suites/blocks/empty_as_table.sql1
-rw-r--r--yql/essentials/tests/sql/suites/blocks/filter.sql1
-rw-r--r--yql/essentials/tests/sql/suites/blocks/projection_add_ints.sql1
-rw-r--r--yql/essentials/tests/sql/suites/blocks/projection_add_ints_filter.sql2
-rw-r--r--yt/yql/tests/sql/suites/produce/process_multi_in_trivial_lambda.cfg2
38 files changed, 349 insertions, 73 deletions
diff --git a/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp b/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp
index b02dc45e66..08aaa5e329 100644
--- a/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp
+++ b/yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp
@@ -2416,8 +2416,30 @@ TExprNode::TPtr FuseNarrowMap(const TExprNode& node, TExprContext& ctx) {
.Seal().Build();
}
+TExprNode::TPtr TryExpandFlatMapOverTableSource(const TExprNode::TPtr& node, TExprContext& ctx) {
+ if (node->Head().IsCallable("TableSource")) {
+ YQL_CLOG(DEBUG, CorePeepHole) << "Expand " << node->Content() << " over " << node->Head().Content();
+ return ctx.Builder(node->Pos())
+ .Callable("Collect")
+ .Callable(0, node->Content())
+ .Callable(0, "ToFlow")
+ .Add(0, node->HeadPtr())
+ .Seal()
+ .Add(1, node->TailPtr())
+ .Seal()
+ .Seal()
+ .Build();
+ }
+
+ return {};
+}
+
template <bool Ordered>
TExprNode::TPtr ExpandFlatMap(const TExprNode::TPtr& node, TExprContext& ctx) {
+ if (auto res = TryExpandFlatMapOverTableSource(node, ctx)) {
+ return res;
+ }
+
const auto& lambda = node->Tail();
const auto& body = lambda.Tail();
constexpr auto map = Ordered ? "OrderedMap" : "Map";
@@ -3243,6 +3265,7 @@ TExprNode::TPtr OptimizeMap(const TExprNode::TPtr& node, TExprContext& ctx) {
return ctx.ChangeChildren(Ordered ? node->Head() : *node, {node->Head().HeadPtr(), std::move(lambda)});
}
}
+
return node;
}
@@ -6115,11 +6138,10 @@ bool CanRewriteToBlocksWithInput(const TExprNode& input, const TTypeAnnotationCo
}
TExprNode::TPtr OptimizeWideMapBlocks(const TExprNode::TPtr& node, TExprContext& ctx, TTypeAnnotationContext& types) {
- Y_ENSURE(node->IsCallable("WideMap"));
const auto lambda = node->TailPtr();
// Swap trivial WideMap and WideFromBlocks.
const auto& input = node->Head();
- if (input.IsCallable("ToFlow") && input.Head().IsCallable("WideFromBlocks")) {
+ if (node->IsCallable("WideMap") && input.IsCallable("ToFlow") && input.Head().IsCallable("WideFromBlocks")) {
if (auto newLambda = RebuildArgumentsOnlyLambdaForBlocks(*lambda, ctx, types)) {
const auto& wideFromBlocks = input.Head();
// Technically, the code below rewrites the following sequence
@@ -8298,11 +8320,30 @@ TExprNode::TPtr DropToFlowDeps(const TExprNode::TPtr& node, TExprContext& ctx) {
return ctx.ChangeChildren(*node, std::move(children));
}
-TExprNode::TPtr OptimizeToFlow(const TExprNode::TPtr& node, TExprContext&) {
+TExprNode::TPtr OptimizeToFlow(const TExprNode::TPtr& node, TExprContext& ctx) {
if (node->ChildrenSize() == 1 && node->Head().IsCallable("FromFlow")) {
YQL_CLOG(DEBUG, CorePeepHole) << "Drop ToFlow over FromFlow";
return node->Head().HeadPtr();
}
+
+
+ if (node->Head().IsCallable("TableSource")) {
+ if (node->Head().GetTypeAnn()->GetKind() == ETypeAnnotationKind::List) {
+ // TODO check wide limit
+ YQL_CLOG(DEBUG, CorePeepHole) << "Generate WideTableSource";
+ auto structType = node->Head().GetTypeAnn()->Cast<TListExprType>()->GetItemType()->Cast<TStructExprType>();
+ TVector<TString> columns;
+ for (const auto& item : structType->GetItems()) {
+ columns.push_back(TString(item->GetName()));
+ }
+
+ auto innerFlow = ctx.NewCallable(node->Pos(), "ToFlow", { node->Head().HeadPtr() });
+ auto expandMap = MakeExpandMap(node->Pos(), columns, innerFlow, ctx);
+ auto source = ctx.NewCallable(node->Pos(), "WideTableSource", { expandMap });
+ return MakeNarrowMap(node->Pos(), columns, source, ctx);
+ }
+ }
+
return node;
}
@@ -8616,6 +8657,7 @@ struct TPeepHoleRules {
const TExtPeepHoleOptimizerMap BlockStageExtRules = {
{"WideMap", &OptimizeWideMapBlocks},
+ {"NarrowMap", &OptimizeWideMapBlocks},
{"WideFilter", &OptimizeWideFilterBlocks},
{"WideToBlocks", &OptimizeWideToBlocks},
{"WideFromBlocks", &OptimizeWideFromBlocks},
diff --git a/yql/essentials/core/type_ann/type_ann_core.cpp b/yql/essentials/core/type_ann/type_ann_core.cpp
index 882adedcc5..33da2b24ad 100644
--- a/yql/essentials/core/type_ann/type_ann_core.cpp
+++ b/yql/essentials/core/type_ann/type_ann_core.cpp
@@ -9153,6 +9153,36 @@ template <NKikimr::NUdf::EDataSlot DataSlot>
return IGraphTransformer::TStatus::Repeat;
}
+ IGraphTransformer::TStatus TableSourceWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) {
+ Y_UNUSED(output);
+ if (!EnsureArgsCount(*input, 1, ctx.Expr)) {
+ return IGraphTransformer::TStatus::Error;
+ }
+
+ bool isWide = input->Content().StartsWith("Wide");
+ if (isWide) {
+ if (!EnsureWideFlowType(input->Head(), ctx.Expr)) {
+ return IGraphTransformer::TStatus::Error;
+ }
+ } else {
+ if (input->Head().GetTypeAnn() && input->Head().GetTypeAnn()->GetKind() == ETypeAnnotationKind::EmptyList) {
+ ;
+ } else {
+ if (!EnsureListType(input->Head(), ctx.Expr)) {
+ return IGraphTransformer::TStatus::Error;
+ }
+
+ auto inputItemType = input->Head().GetTypeAnn()->Cast<TListExprType>()->GetItemType();
+ if (!EnsureStructType(input->Head().Pos(), *inputItemType, ctx.Expr)) {
+ return IGraphTransformer::TStatus::Error;
+ }
+ }
+ }
+
+ input->SetTypeAnn(input->Head().GetTypeAnn());
+ return IGraphTransformer::TStatus::Ok;
+ }
+
IGraphTransformer::TStatus SqlProcessWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) {
if (!EnsureMinArgsCount(*input, 3, ctx.Expr)) {
return IGraphTransformer::TStatus::Error;
@@ -12623,6 +12653,8 @@ template <NKikimr::NUdf::EDataSlot DataSlot>
Functions["SqlVisit"] = &SqlVisitWrapper;
Functions["Visit"] = &VisitWrapper;
Functions["Way"] = &WayWrapper;
+ Functions["TableSource"] = &TableSourceWrapper;
+ Functions["WideTableSource"] = &TableSourceWrapper;
Functions["SqlAccess"] = &SqlAccessWrapper;
Functions["SqlProcess"] = &SqlProcessWrapper;
Functions["SqlReduce"] = &SqlReduceWrapper;
diff --git a/yql/essentials/core/yql_expr_constraint.cpp b/yql/essentials/core/yql_expr_constraint.cpp
index 3782544df1..c2a7b2901e 100644
--- a/yql/essentials/core/yql_expr_constraint.cpp
+++ b/yql/essentials/core/yql_expr_constraint.cpp
@@ -105,6 +105,8 @@ public:
Functions["Iterator"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
Functions["ForwardList"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
Functions["LazyList"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
+ Functions["TableSource"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
+ Functions["WideTableSource"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
Functions["ToFlow"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
Functions["FromFlow"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
Functions["ToStream"] = &TCallableConstraintTransformer::CopyAllFrom<0>;
diff --git a/yql/essentials/providers/common/mkql/yql_provider_mkql.cpp b/yql/essentials/providers/common/mkql/yql_provider_mkql.cpp
index 92ab62adb1..aedb35aa19 100644
--- a/yql/essentials/providers/common/mkql/yql_provider_mkql.cpp
+++ b/yql/essentials/providers/common/mkql/yql_provider_mkql.cpp
@@ -2408,6 +2408,10 @@ TMkqlCommonCallableCompiler::TShared::TShared() {
return ctx.ProgramBuilder.Nop(input, returnType);
});
+ AddCallable({"TableSource", "WideTableSource"}, [](const TExprNode& node, TMkqlBuildContext& ctx) {
+ return MkqlBuildExpr(node.Head(), ctx);
+ });
+
AddCallable({"WithWorld"}, [](const TExprNode& node, TMkqlBuildContext& ctx) {
return MkqlBuildExpr(node.Head(), ctx);
});
diff --git a/yql/essentials/sql/v1/context.cpp b/yql/essentials/sql/v1/context.cpp
index 64eca540d7..43afc53c38 100644
--- a/yql/essentials/sql/v1/context.cpp
+++ b/yql/essentials/sql/v1/context.cpp
@@ -58,6 +58,7 @@ THashMap<TStringBuf, TPragmaField> CTX_PRAGMA_FIELDS = {
{"EmitStartsWith", &TContext::EmitStartsWith},
{"AnsiLike", &TContext::AnsiLike},
{"UseBlocks", &TContext::UseBlocks},
+ {"EmitTableSource", &TContext::EmitTableSource},
{"BlockEngineEnable", &TContext::BlockEngineEnable},
{"BlockEngineForce", &TContext::BlockEngineForce},
{"UnorderedResult", &TContext::UnorderedResult},
diff --git a/yql/essentials/sql/v1/context.h b/yql/essentials/sql/v1/context.h
index de7760a5d1..a5001fd157 100644
--- a/yql/essentials/sql/v1/context.h
+++ b/yql/essentials/sql/v1/context.h
@@ -314,6 +314,7 @@ namespace NSQLTranslationV1 {
bool EmitStartsWith = true;
TMaybe<bool> EmitAggApply;
bool UseBlocks = false;
+ bool EmitTableSource = false;
bool AnsiLike = false;
bool FeatureR010 = false; //Row pattern recognition: FROM clause
TMaybe<bool> CompactGroupBy;
diff --git a/yql/essentials/sql/v1/select.cpp b/yql/essentials/sql/v1/select.cpp
index 4f5db44069..bf8287e89a 100644
--- a/yql/essentials/sql/v1/select.cpp
+++ b/yql/essentials/sql/v1/select.cpp
@@ -265,10 +265,11 @@ TSourcePtr BuildFakeSource(TPosition pos, bool missingFrom, bool inSubquery) {
class TNodeSource: public ISource {
public:
- TNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList)
+ TNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList, bool wrapByTableSource)
: ISource(pos)
, Node(node)
, WrapToList(wrapToList)
+ , WrapByTableSource(wrapByTableSource)
{
YQL_ENSURE(Node);
FakeSource = BuildFakeSource(pos);
@@ -296,21 +297,27 @@ public:
if (WrapToList) {
nodeAst = Y("ToList", nodeAst);
}
+
+ if (WrapByTableSource) {
+ nodeAst = Y("TableSource", nodeAst);
+ }
+
return nodeAst;
}
TPtr DoClone() const final {
- return new TNodeSource(Pos, SafeClone(Node), WrapToList);
+ return new TNodeSource(Pos, SafeClone(Node), WrapToList, WrapByTableSource);
}
private:
TNodePtr Node;
- bool WrapToList;
+ const bool WrapToList;
+ const bool WrapByTableSource;
TSourcePtr FakeSource;
};
-TSourcePtr BuildNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList) {
- return new TNodeSource(pos, node, wrapToList);
+TSourcePtr BuildNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList, bool wrapByTableSource) {
+ return new TNodeSource(pos, node, wrapToList, wrapByTableSource);
}
class IProxySource: public ISource {
diff --git a/yql/essentials/sql/v1/source.h b/yql/essentials/sql/v1/source.h
index f69684b03e..bd311567d3 100644
--- a/yql/essentials/sql/v1/source.h
+++ b/yql/essentials/sql/v1/source.h
@@ -242,7 +242,7 @@ namespace NSQLTranslationV1 {
TNodePtr BuildSourceNode(TPosition pos, TSourcePtr source, bool checkExist = false);
TSourcePtr BuildMuxSource(TPosition pos, TVector<TSourcePtr>&& sources);
TSourcePtr BuildFakeSource(TPosition pos, bool missingFrom = false, bool inSubquery = false);
- TSourcePtr BuildNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList = false);
+ TSourcePtr BuildNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList = false, bool wrapByTableSource = false);
TSourcePtr BuildTableSource(TPosition pos, const TTableRef& table, const TString& label = TString());
TSourcePtr BuildInnerSource(TPosition pos, TNodePtr node, const TString& service, const TDeferredAtom& cluster, const TString& label = TString());
TSourcePtr BuildRefColumnSource(TPosition pos, const TString& partExpression);
diff --git a/yql/essentials/sql/v1/sql_query.cpp b/yql/essentials/sql/v1/sql_query.cpp
index 9b8c1182db..eb1a174b30 100644
--- a/yql/essentials/sql/v1/sql_query.cpp
+++ b/yql/essentials/sql/v1/sql_query.cpp
@@ -3046,6 +3046,12 @@ TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success
} else if (normalizedPragma == "disableuseblocks") {
Ctx.UseBlocks = false;
Ctx.IncrementMonCounter("sql_pragma", "DisableUseBlocks");
+ } else if (normalizedPragma == "emittablesource") {
+ Ctx.EmitTableSource = true;
+ Ctx.IncrementMonCounter("sql_pragma", "EmitTableSource");
+ } else if (normalizedPragma == "disableemittablesource") {
+ Ctx.EmitTableSource = false;
+ Ctx.IncrementMonCounter("sql_pragma", "DisableEmitTableSource");
} else if (normalizedPragma == "ansilike") {
Ctx.AnsiLike = true;
Ctx.IncrementMonCounter("sql_pragma", "AnsiLike");
diff --git a/yql/essentials/sql/v1/sql_translation.cpp b/yql/essentials/sql/v1/sql_translation.cpp
index 5dc95b3fcd..9989295291 100644
--- a/yql/essentials/sql/v1/sql_translation.cpp
+++ b/yql/essentials/sql/v1/sql_translation.cpp
@@ -1479,7 +1479,7 @@ TMaybe<TSourcePtr> TSqlTranslation::AsTableImpl(const TRule_table_ref& node) {
return TMaybe<TSourcePtr>(nullptr);
}
- return BuildNodeSource(Ctx.Pos(), arg->Expr, true);
+ return BuildNodeSource(Ctx.Pos(), arg->Expr, true, Ctx.EmitTableSource);
}
}
diff --git a/yql/essentials/tests/common/test_framework/test_file_common.py b/yql/essentials/tests/common/test_framework/test_file_common.py
index 37d008759f..3bd6b7af1d 100644
--- a/yql/essentials/tests/common/test_framework/test_file_common.py
+++ b/yql/essentials/tests/common/test_framework/test_file_common.py
@@ -26,7 +26,7 @@ def get_gateways_config(http_files, yql_http_file_server, force_blocks=False, is
schema.Pattern = 'http_test://(.*)'
schema.TargetUrl = yql_http_file_server.compose_http_link('$1')
if force_blocks:
- config_message.SqlCore.TranslationFlags.extend(['EmitAggApply'])
+ config_message.SqlCore.TranslationFlags.extend(['EmitAggApply', 'EmitTableSource'])
flags = config_message.YqlCore.Flags.add()
flags.Name = 'UseBlocks'
if is_hybrid:
diff --git a/yql/essentials/tests/common/test_framework/test_utils.py b/yql/essentials/tests/common/test_framework/test_utils.py
index 1063c6e07b..3b9282eef5 100644
--- a/yql/essentials/tests/common/test_framework/test_utils.py
+++ b/yql/essentials/tests/common/test_framework/test_utils.py
@@ -71,7 +71,7 @@ def pytest_generate_tests_by_template(template, metafunc, data_path):
metafunc.parametrize(['suite', 'case'], argvalues)
-def pytest_generate_tests_for_run(metafunc, template='.sql', suites=None, currentPart=0, partsCount=1, data_path=None):
+def pytest_generate_tests_for_run(metafunc, template='.sql', suites=None, currentPart=0, partsCount=1, data_path=None, mode_expander=None):
assert data_path is not None
argvalues = []
@@ -95,25 +95,30 @@ def pytest_generate_tests_for_run(metafunc, template='.sql', suites=None, curren
]
if os.path.exists(suite_dir + '/' + case + '.cfg'):
configs.append('')
+ to_append = []
for cfg in sorted(configs):
if _make_hash((suite, case, cfg)) % partsCount == currentPart:
- argvalues.append((suite, case, cfg))
+ to_append.append((suite, case, cfg))
if not configs and _make_hash((suite, case, 'default.txt')) % partsCount == currentPart:
- argvalues.append((suite, case, 'default.txt'))
+ to_append.append((suite, case, 'default.txt'))
+ if mode_expander is None:
+ argvalues += to_append
+ else:
+ argvalues += mode_expander(to_append)
metafunc.parametrize(
- ['suite', 'case', 'cfg'],
+ ['suite', 'case', 'cfg'] + (['what'] if mode_expander is not None else []),
argvalues,
)
# FIXME make data_path required (dq usage)
-def pytest_generate_tests_for_part(metafunc, currentPart, partsCount, data_path=None, template='.sql'):
+def pytest_generate_tests_for_part(metafunc, currentPart, partsCount, data_path=None, template='.sql', mode_expander=None):
if data_path is None:
data_path = DATA_PATH
return pytest_generate_tests_for_run(metafunc, currentPart=currentPart, partsCount=partsCount,
- data_path=data_path, template=template)
+ data_path=data_path, template=template, mode_expander=mode_expander)
def get_cfg_file(cfg, case):
diff --git a/yql/essentials/tests/sql/minirun/part0/test.py b/yql/essentials/tests/sql/minirun/part0/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part0/test.py
+++ b/yql/essentials/tests/sql/minirun/part0/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part1/canondata/result.json b/yql/essentials/tests/sql/minirun/part1/canondata/result.json
index 88857905bb..4a1ab738f6 100644
--- a/yql/essentials/tests/sql/minirun/part1/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part1/canondata/result.json
@@ -209,6 +209,27 @@
"uri": "https://{canondata_backend}/1920236/fd3dfd41a8e63d7fa9cb2e8c3d8e6d8d5f51f2cb/resource.tar.gz#test.test_bigdate-tzstrliterals-default.txt-Results_/results.txt"
}
],
+ "test.test[blocks-empty_as_table-default.txt-Debug]": [
+ {
+ "checksum": "02505b6facd77cffd49cb50c6594bfb4",
+ "size": 193,
+ "uri": "https://{canondata_backend}/1881367/d69a84f4c03a928385a2fa1e80f00c900ecc2329/resource.tar.gz#test.test_blocks-empty_as_table-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[blocks-empty_as_table-default.txt-Peephole]": [
+ {
+ "checksum": "a25bc5529ca43bbc2156117a5ab492f0",
+ "size": 207,
+ "uri": "https://{canondata_backend}/1599023/13c5bc706a21d8feb94abd7c7eacc9cc0eadb23f/resource.tar.gz#test.test_blocks-empty_as_table-default.txt-Peephole_/opt.yql"
+ }
+ ],
+ "test.test[blocks-empty_as_table-default.txt-Results]": [
+ {
+ "checksum": "d3e6d1b7aac397559c3118e30efbef9d",
+ "size": 251,
+ "uri": "https://{canondata_backend}/1881367/d69a84f4c03a928385a2fa1e80f00c900ecc2329/resource.tar.gz#test.test_blocks-empty_as_table-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[compute_range-tuples_compare-default.txt-Debug]": [
{
"checksum": "501d11676cf33c61787adfa1afed5db6",
diff --git a/yql/essentials/tests/sql/minirun/part1/test.py b/yql/essentials/tests/sql/minirun/part1/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part1/test.py
+++ b/yql/essentials/tests/sql/minirun/part1/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part2/test.py b/yql/essentials/tests/sql/minirun/part2/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part2/test.py
+++ b/yql/essentials/tests/sql/minirun/part2/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part3/test.py b/yql/essentials/tests/sql/minirun/part3/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part3/test.py
+++ b/yql/essentials/tests/sql/minirun/part3/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part4/test.py b/yql/essentials/tests/sql/minirun/part4/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part4/test.py
+++ b/yql/essentials/tests/sql/minirun/part4/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part5/canondata/result.json b/yql/essentials/tests/sql/minirun/part5/canondata/result.json
index 3b952ed7ec..c69065e43b 100644
--- a/yql/essentials/tests/sql/minirun/part5/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part5/canondata/result.json
@@ -310,6 +310,27 @@
"uri": "file://test.test_bitcast_implicit-mul_bitcast-default.txt-Results_/extracted"
}
],
+ "test.test[blocks-filter-default.txt-Debug]": [
+ {
+ "checksum": "3dea830ec45f78ed78603576b054b4ca",
+ "size": 219,
+ "uri": "https://{canondata_backend}/1937150/d87c401e99a94fad9fdc66f7c4a0d9c670b84949/resource.tar.gz#test.test_blocks-filter-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[blocks-filter-default.txt-Peephole]": [
+ {
+ "checksum": "727b35f5c4d7a0647482ffad550fd950",
+ "size": 710,
+ "uri": "https://{canondata_backend}/1942525/3a5c45563e24ce3cec2704463eb5e7a3038772ba/resource.tar.gz#test.test_blocks-filter-default.txt-Peephole_/opt.yql"
+ }
+ ],
+ "test.test[blocks-filter-default.txt-Results]": [
+ {
+ "checksum": "8d6273d5f4540afa8d6303866158700a",
+ "size": 983,
+ "uri": "https://{canondata_backend}/1937150/d87c401e99a94fad9fdc66f7c4a0d9c670b84949/resource.tar.gz#test.test_blocks-filter-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[column_order-union_all_positional-default.txt-Debug]": [
{
"checksum": "b136f637022838dde4e7cd35c37911eb",
diff --git a/yql/essentials/tests/sql/minirun/part5/test.py b/yql/essentials/tests/sql/minirun/part5/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part5/test.py
+++ b/yql/essentials/tests/sql/minirun/part5/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part6/canondata/result.json b/yql/essentials/tests/sql/minirun/part6/canondata/result.json
index 28c8ad4e6e..659875a9f6 100644
--- a/yql/essentials/tests/sql/minirun/part6/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part6/canondata/result.json
@@ -296,6 +296,27 @@
"uri": "file://test.test_bitcast_implicit-mod_bitcast-default.txt-Results_/extracted"
}
],
+ "test.test[blocks-projection_add_ints_filter-default.txt-Debug]": [
+ {
+ "checksum": "0dc7c149ab903b62717b7afe506ab893",
+ "size": 272,
+ "uri": "https://{canondata_backend}/1937492/b366687ca1f092d9cdddb9d6e0cc43bb7c82132d/resource.tar.gz#test.test_blocks-projection_add_ints_filter-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[blocks-projection_add_ints_filter-default.txt-Peephole]": [
+ {
+ "checksum": "f5fb44eaf3fafb816e7d772449908cd6",
+ "size": 851,
+ "uri": "https://{canondata_backend}/1784826/964c3d771c51aa808279a968bec9d2485cb85678/resource.tar.gz#test.test_blocks-projection_add_ints_filter-default.txt-Peephole_/opt.yql"
+ }
+ ],
+ "test.test[blocks-projection_add_ints_filter-default.txt-Results]": [
+ {
+ "checksum": "9912317744ccaa40444b2da1c36a1460",
+ "size": 984,
+ "uri": "https://{canondata_backend}/1937492/b366687ca1f092d9cdddb9d6e0cc43bb7c82132d/resource.tar.gz#test.test_blocks-projection_add_ints_filter-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[coalesce-coalesce_symmetry-default.txt-Debug]": [
{
"checksum": "569b2ea4c0fca80ab9bb30fafa9a1d47",
diff --git a/yql/essentials/tests/sql/minirun/part6/test.py b/yql/essentials/tests/sql/minirun/part6/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part6/test.py
+++ b/yql/essentials/tests/sql/minirun/part6/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part7/test.py b/yql/essentials/tests/sql/minirun/part7/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part7/test.py
+++ b/yql/essentials/tests/sql/minirun/part7/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part8/test.py b/yql/essentials/tests/sql/minirun/part8/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part8/test.py
+++ b/yql/essentials/tests/sql/minirun/part8/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/part9/canondata/result.json b/yql/essentials/tests/sql/minirun/part9/canondata/result.json
index 75d624df78..b6a64220da 100644
--- a/yql/essentials/tests/sql/minirun/part9/canondata/result.json
+++ b/yql/essentials/tests/sql/minirun/part9/canondata/result.json
@@ -167,6 +167,27 @@
"uri": "https://{canondata_backend}/1881367/0904eef9815dbdae5991888c9e683a7d755b2751/resource.tar.gz#test.test_bigdate-tzcasts-default.txt-Results_/results.txt"
}
],
+ "test.test[blocks-projection_add_ints-default.txt-Debug]": [
+ {
+ "checksum": "0dc7c149ab903b62717b7afe506ab893",
+ "size": 272,
+ "uri": "https://{canondata_backend}/1920236/40cada6092366a126340181e3c5021fcb85c3b83/resource.tar.gz#test.test_blocks-projection_add_ints-default.txt-Debug_/opt.yql"
+ }
+ ],
+ "test.test[blocks-projection_add_ints-default.txt-Peephole]": [
+ {
+ "checksum": "7445b50d8d9dbd3e04e6307b079be6a2",
+ "size": 662,
+ "uri": "https://{canondata_backend}/1942525/d498eafe1e3c2e3c1a75f331ab6d923ed8992697/resource.tar.gz#test.test_blocks-projection_add_ints-default.txt-Peephole_/opt.yql"
+ }
+ ],
+ "test.test[blocks-projection_add_ints-default.txt-Results]": [
+ {
+ "checksum": "9912317744ccaa40444b2da1c36a1460",
+ "size": 984,
+ "uri": "https://{canondata_backend}/1920236/40cada6092366a126340181e3c5021fcb85c3b83/resource.tar.gz#test.test_blocks-projection_add_ints-default.txt-Results_/results.txt"
+ }
+ ],
"test.test[case-case_opt_cond-default.txt-Debug]": [
{
"checksum": "4fd4460b8d2584006fe79cb1cb1e538e",
diff --git a/yql/essentials/tests/sql/minirun/part9/test.py b/yql/essentials/tests/sql/minirun/part9/test.py
index 9c41b3dbc7..ab149d4b47 100644
--- a/yql/essentials/tests/sql/minirun/part9/test.py
+++ b/yql/essentials/tests/sql/minirun/part9/test.py
@@ -1,16 +1,14 @@
-import pytest
import yatest
-from pure import run_test, DATA_PATH
+from pure import run_test, DATA_PATH, mode_expander
from test_utils import pytest_generate_tests_for_part
from yql_utils import pytest_get_current_part
def pytest_generate_tests(metafunc):
current_part, part_count = pytest_get_current_part(yatest.common.source_path(__file__))
- return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH)
+ return pytest_generate_tests_for_part(metafunc, current_part, part_count, data_path=DATA_PATH, mode_expander=mode_expander)
-@pytest.mark.parametrize('what', ['Results', 'Debug', 'RunOnOpt', 'LLVM'])
-def test(suite, case, cfg, tmpdir, what, yql_http_file_server):
+def test(suite, case, cfg, what, tmpdir, yql_http_file_server):
return run_test(suite, case, cfg, tmpdir, what, yql_http_file_server)
diff --git a/yql/essentials/tests/sql/minirun/pure.py b/yql/essentials/tests/sql/minirun/pure.py
index ea5949f698..4c92d6fee5 100644
--- a/yql/essentials/tests/sql/minirun/pure.py
+++ b/yql/essentials/tests/sql/minirun/pure.py
@@ -20,8 +20,21 @@ ASTDIFF_PATH = yql_binary_path('yql/essentials/tools/astdiff/astdiff')
MINIRUN_PATH = yql_binary_path('yql/essentials/tools/minirun/minirun')
+def mode_expander(lst):
+ res = []
+ for (suite, case, cfg) in lst:
+ res.append((suite, case, cfg, 'Results'))
+ res.append((suite, case, cfg, 'Debug'))
+ res.append((suite, case, cfg, 'RunOnOpt'))
+ res.append((suite, case, cfg, 'LLVM'))
+ if suite == 'blocks':
+ res.append((suite, case, cfg, 'Blocks'))
+ res.append((suite, case, cfg, 'Peephole'))
+ return res
+
+
def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
- if get_gateway_cfg_suffix() != '' and what not in ('Results','LLVM'):
+ if get_gateway_cfg_suffix() != '' and what not in ('Results','LLVM','Blocks'):
pytest.skip('non-trivial gateways.conf')
config = get_config(suite, case, cfg, data_path = DATA_PATH)
@@ -44,6 +57,19 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
assert xfail or os.path.exists(res.results_file)
assert not tables_res
+ if what == 'Peephole':
+ canonize_peephole = is_canonize_peephole(config)
+ if not canonize_peephole:
+ canonize_peephole = re.search(r"canonize peephole", sql_query)
+ if not canonize_peephole:
+ pytest.skip('no peephole canonization requested')
+
+ force_blocks = is_peephole_use_blocks(config)
+ (res, tables_res) = run_file_no_cache('pure', suite, case, cfg, config, yql_http_file_server,
+ force_blocks=force_blocks, extra_args=['--peephole'],
+ data_path=DATA_PATH, yqlrun_binary=MINIRUN_PATH)
+ return [yatest.common.canonical_file(res.opt_file, diff_tool=ASTDIFF_PATH)]
+
if what == 'Results':
if xfail:
return None
@@ -59,26 +85,28 @@ def run_test(suite, case, cfg, tmpdir, what, yql_http_file_server):
if what == 'Debug':
to_canonize = [yatest.common.canonical_file(res.opt_file, diff_tool=ASTDIFF_PATH)]
- if what == 'RunOnOpt' or what == 'LLVM':
+ if what == 'RunOnOpt' or what == 'LLVM' or what == 'Blocks':
+ is_on_opt = (what == 'RunOnOpt')
is_llvm = (what == 'LLVM')
+ is_blocks = (what == 'Blocks')
files = get_files(suite, config, DATA_PATH)
http_files = get_http_files(suite, config, DATA_PATH)
http_files_urls = yql_http_file_server.register_files({}, http_files)
parameters = get_parameters_json(suite, config, DATA_PATH)
- query_sql = get_sql_query('pure', suite, case, config, DATA_PATH) if is_llvm else None
+ query_sql = get_sql_query('pure', suite, case, config, DATA_PATH) if not is_on_opt else None
yqlrun = YQLRun(
prov='pure',
keep_temp=False,
- gateway_config=get_gateways_config(http_files, yql_http_file_server, allow_llvm=is_llvm),
+ gateway_config=get_gateways_config(http_files, yql_http_file_server, allow_llvm=is_llvm, force_blocks=is_blocks),
udfs_dir=yql_binary_path('yql/essentials/tests/common/test_framework/udfs_deps'),
binary=MINIRUN_PATH
)
opt_res, opt_tables_res = execute(
yqlrun,
- program=res.opt if not is_llvm else query_sql,
- run_sql=is_llvm,
+ program=res.opt if is_on_opt else query_sql,
+ run_sql=not is_on_opt,
files=files,
urls=http_files_urls,
check_error=True,
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json
index 7cb5c7d39c..f4fa3afe61 100644
--- a/yql/essentials/tests/sql/sql2yql/canondata/result.json
+++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json
@@ -1301,6 +1301,34 @@
"uri": "https://{canondata_backend}/1942173/99e88108149e222741552e7e6cddef041d6a2846/resource.tar.gz#test_sql2yql.test_bitcast_implicit-sub_bitcast_/sql.yql"
}
],
+ "test_sql2yql.test[blocks-empty_as_table]": [
+ {
+ "checksum": "bbda02d622e3f3c4f698ea1962d9f902",
+ "size": 1184,
+ "uri": "https://{canondata_backend}/1130705/7bfa4c7bef8ecf6ffba8b79d210708dc39bab04e/resource.tar.gz#test_sql2yql.test_blocks-empty_as_table_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[blocks-filter]": [
+ {
+ "checksum": "e09ada2d8790a1c8d43bdc76683eaa40",
+ "size": 1194,
+ "uri": "https://{canondata_backend}/1130705/7bfa4c7bef8ecf6ffba8b79d210708dc39bab04e/resource.tar.gz#test_sql2yql.test_blocks-filter_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[blocks-projection_add_ints]": [
+ {
+ "checksum": "f84fc85138d4f1d4b72cf4d37a2b8ff2",
+ "size": 1253,
+ "uri": "https://{canondata_backend}/1130705/7bfa4c7bef8ecf6ffba8b79d210708dc39bab04e/resource.tar.gz#test_sql2yql.test_blocks-projection_add_ints_/sql.yql"
+ }
+ ],
+ "test_sql2yql.test[blocks-projection_add_ints_filter]": [
+ {
+ "checksum": "536842d82fabe43f225eb25b37589b8b",
+ "size": 1372,
+ "uri": "https://{canondata_backend}/1130705/7bfa4c7bef8ecf6ffba8b79d210708dc39bab04e/resource.tar.gz#test_sql2yql.test_blocks-projection_add_ints_filter_/sql.yql"
+ }
+ ],
"test_sql2yql.test[case-case_many_val]": [
{
"checksum": "70c9fb3c41da9a56ff7346cfe50d2c82",
@@ -7719,6 +7747,26 @@
"uri": "file://test_sql_format.test_bitcast_implicit-sub_bitcast_/formatted.sql"
}
],
+ "test_sql_format.test[blocks-empty_as_table]": [
+ {
+ "uri": "file://test_sql_format.test_blocks-empty_as_table_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[blocks-filter]": [
+ {
+ "uri": "file://test_sql_format.test_blocks-filter_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[blocks-projection_add_ints]": [
+ {
+ "uri": "file://test_sql_format.test_blocks-projection_add_ints_/formatted.sql"
+ }
+ ],
+ "test_sql_format.test[blocks-projection_add_ints_filter]": [
+ {
+ "uri": "file://test_sql_format.test_blocks-projection_add_ints_filter_/formatted.sql"
+ }
+ ],
"test_sql_format.test[case-case_many_val]": [
{
"uri": "file://test_sql_format.test_case-case_many_val_/formatted.sql"
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-empty_as_table_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-empty_as_table_/formatted.sql
new file mode 100644
index 0000000000..452855f138
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-empty_as_table_/formatted.sql
@@ -0,0 +1,6 @@
+SELECT
+ key,
+ subkey + 1
+FROM
+ as_table([])
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-filter_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-filter_/formatted.sql
new file mode 100644
index 0000000000..2e0851b810
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-filter_/formatted.sql
@@ -0,0 +1,7 @@
+SELECT
+ *
+FROM
+ as_table([<|key: 1, subkey: 2|>])
+WHERE
+ key == 1
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_/formatted.sql
new file mode 100644
index 0000000000..e82a3b8e39
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_/formatted.sql
@@ -0,0 +1,6 @@
+SELECT
+ key,
+ subkey + 1
+FROM
+ as_table([<|key: 1, subkey: 2|>])
+;
diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_filter_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_filter_/formatted.sql
new file mode 100644
index 0000000000..a0896a8cff
--- /dev/null
+++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_blocks-projection_add_ints_filter_/formatted.sql
@@ -0,0 +1,8 @@
+SELECT
+ key,
+ subkey + 1
+FROM
+ as_table([<|key: 1, subkey: 2|>])
+WHERE
+ key == 1
+;
diff --git a/yql/essentials/tests/sql/suites/blocks/default.cfg b/yql/essentials/tests/sql/suites/blocks/default.cfg
new file mode 100644
index 0000000000..e1a8164dc6
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/blocks/default.cfg
@@ -0,0 +1,2 @@
+canonize_peephole
+peephole_use_blocks
diff --git a/yql/essentials/tests/sql/suites/blocks/empty_as_table.sql b/yql/essentials/tests/sql/suites/blocks/empty_as_table.sql
new file mode 100644
index 0000000000..efec8c3a6f
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/blocks/empty_as_table.sql
@@ -0,0 +1 @@
+select key,subkey+1 from as_table([]);
diff --git a/yql/essentials/tests/sql/suites/blocks/filter.sql b/yql/essentials/tests/sql/suites/blocks/filter.sql
new file mode 100644
index 0000000000..16a7dee89e
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/blocks/filter.sql
@@ -0,0 +1 @@
+select * from as_table([<|key:1,subkey:2|>]) where key == 1
diff --git a/yql/essentials/tests/sql/suites/blocks/projection_add_ints.sql b/yql/essentials/tests/sql/suites/blocks/projection_add_ints.sql
new file mode 100644
index 0000000000..7fab7d7e80
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/blocks/projection_add_ints.sql
@@ -0,0 +1 @@
+select key,subkey+1 from as_table([<|key:1,subkey:2|>])
diff --git a/yql/essentials/tests/sql/suites/blocks/projection_add_ints_filter.sql b/yql/essentials/tests/sql/suites/blocks/projection_add_ints_filter.sql
new file mode 100644
index 0000000000..d31a88bf9b
--- /dev/null
+++ b/yql/essentials/tests/sql/suites/blocks/projection_add_ints_filter.sql
@@ -0,0 +1,2 @@
+select key,subkey+1 from as_table([<|key:1,subkey:2|>]) where key == 1
+
diff --git a/yt/yql/tests/sql/suites/produce/process_multi_in_trivial_lambda.cfg b/yt/yql/tests/sql/suites/produce/process_multi_in_trivial_lambda.cfg
index 4468d3ba29..382d5772af 100644
--- a/yt/yql/tests/sql/suites/produce/process_multi_in_trivial_lambda.cfg
+++ b/yt/yql/tests/sql/suites/produce/process_multi_in_trivial_lambda.cfg
@@ -1,2 +1,4 @@
in Input input0.txt
res result.txt
+providers yt
+