diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-10-18 18:13:34 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-10-18 19:20:20 +0300 |
commit | ed55bf34e65328a11565c38ed5cf94edf59e357a (patch) | |
tree | a5f77a76d14c3d2553c5d74a59203417d4a846a8 | |
parent | 615b972d0ce6b5182ca349034e367e281025b2bd (diff) | |
download | ydb-ed55bf34e65328a11565c38ed5cf94edf59e357a.tar.gz |
YQL-15891 Drop BlockExtend.
20 files changed, 3 insertions, 329 deletions
diff --git a/ydb/library/yql/core/type_ann/type_ann_blocks.cpp b/ydb/library/yql/core/type_ann/type_ann_blocks.cpp index 716d015fd7..5cba38ac71 100644 --- a/ydb/library/yql/core/type_ann/type_ann_blocks.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_blocks.cpp @@ -409,9 +409,9 @@ IGraphTransformer::TStatus BlockToPgWrapper(const TExprNode::TPtr& input, TExprN } else { resultType = ctx.Expr.MakeType<TBlockExprType>(resultType); } - + input->SetTypeAnn(resultType); - return IGraphTransformer::TStatus::Ok; + return IGraphTransformer::TStatus::Ok; } IGraphTransformer::TStatus BlockFromPgWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { @@ -1019,51 +1019,5 @@ IGraphTransformer::TStatus BlockPgCallWrapper(const TExprNode::TPtr& input, TExp return IGraphTransformer::TStatus::Ok; } -IGraphTransformer::TStatus BlockExtendWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { - Y_UNUSED(output); - if (!EnsureMinArgsCount(*input, 1, ctx.Expr)) { - return IGraphTransformer::TStatus::Error; - } - - TTypeAnnotationNode::TListType commonItemTypes; - for (size_t idx = 0; idx < input->ChildrenSize(); ++idx) { - auto child = input->Child(idx); - TTypeAnnotationNode::TListType currentItemTypes; - if (!EnsureWideFlowBlockType(*child, idx ? currentItemTypes : commonItemTypes, ctx.Expr)) { - return IGraphTransformer::TStatus::Error; - } - - if (idx == 0) { - continue; - } - - if (currentItemTypes.size() != commonItemTypes.size()) { - ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(child->Pos()), - TStringBuilder() << "Expected same width ( " << commonItemTypes.size() << ") on all inputs, but got: " << *child->GetTypeAnn() << " on input #" << idx)); - return IGraphTransformer::TStatus::Error; - } - - - for (size_t i = 0; i < currentItemTypes.size(); ++i) { - if (!IsSameAnnotation(*currentItemTypes[i], *commonItemTypes[i])) { - ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(child->Pos()), - TStringBuilder() << "Expected item type " << *commonItemTypes[i] << " at column #" << i << " on input #" << idx << ", but got : " << *currentItemTypes[i])); - return IGraphTransformer::TStatus::Error; - } - } - } - - TTypeAnnotationNode::TListType resultItemTypes; - for (size_t i = 0; i < commonItemTypes.size(); ++i) { - if (i + 1 == commonItemTypes.size()) { - resultItemTypes.emplace_back(ctx.Expr.MakeType<TScalarExprType>(commonItemTypes[i])); - } else { - resultItemTypes.emplace_back(ctx.Expr.MakeType<TBlockExprType>(commonItemTypes[i])); - } - } - input->SetTypeAnn(ctx.Expr.MakeType<TFlowExprType>(ctx.Expr.MakeType<TMultiExprType>(std::move(resultItemTypes)))); - return IGraphTransformer::TStatus::Ok; -} - } // namespace NTypeAnnImpl } diff --git a/ydb/library/yql/core/type_ann/type_ann_blocks.h b/ydb/library/yql/core/type_ann/type_ann_blocks.h index bf8da3edae..c6da40f539 100644 --- a/ydb/library/yql/core/type_ann/type_ann_blocks.h +++ b/ydb/library/yql/core/type_ann/type_ann_blocks.h @@ -32,7 +32,6 @@ namespace NTypeAnnImpl { IGraphTransformer::TStatus WideSortBlocksWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus BlockPgOpWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus BlockPgCallWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); - IGraphTransformer::TStatus BlockExtendWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); } // namespace NTypeAnnImpl } // namespace NYql diff --git a/ydb/library/yql/core/type_ann/type_ann_core.cpp b/ydb/library/yql/core/type_ann/type_ann_core.cpp index 8d09694f07..085a288b87 100644 --- a/ydb/library/yql/core/type_ann/type_ann_core.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_core.cpp @@ -12087,7 +12087,6 @@ template <NKikimr::NUdf::EDataSlot DataSlot> Functions["WideTopBlocks"] = &WideTopBlocksWrapper; Functions["WideTopSortBlocks"] = &WideTopBlocksWrapper; Functions["WideSortBlocks"] = &WideSortBlocksWrapper; - Functions["BlockExtend"] = &BlockExtendWrapper; Functions["BlockCoalesce"] = &BlockCoalesceWrapper; Functions["BlockAnd"] = &BlockLogicalWrapper; diff --git a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.darwin-x86_64.txt index dc27481050..579b8f9818 100644 --- a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.darwin-x86_64.txt +++ b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.darwin-x86_64.txt @@ -45,7 +45,6 @@ target_sources(minikql-comp_nodes-llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-aarch64.txt b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-aarch64.txt index 89b03f6ddc..3228f13982 100644 --- a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-aarch64.txt @@ -46,7 +46,6 @@ target_sources(minikql-comp_nodes-llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-x86_64.txt b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-x86_64.txt index 89b03f6ddc..3228f13982 100644 --- a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-x86_64.txt +++ b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.linux-x86_64.txt @@ -46,7 +46,6 @@ target_sources(minikql-comp_nodes-llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.windows-x86_64.txt b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.windows-x86_64.txt index dc27481050..579b8f9818 100644 --- a/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.windows-x86_64.txt +++ b/ydb/library/yql/minikql/comp_nodes/llvm/CMakeLists.windows-x86_64.txt @@ -45,7 +45,6 @@ target_sources(minikql-comp_nodes-llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp deleted file mode 100644 index 2087767cd5..0000000000 --- a/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "mkql_block_extend.h" - -#include <ydb/library/yql/minikql/computation/mkql_block_builder.h> -#include <ydb/library/yql/minikql/computation/mkql_block_impl.h> -#include <ydb/library/yql/minikql/computation/mkql_block_reader.h> -#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders.h> -#include <ydb/library/yql/minikql/mkql_node_cast.h> - -namespace NKikimr { -namespace NMiniKQL { - -namespace { - -class TExtendBlocks : public TStatefulWideFlowBlockComputationNode<TExtendBlocks> { -public: - TExtendBlocks(TComputationMutables& mutables, TVector<IComputationWideFlowNode*>&& flows, TVector<TType*>&& types) - : TStatefulWideFlowBlockComputationNode(mutables, this, types.size()) - , Flows_(std::move(flows)) - , Types_(std::move(types)) - , Width_(Types_.size()) - { - } - - EFetchResult DoCalculate(NUdf::TUnboxedValue& state, TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const - { - auto& s = GetState(state, ctx, output); - - size_t yieldCount = 0; - while (s.LiveInputs) { - Y_DEBUG_ABORT_UNLESS(s.InputIndex < s.LiveInputs); - EFetchResult result = s.Inputs[s.InputIndex]->FetchValues(ctx, output); - yieldCount = (result == EFetchResult::Yield) ? (yieldCount + 1) : 0; - if (result == EFetchResult::Finish) { - std::swap(s.Inputs[s.InputIndex], s.Inputs[--s.LiveInputs]); - s.NextInput(); - continue; - } - if (result == EFetchResult::Yield) { - s.NextInput(); - if (yieldCount == s.LiveInputs) { - return result; - } - continue; - } - - MKQL_ENSURE_S(output[Width_ - 1]); - const ui64 len = TArrowBlock::From(*output[Width_ - 1]).GetDatum().scalar_as<arrow::UInt64Scalar>().value; - for (ui32 i = 0; i + 1 < Width_; ++i) { - if (s.Builders[i]) { - MKQL_ENSURE_S(output[i]); - auto datum = TArrowBlock::From(*output[i]).GetDatum(); - if (datum.is_scalar()) { - TBlockItem item = s.Readers[i]->GetScalarItem(*datum.scalar()); - s.Builders[i]->Add(item, len); - *output[i] = ctx.HolderFactory.CreateArrowBlock(s.Builders[i]->Build(false)); - } - } - } - s.NextInput(); - return result; - } - return EFetchResult::Finish; - } -private: - struct TState : public TComputationValue<TState> { - TVector<IComputationWideFlowNode*> Inputs; - size_t LiveInputs; - size_t InputIndex = 0; - TVector<std::unique_ptr<IArrayBuilder>> Builders; - TVector<std::unique_ptr<IBlockReader>> Readers; - - TState(TMemoryUsageInfo* memInfo, const TVector<IComputationWideFlowNode*>& inputs, ui32 width, NUdf::TUnboxedValue*const* output, const TVector<TType*>& types, - arrow::MemoryPool& pool, const NUdf::IPgBuilder& pgBuilder) - : TComputationValue(memInfo) - , Inputs(inputs) - , LiveInputs(Inputs.size()) - , Builders(width) - , Readers(width) - { - TTypeInfoHelper helper; - for (ui32 i = 0; i < width; ++i) { - if (output[i] && i + 1 != width) { - Builders[i] = MakeArrayBuilder(helper, types[i], pool, helper.GetMaxBlockLength(types[i]), &pgBuilder); - Readers[i] = MakeBlockReader(helper, types[i]); - } - } - } - - void NextInput() { - if (++InputIndex >= LiveInputs) { - InputIndex = 0; - } - } - }; - - void RegisterDependencies() const final { - for (auto& flow : Flows_) { - FlowDependsOn(flow); - } - } - - TState& GetState(NUdf::TUnboxedValue& state, TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const { - if (!state.HasValue()) { - state = ctx.HolderFactory.Create<TState>(Flows_, Width_, output, Types_, ctx.ArrowMemoryPool, ctx.Builder->GetPgBuilder()); - } - return *static_cast<TState*>(state.AsBoxed().Get()); - } - -private: - const TVector<IComputationWideFlowNode*> Flows_; - const TVector<TType*> Types_; - const ui32 Width_; -}; - -} // namespace - -IComputationNode* WrapBlockExtend(TCallable& callable, const TComputationNodeFactoryContext& ctx) { - MKQL_ENSURE(callable.GetInputsCount() > 0, "Expected at least 1 arg"); - - const auto flowType = AS_TYPE(TFlowType, callable.GetType()->GetReturnType()); - const auto wideComponents = GetWideComponents(flowType); - const ui32 width = wideComponents.size(); - MKQL_ENSURE(width > 0, "Expected at least one column"); - - TVector<TType*> types; - for (auto& type : wideComponents) { - types.emplace_back(AS_TYPE(TBlockType, type)->GetItemType()); - } - - TVector<IComputationWideFlowNode*> flows; - for (ui32 i = 0; i < callable.GetInputsCount(); ++i) { - auto wideFlow = dynamic_cast<IComputationWideFlowNode*>(LocateNode(ctx.NodeLocator, callable, i)); - MKQL_ENSURE(wideFlow != nullptr, "Expected wide flow node"); - flows.emplace_back(wideFlow); - } - - return new TExtendBlocks(ctx.Mutables, std::move(flows), std::move(types)); -} - - -} // namespace NMiniKQL -} // namespace NKikimr diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.h b/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.h deleted file mode 100644 index 5d918374b7..0000000000 --- a/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include <ydb/library/yql/minikql/computation/mkql_computation_node.h> - -namespace NKikimr { -namespace NMiniKQL { - -IComputationNode* WrapBlockExtend(TCallable& callable, const TComputationNodeFactoryContext& ctx); - -} -} diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_factory.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_factory.cpp index ae399ab237..3a3cbc4fd3 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_factory.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_factory.cpp @@ -12,7 +12,6 @@ #include "mkql_block_just.h" #include "mkql_block_logical.h" #include "mkql_block_compress.h" -#include "mkql_block_extend.h" #include "mkql_block_skiptake.h" #include "mkql_block_top.h" #include "mkql_block_tuple.h" @@ -295,7 +294,6 @@ struct TCallableComputationNodeBuilderFuncMapFiller { {"BlockNot", &WrapBlockNot}, {"BlockJust", &WrapBlockJust}, {"BlockCompress", &WrapBlockCompress}, - {"BlockExtend", &WrapBlockExtend}, {"BlockAsTuple", &WrapBlockAsTuple}, {"BlockNth", &WrapBlockNth}, {"BlockExpandChunked", &WrapBlockExpandChunked}, diff --git a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.darwin-x86_64.txt b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.darwin-x86_64.txt index 347f6329ce..7b6d08710e 100644 --- a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.darwin-x86_64.txt +++ b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.darwin-x86_64.txt @@ -41,7 +41,6 @@ target_sources(minikql-comp_nodes-no_llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-aarch64.txt b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-aarch64.txt index bd688d3e32..ab66666b8f 100644 --- a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-aarch64.txt @@ -42,7 +42,6 @@ target_sources(minikql-comp_nodes-no_llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-x86_64.txt b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-x86_64.txt index bd688d3e32..ab66666b8f 100644 --- a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-x86_64.txt +++ b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.linux-x86_64.txt @@ -42,7 +42,6 @@ target_sources(minikql-comp_nodes-no_llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.windows-x86_64.txt b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.windows-x86_64.txt index 347f6329ce..7b6d08710e 100644 --- a/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.windows-x86_64.txt +++ b/ydb/library/yql/minikql/comp_nodes/no_llvm/CMakeLists.windows-x86_64.txt @@ -41,7 +41,6 @@ target_sources(minikql-comp_nodes-no_llvm PRIVATE ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_some.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_agg_sum.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_coalesce.cpp - ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_extend.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_if.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_just.cpp ${CMAKE_SOURCE_DIR}/ydb/library/yql/minikql/comp_nodes/mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/comp_nodes/ya.make.inc b/ydb/library/yql/minikql/comp_nodes/ya.make.inc index 3bf3e141db..0b3c73ca90 100644 --- a/ydb/library/yql/minikql/comp_nodes/ya.make.inc +++ b/ydb/library/yql/minikql/comp_nodes/ya.make.inc @@ -12,7 +12,6 @@ SRCS( mkql_block_agg_some.cpp mkql_block_agg_sum.cpp mkql_block_coalesce.cpp - mkql_block_extend.cpp mkql_block_if.cpp mkql_block_just.cpp mkql_block_logical.cpp diff --git a/ydb/library/yql/minikql/computation/mkql_block_impl.cpp b/ydb/library/yql/minikql/computation/mkql_block_impl.cpp index 917fc00b8b..45027be661 100644 --- a/ydb/library/yql/minikql/computation/mkql_block_impl.cpp +++ b/ydb/library/yql/minikql/computation/mkql_block_impl.cpp @@ -336,13 +336,4 @@ NUdf::TUnboxedValuePod TBlockState::Get(const ui64 sliceSize, const THolderFacto return Values[idx]; } -void TBlockState::FillOutputs(TComputationContext& ctx, NUdf::TUnboxedValue*const* output) { - const auto sliceSize = Slice(); - for (size_t i = 0; i < Values.size(); ++i) { - if (const auto out = output[i]) { - *out = Get(sliceSize, ctx.HolderFactory, i); - } - } -} - } diff --git a/ydb/library/yql/minikql/computation/mkql_block_impl.h b/ydb/library/yql/minikql/computation/mkql_block_impl.h index 32e5689c1c..b081d9f573 100644 --- a/ydb/library/yql/minikql/computation/mkql_block_impl.h +++ b/ydb/library/yql/minikql/computation/mkql_block_impl.h @@ -108,8 +108,6 @@ struct TBlockState : public TComputationValue<TBlockState> { ui64 Slice(); NUdf::TUnboxedValuePod Get(const ui64 sliceSize, const THolderFactory& holderFactory, const size_t idx) const; - - void FillOutputs(TComputationContext& ctx, NUdf::TUnboxedValue*const* output); }; #ifndef MKQL_DISABLE_CODEGEN class TLLVMFieldsStructureBlockState: public TLLVMFieldsStructure<TComputationValue<TBlockState>> { @@ -146,75 +144,4 @@ struct TBlockState : public TComputationValue<TBlockState> { {} }; #endif -template <typename TDerived> -class TStatefulWideFlowBlockComputationNode: public TWideFlowBaseComputationNode<TDerived> -{ -protected: - TStatefulWideFlowBlockComputationNode(TComputationMutables& mutables, const IComputationNode* source, ui32 width) - : TWideFlowBaseComputationNode<TDerived>(source) - , StateIndex(mutables.CurValueIndex++) - , StateKind(EValueRepresentation::Boxed) - , Width(width) - , WideFieldsIndex(mutables.IncrementWideFieldsIndex(width)) - { - MKQL_ENSURE(width > 0, "Wide flow blocks should have at least one column (block length)"); - } -private: - struct TState : public TBlockState { - NUdf::TUnboxedValue ChildState; - - TState(TMemoryUsageInfo* memInfo, size_t width, ui32 wideFieldsIndex, NUdf::TUnboxedValue*const* values, TComputationContext& ctx) - : TBlockState(memInfo, width) - { - auto**const fields = ctx.WideFields.data() + wideFieldsIndex; - for (size_t i = 0; i < width - 1; ++i) { - fields[i] = values[i] ? &Values[i] : nullptr; - } - fields[width - 1] = &Values.back(); - } - }; - - TState& GetState(TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const { - auto& state = ctx.MutableValues[GetIndex()]; - if (!state.HasValue()) { - state = ctx.HolderFactory.Create<TState>(Width, WideFieldsIndex, output, ctx); - } - return *static_cast<TState*>(state.AsBoxed().Get()); - } - - EFetchResult FetchValues(TComputationContext& ctx, NUdf::TUnboxedValue*const* output) const final { - auto& s = GetState(ctx, output); - const auto fields = ctx.WideFields.data() + WideFieldsIndex; - while (s.Count == 0) { - s.Values.assign(s.Values.size(), NUdf::TUnboxedValuePod()); - if (const auto result = static_cast<const TDerived*>(this)->DoCalculate(s.ChildState, ctx, fields); result != EFetchResult::One) { - return result; - } - s.FillArrays(); - } - - s.FillOutputs(ctx, output); - return EFetchResult::One; - } - - ui32 GetIndex() const final { - return StateIndex; - } - - void CollectDependentIndexes(const IComputationNode* owner, IComputationNode::TIndexesMap& dependencies) const final { - if (this == owner) - return; - - const auto ins = dependencies.emplace(StateIndex, StateKind); - if (ins.second && this->Dependence) { - this->Dependence->CollectDependentIndexes(owner, dependencies); - } - } -protected: - const ui32 StateIndex; - const EValueRepresentation StateKind; - const ui32 Width; - const ui32 WideFieldsIndex; -}; - } //namespace NKikimr::NMiniKQL diff --git a/ydb/library/yql/minikql/mkql_program_builder.cpp b/ydb/library/yql/minikql/mkql_program_builder.cpp index 84541251f4..28f8ae5c6f 100644 --- a/ydb/library/yql/minikql/mkql_program_builder.cpp +++ b/ydb/library/yql/minikql/mkql_program_builder.cpp @@ -1526,36 +1526,6 @@ TRuntimeNode TProgramBuilder::ReplicateScalar(TRuntimeNode value, TRuntimeNode c return TRuntimeNode(callableBuilder.Build(), false); } -TRuntimeNode TProgramBuilder::BlockExtend(const TArrayRef<const TRuntimeNode>& args) { - MKQL_ENSURE(!args.empty(), "Expected at least one argument"); - - TVector<TType*> types; - for (const auto& arg : args) { - auto currentTypes = ValidateBlockFlowType(arg.GetStaticType()); - MKQL_ENSURE(!currentTypes.empty(), "Wide block flow should have at least one component"); - if (types.empty()) { - types.assign(currentTypes.begin(), currentTypes.end()); - continue; - } - MKQL_ENSURE(currentTypes.size() == types.size(), "All arguments should have same width"); - for (size_t i = 0; i < currentTypes.size(); ++i) { - MKQL_ENSURE(currentTypes[i]->IsSameType(*types[i]), "Item types mismatch"); - } - } - - for (ui32 i = 0; i < types.size(); ++i) { - types[i] = NewBlockType(types[i], (i + 1 == types.size()) ? TBlockType::EShape::Scalar : TBlockType::EShape::Many); - } - - auto returnType = NewFlowType(NewMultiType(types)); - TCallableBuilder callableBuilder(Env, __func__, returnType); - for (const auto& arg : args) { - callableBuilder.Add(arg); - } - - return TRuntimeNode(callableBuilder.Build(), false); -} - TRuntimeNode TProgramBuilder::BlockCompress(TRuntimeNode flow, ui32 bitmapIndex) { auto blockItemTypes = ValidateBlockFlowType(flow.GetStaticType()); diff --git a/ydb/library/yql/minikql/mkql_program_builder.h b/ydb/library/yql/minikql/mkql_program_builder.h index 6caed134f7..16aab5a7f3 100644 --- a/ydb/library/yql/minikql/mkql_program_builder.h +++ b/ydb/library/yql/minikql/mkql_program_builder.h @@ -258,7 +258,6 @@ public: TRuntimeNode WideSortBlocks(TRuntimeNode flow, const std::vector<std::pair<ui32, TRuntimeNode>>& keys); TRuntimeNode AsScalar(TRuntimeNode value); TRuntimeNode ReplicateScalar(TRuntimeNode value, TRuntimeNode count); - TRuntimeNode BlockExtend(const TArrayRef<const TRuntimeNode>& flows); TRuntimeNode BlockCompress(TRuntimeNode flow, ui32 bitmapIndex); TRuntimeNode BlockExpandChunked(TRuntimeNode flow); TRuntimeNode BlockCoalesce(TRuntimeNode first, TRuntimeNode second); diff --git a/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp b/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp index 1bc952a82a..3669bcaf62 100644 --- a/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp +++ b/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp @@ -603,7 +603,6 @@ TMkqlCommonCallableCompiler::TShared::TShared() { {"Extend", &TProgramBuilder::Extend}, {"OrderedExtend", &TProgramBuilder::OrderedExtend}, - {"BlockExtend", &TProgramBuilder::BlockExtend}, {"Zip", &TProgramBuilder::Zip}, {"ZipAll", &TProgramBuilder::ZipAll}, @@ -1152,7 +1151,7 @@ TMkqlCommonCallableCompiler::TShared::TShared() { const auto value = FromString<i64>(node.Head(), NUdf::EDataSlot::Interval64); return ctx.ProgramBuilder.NewDataLiteral<NUdf::EDataSlot::Interval64>( NUdf::TStringRef((const char*)&value, sizeof(value))); - }); + }); AddCallable("FoldMap", [](const TExprNode& node, TMkqlBuildContext& ctx) { const auto list = MkqlBuildExpr(node.Head(), ctx); |