Skip to content

Commit

Permalink
Merge d38a59f into a2eb383
Browse files Browse the repository at this point in the history
  • Loading branch information
spuchin authored Feb 6, 2024
2 parents a2eb383 + d38a59f commit 87915d9
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <ydb/library/yql/dq/opt/dq_opt_peephole.h>
#include <ydb/library/yql/core/services/yql_transform_pipeline.h>
#include <ydb/library/yql/providers/common/transform/yql_optimize.h>
#include <ydb/library/yql/minikql/mkql_runtime_version.h>

#include <util/generic/size_literals.h>
#include <util/string/cast.h>
Expand Down Expand Up @@ -181,6 +182,10 @@ class TKqpPeepholeFinalTransformer : public TOptimizeTransformerBase {
}
private:
TMaybeNode<TExprBase> SetCombinerMemoryLimit(TExprBase node, TExprContext& ctx) {
if (NMiniKQL::RuntimeVersion < 46U) {
return node;
}

if (const auto limit = node.Ref().Child(TCoWideCombiner::idx_MemLimit); limit->IsAtom("0")) {
if (const auto limitSetting = Config->_KqpYqlCombinerMemoryLimit.Get(); limitSetting && *limitSetting) {
return ctx.ChangeChild(node.Ref(), TCoWideCombiner::idx_MemLimit, ctx.RenameNode(*limit, ToString(-i64(*limitSetting))));
Expand Down
5 changes: 5 additions & 0 deletions ydb/library/yql/minikql/comp_nodes/ut/mkql_blocks_ut.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "mkql_computation_node_ut.h"

#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders.h>
#include <ydb/library/yql/minikql/mkql_runtime_version.h>

#include <arrow/compute/exec_internal.h>
#include <arrow/array/builder_primitive.h>
Expand Down Expand Up @@ -264,6 +265,10 @@ Y_UNIT_TEST(TestScalar) {
}

Y_UNIT_TEST_LLVM(TestReplicateScalar) {
if (RuntimeVersion < 43u) {
return;
}

const ui64 count = 1000;
const ui32 value = 42;

Expand Down
19 changes: 17 additions & 2 deletions ydb/library/yql/minikql/comp_nodes/ut/mkql_wide_combine_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ TRuntimeNode Combine(TProgramBuilder& pb, TRuntimeNode stream, std::function<TRu
#if !defined(MKQL_RUNTIME_VERSION) || MKQL_RUNTIME_VERSION >= 18u
Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerTest) {
Y_UNIT_TEST_LLVM(TestLongStringsRefCounting) {
if (RuntimeVersion < 46u) {
return;
}

TSetup<LLVM> setup;
TProgramBuilder& pb = *setup.PgmBuilder;

Expand Down Expand Up @@ -199,6 +203,10 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerTest) {
}

Y_UNIT_TEST_LLVM(TestLongStringsPasstroughtRefCounting) {
if (RuntimeVersion < 46u) {
return;
}

TSetup<LLVM> setup;
TProgramBuilder& pb = *setup.PgmBuilder;

Expand Down Expand Up @@ -274,6 +282,10 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerTest) {
}

Y_UNIT_TEST_LLVM(TestDoNotCalculateUnusedInput) {
if (RuntimeVersion < 46u) {
return;
}

TSetup<LLVM> setup;
TProgramBuilder& pb = *setup.PgmBuilder;

Expand Down Expand Up @@ -427,8 +439,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerTest) {
UNIT_ASSERT(!iterator.Next(item));
UNIT_ASSERT(!iterator.Next(item));
}
#if !defined(MKQL_RUNTIME_VERSION) || MKQL_RUNTIME_VERSION >= 46u

Y_UNIT_TEST_LLVM(TestHasLimitButPasstroughtYields) {
if (RuntimeVersion < 46u) {
return;
}

TSetup<LLVM> setup(GetNodeFactory());
TProgramBuilder& pb = *setup.PgmBuilder;

Expand Down Expand Up @@ -458,7 +474,6 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerTest) {
UNIT_ASSERT_EQUAL(streamVal.Fetch(result), NUdf::EFetchStatus::Finish);
UNIT_ASSERT_EQUAL(streamVal.Fetch(result), NUdf::EFetchStatus::Finish);
}
#endif
}

Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerPerfTest) {
Expand Down
16 changes: 10 additions & 6 deletions ydb/library/yql/minikql/mkql_program_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5493,9 +5493,11 @@ TRuntimeNode TProgramBuilder::PgConst(TPgType* pgType, const std::string_view& v
TRuntimeNode TProgramBuilder::PgResolvedCall(bool useContext, const std::string_view& name,
ui32 id, const TArrayRef<const TRuntimeNode>& args,
TType* returnType, bool rangeFunction) {
if constexpr (RuntimeVersion < 45U) {
THROW yexception() << "Runtime version (" << RuntimeVersion << ") too old for " << __func__;
}

// Disable runtime compatibility checks for PG callables in 24-1
// if constexpr (RuntimeVersion < 45U) {
// THROW yexception() << "Runtime version (" << RuntimeVersion << ") too old for " << __func__;
// }

TCallableBuilder callableBuilder(Env, __func__, returnType);
callableBuilder.Add(NewDataLiteral(useContext));
Expand Down Expand Up @@ -5540,9 +5542,11 @@ TRuntimeNode TProgramBuilder::PgTableContent(
const std::string_view& cluster,
const std::string_view& table,
TType* returnType) {
if constexpr (RuntimeVersion < 47U) {
THROW yexception() << "Runtime version (" << RuntimeVersion << ") too old for " << __func__;
}

// Disable runtime compatibility checks for PG callables in 24-1
// if constexpr (RuntimeVersion < 47U) {
// THROW yexception() << "Runtime version (" << RuntimeVersion << ") too old for " << __func__;
// }

TCallableBuilder callableBuilder(Env, __func__, returnType);
callableBuilder.Add(NewDataLiteral<NUdf::EDataSlot::String>(cluster));
Expand Down
12 changes: 11 additions & 1 deletion ydb/library/yql/minikql/mkql_runtime_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,22 @@ namespace NMiniKQL {
// 1. Bump this version every time incompatible runtime nodes are introduced.
// 2. Make sure you provide runtime node generation for previous runtime versions.
#ifndef MKQL_RUNTIME_VERSION
#define MKQL_RUNTIME_VERSION 47U
#define MKQL_RUNTIME_VERSION 39U
#endif

// History:
// v4 is the version supported by kikimr-19-6
// v14 is the version supported by kikimr-20-2
// v14 is the version supported by kikimr-20-2
// v21 is the version supported by kikimr-20-4
// v21 is the version supported by kikimr-20-6
// v23 is the version supported by kikimr-21-2
// v24 is the version supported by kikimr-21-4
// v29 is the version supported by kikimr-22-2
// v30 is the version supported by kikimr-22-4
// v32 is the version supported by kikimr-23-1
// v39 is the version supported by kikimr-23-3
// v47 is the version supported by kikimr-24-1
constexpr ui32 RuntimeVersion = MKQL_RUNTIME_VERSION;

}
Expand Down
6 changes: 6 additions & 0 deletions ydb/library/yql/tests/s-expressions/common_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def yqlrun_yt_results(provider, prepare, suite, case, config):


def run_test(provider, prepare, suite, case, tmpdir, what):
if "TimeOrder" in suite:
pytest.skip('Unsupported in runtime version v39')

if "SelfJoinCore" in case:
pytest.skip('Unsupported in runtime version v39')

if get_param('TARGET_PLATFORM'):
if "ArcPython" in case:
pytest.skip('ArcPython is not supported on non-default target platform')
Expand Down

0 comments on commit 87915d9

Please sign in to comment.