summaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/mkql_program_builder.h
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-10-09 12:25:18 +0300
committervvvv <[email protected]>2025-10-09 12:57:17 +0300
commitcb77d014972b2cdb27d2e6d979fc3a2772b27ad4 (patch)
tree7f3bcd8ce71c6bd0f3ccc11e31b9f665475b819e /yql/essentials/minikql/mkql_program_builder.h
parentd58a8990d353b051c27e1069141117fdfde64358 (diff)
YQL-20086 minikql
commit_hash:e96f7390db5fcbe7e9f64f898141a263ad522daa
Diffstat (limited to 'yql/essentials/minikql/mkql_program_builder.h')
-rw-r--r--yql/essentials/minikql/mkql_program_builder.h304
1 files changed, 149 insertions, 155 deletions
diff --git a/yql/essentials/minikql/mkql_program_builder.h b/yql/essentials/minikql/mkql_program_builder.h
index 876e300143c..bc02b06ac68 100644
--- a/yql/essentials/minikql/mkql_program_builder.h
+++ b/yql/essentials/minikql/mkql_program_builder.h
@@ -46,16 +46,16 @@ enum class EDictItems {
};
enum class EAnyJoinSettings {
- None = 0,
- Left = 1,
+ None = 0,
+ Left = 1,
Right = 2,
- Both = 1 | 2,
+ Both = 1 | 2,
};
inline EJoinKind GetJoinKind(ui32 kind) {
MKQL_ENSURE(kind >= (ui32)EJoinKind::Min && kind <= (ui32)EJoinKind::Max ||
- kind == (ui32)EJoinKind::LeftSemi || kind == (ui32)EJoinKind::RightSemi ||
- kind == (ui32)EJoinKind::Cross, "Bad join kind: " << kind);
+ kind == (ui32)EJoinKind::LeftSemi || kind == (ui32)EJoinKind::RightSemi ||
+ kind == (ui32)EJoinKind::Cross, "Bad join kind: " << kind);
return (EJoinKind)kind;
}
@@ -94,27 +94,27 @@ inline bool HasSpillingFlag(const TCallable& callable) {
return TStringBuf(callable.GetType()->GetName()).EndsWith("WithSpilling"_sb);
}
-#define MKQL_SCRIPT_TYPES(xx) \
- xx(Unknown, 0, unknown, false) \
- xx(Python, 1, python, false) \
- xx(Lua, 2, lua, false) \
- xx(ArcPython, 3, arcpython, false) \
- xx(CustomPython, 4, custompython, true) \
- xx(Javascript, 5, javascript, false) \
- xx(Python2, 6, python2, false) \
- xx(ArcPython2, 7, arcpython2, false) \
- xx(CustomPython2, 8, custompython2, true) \
- xx(Python3, 9, python3, false) \
- xx(ArcPython3, 10, arcpython3, false) \
- xx(CustomPython3, 11, custompython3, true) \
- xx(SystemPython2, 12, systempython2, false) \
- xx(SystemPython3, 13, systempython3, false) \
- xx(SystemPython3_8, 14, systempython3_8, false) \
- xx(SystemPython3_9, 15, systempython3_9, false) \
- xx(SystemPython3_10, 16, systempython3_10, false) \
- xx(SystemPython3_11, 17, systempython3_11, false) \
- xx(SystemPython3_12, 18, systempython3_12, false) \
- xx(SystemPython3_13, 19, systempython3_13, false) \
+#define MKQL_SCRIPT_TYPES(xx) \
+ xx(Unknown, 0, unknown, false) \
+ xx(Python, 1, python, false) \
+ xx(Lua, 2, lua, false) \
+ xx(ArcPython, 3, arcpython, false) \
+ xx(CustomPython, 4, custompython, true) \
+ xx(Javascript, 5, javascript, false) \
+ xx(Python2, 6, python2, false) \
+ xx(ArcPython2, 7, arcpython2, false) \
+ xx(CustomPython2, 8, custompython2, true) \
+ xx(Python3, 9, python3, false) \
+ xx(ArcPython3, 10, arcpython3, false) \
+ xx(CustomPython3, 11, custompython3, true) \
+ xx(SystemPython2, 12, systempython2, false) \
+ xx(SystemPython3, 13, systempython3, false) \
+ xx(SystemPython3_8, 14, systempython3_8, false) \
+ xx(SystemPython3_9, 15, systempython3_9, false) \
+ xx(SystemPython3_10, 16, systempython3_10, false) \
+ xx(SystemPython3_11, 17, systempython3_11, false) \
+ xx(SystemPython3_12, 18, systempython3_12, false) \
+ xx(SystemPython3_13, 19, systempython3_13, false)
enum class EScriptType {
MKQL_SCRIPT_TYPES(ENUM_VALUE_GEN)
@@ -141,10 +141,10 @@ std::vector<TType*> ValidateBlockType(const TType* type, bool unwrap = true);
std::vector<TType*> ValidateBlockStreamType(const TType* streamType, bool unwrap = true);
std::vector<TType*> ValidateBlockFlowType(const TType* flowType, bool unwrap = true);
-class TProgramBuilder : public TTypeBuilder {
+class TProgramBuilder: public TTypeBuilder {
public:
TProgramBuilder(const TTypeEnvironment& env, const IFunctionRegistry& functionRegistry, bool voidWithEffects = false,
- NYql::TLangVersion langver = NYql::UnknownLangVersion);
+ NYql::TLangVersion langver = NYql::UnknownLangVersion);
const TTypeEnvironment& GetTypeEnvironment() const;
const IFunctionRegistry& GetFunctionRegistry() const;
@@ -156,14 +156,11 @@ public:
TRuntimeNode NewVoid();
TRuntimeNode NewNull();
-
-
template <typename T, typename = std::enable_if_t<NUdf::TKnownDataType<T>::Result>>
TRuntimeNode NewDataLiteral(T data) const {
return TRuntimeNode(BuildDataLiteral(NUdf::TUnboxedValuePod(data), NUdf::TDataType<T>::Id, Env_), true);
}
-
template <typename T, typename = std::enable_if_t<NUdf::TTzDataType<T>::Result>>
TRuntimeNode NewTzDataLiteral(typename NUdf::TDataType<T>::TLayout value, ui16 tzId) const {
auto data = NUdf::TUnboxedValuePod(value);
@@ -285,13 +282,12 @@ public:
TRuntimeNode BlockToPg(TRuntimeNode input, TType* returnType);
TRuntimeNode BlockFromPg(TRuntimeNode input, TType* returnType);
TRuntimeNode BlockPgResolvedCall(const std::string_view& name, ui32 id,
- const TArrayRef<const TRuntimeNode>& args, TType* returnType);
+ const TArrayRef<const TRuntimeNode>& args, TType* returnType);
TRuntimeNode BlockStorage(TRuntimeNode list, TType* returnType);
TRuntimeNode BlockMapJoinIndex(TRuntimeNode blockStorage, TType* listItemType, const TArrayRef<const ui32>& keyColumns, bool any, TType* returnType);
TRuntimeNode BlockMapJoinCore(TRuntimeNode leftStream, TRuntimeNode rightBlockStorage, TType* rightListItemType, EJoinKind joinKind,
- const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& leftKeyDrops,
- const TArrayRef<const ui32>& rightKeyColumns, const TArrayRef<const ui32>& rightKeyDrops, TType* returnType
- );
+ const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& leftKeyDrops,
+ const TArrayRef<const ui32>& rightKeyColumns, const TArrayRef<const ui32>& rightKeyDrops, TType* returnType);
//-- logical functions
TRuntimeNode BlockNot(TRuntimeNode data);
@@ -304,20 +300,20 @@ public:
TRuntimeNode BlockFunc(const std::string_view& funcName, TType* returnType, const TArrayRef<const TRuntimeNode>& args);
TRuntimeNode BlockCombineAll(TRuntimeNode flow, std::optional<ui32> filterColumn,
- const TArrayRef<const TAggInfo>& aggs, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, TType* returnType);
TRuntimeNode BlockCombineHashed(TRuntimeNode flow, std::optional<ui32> filterColumn, const TArrayRef<ui32>& keys,
- const TArrayRef<const TAggInfo>& aggs, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, TType* returnType);
TRuntimeNode BlockMergeFinalizeHashed(TRuntimeNode flow, const TArrayRef<ui32>& keys,
- const TArrayRef<const TAggInfo>& aggs, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, TType* returnType);
TRuntimeNode BlockMergeManyFinalizeHashed(TRuntimeNode flow, const TArrayRef<ui32>& keys,
- const TArrayRef<const TAggInfo>& aggs, ui32 streamIndex, const TVector<TVector<ui32>>& streams, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, ui32 streamIndex, const TVector<TVector<ui32>>& streams, TType* returnType);
// udfs
TRuntimeNode Udf(
- const std::string_view& funcName,
- TRuntimeNode runConfig = TRuntimeNode(),
- TType* userType = nullptr,
- const std::string_view& typeConfig = std::string_view(""));
+ const std::string_view& funcName,
+ TRuntimeNode runConfig = TRuntimeNode(),
+ TType* userType = nullptr,
+ const std::string_view& typeConfig = std::string_view(""));
TRuntimeNode TypedUdf(
const std::string_view& funcName,
@@ -334,26 +330,26 @@ public:
TRuntimeNode script,
const std::string_view& file = std::string_view(""), ui32 row = 0, ui32 column = 0);
- typedef std::function<TRuntimeNode ()> TZeroLambda;
- typedef std::function<TRuntimeNode (TRuntimeNode)> TUnaryLambda;
- typedef std::function<TRuntimeNode (TRuntimeNode, TRuntimeNode)> TBinaryLambda;
- typedef std::function<TRuntimeNode (TRuntimeNode, TRuntimeNode, TRuntimeNode)> TTernaryLambda;
+ typedef std::function<TRuntimeNode()> TZeroLambda;
+ typedef std::function<TRuntimeNode(TRuntimeNode)> TUnaryLambda;
+ typedef std::function<TRuntimeNode(TRuntimeNode, TRuntimeNode)> TBinaryLambda;
+ typedef std::function<TRuntimeNode(TRuntimeNode, TRuntimeNode, TRuntimeNode)> TTernaryLambda;
typedef std::function<TRuntimeNode(const TArrayRef<const TRuntimeNode>& args)> TArrayLambda;
- typedef std::function<TRuntimeNodePair (TRuntimeNode)> TUnarySplitLambda;
- typedef std::function<TRuntimeNodePair (TRuntimeNode, TRuntimeNode)> TBinarySplitLambda;
+ typedef std::function<TRuntimeNodePair(TRuntimeNode)> TUnarySplitLambda;
+ typedef std::function<TRuntimeNodePair(TRuntimeNode, TRuntimeNode)> TBinarySplitLambda;
- typedef std::function<TRuntimeNode::TList (TRuntimeNode)> TExpandLambda;
- typedef std::function<TRuntimeNode::TList (TRuntimeNode::TList)> TWideLambda;
- typedef std::function<TRuntimeNode::TList (TRuntimeNode::TList, TRuntimeNode::TList)> TBinaryWideLambda;
- typedef std::function<TRuntimeNode::TList (TRuntimeNode::TList, TRuntimeNode::TList, TRuntimeNode::TList)> TTernaryWideLambda;
- typedef std::function<TRuntimeNode (TRuntimeNode::TList)> TNarrowLambda;
+ typedef std::function<TRuntimeNode::TList(TRuntimeNode)> TExpandLambda;
+ typedef std::function<TRuntimeNode::TList(TRuntimeNode::TList)> TWideLambda;
+ typedef std::function<TRuntimeNode::TList(TRuntimeNode::TList, TRuntimeNode::TList)> TBinaryWideLambda;
+ typedef std::function<TRuntimeNode::TList(TRuntimeNode::TList, TRuntimeNode::TList, TRuntimeNode::TList)> TTernaryWideLambda;
+ typedef std::function<TRuntimeNode(TRuntimeNode::TList)> TNarrowLambda;
- typedef std::function<TRuntimeNode (TRuntimeNode::TList, TRuntimeNode::TList)> TWideSwitchLambda;
+ typedef std::function<TRuntimeNode(TRuntimeNode::TList, TRuntimeNode::TList)> TWideSwitchLambda;
TRuntimeNode Apply(TRuntimeNode callableNode, const TArrayRef<const TRuntimeNode>& args, ui32 dependentCount = 0);
TRuntimeNode Apply(TRuntimeNode callableNode, const TArrayRef<const TRuntimeNode>& args,
- const std::string_view& file, ui32 row, ui32 column, ui32 dependentCount = 0);
+ const std::string_view& file, ui32 row, ui32 column, ui32 dependentCount = 0);
TRuntimeNode Callable(TType* callableType, const TArrayLambda& handler);
//-- struct functions
@@ -377,24 +373,24 @@ public:
TRuntimeNode Fold(TRuntimeNode list, TRuntimeNode state, const TBinaryLambda& handler);
TRuntimeNode Fold1(TRuntimeNode list, const TUnaryLambda& init, const TBinaryLambda& handler);
TRuntimeNode Reduce(TRuntimeNode list, TRuntimeNode state1,
- const TBinaryLambda& handler1,
- const TUnaryLambda& handler2,
- TRuntimeNode state3,
- const TBinaryLambda& handler3);
+ const TBinaryLambda& handler1,
+ const TUnaryLambda& handler2,
+ TRuntimeNode state3,
+ const TBinaryLambda& handler3);
TRuntimeNode Condense(TRuntimeNode stream, TRuntimeNode state,
- const TBinaryLambda& switcher,
- const TBinaryLambda& handler, bool useCtx = false);
+ const TBinaryLambda& switcher,
+ const TBinaryLambda& handler, bool useCtx = false);
TRuntimeNode Condense1(TRuntimeNode stream, const TUnaryLambda& init,
- const TBinaryLambda& switcher,
- const TBinaryLambda& handler, bool useCtx = false);
+ const TBinaryLambda& switcher,
+ const TBinaryLambda& handler, bool useCtx = false);
TRuntimeNode Squeeze(TRuntimeNode stream, TRuntimeNode state,
- const TBinaryLambda& handler,
- const TUnaryLambda& save = {},
- const TUnaryLambda& load = {});
+ const TBinaryLambda& handler,
+ const TUnaryLambda& save = {},
+ const TUnaryLambda& load = {});
TRuntimeNode Squeeze1(TRuntimeNode stream, const TUnaryLambda& init,
- const TBinaryLambda& handler,
- const TUnaryLambda& save = {},
- const TUnaryLambda& load = {});
+ const TBinaryLambda& handler,
+ const TUnaryLambda& save = {},
+ const TUnaryLambda& load = {});
TRuntimeNode Discard(TRuntimeNode stream);
TRuntimeNode Map(TRuntimeNode list, const TUnaryLambda& handler);
TRuntimeNode OrderedMap(TRuntimeNode list, const TUnaryLambda& handler);
@@ -460,9 +456,9 @@ public:
TRuntimeNode ListFromRange(TRuntimeNode start, TRuntimeNode end, TRuntimeNode step);
TRuntimeNode ForwardList(TRuntimeNode stream);
TRuntimeNode Switch(TRuntimeNode stream,
- const TArrayRef<const TSwitchInput>& handlerInputs,
- std::function<TRuntimeNode(ui32 index, TRuntimeNode item)> handler,
- ui64 memoryLimitBytes, TType* returnType);
+ const TArrayRef<const TSwitchInput>& handlerInputs,
+ std::function<TRuntimeNode(ui32 index, TRuntimeNode item)> handler,
+ ui64 memoryLimitBytes, TType* returnType);
TRuntimeNode HasItems(TRuntimeNode listOrDict);
TRuntimeNode Reverse(TRuntimeNode list);
TRuntimeNode Skip(TRuntimeNode list, TRuntimeNode count);
@@ -478,80 +474,79 @@ public:
TRuntimeNode AsList(TRuntimeNode item);
TRuntimeNode AsList(const TArrayRef<const TRuntimeNode>& items);
TRuntimeNode MapJoinCore(TRuntimeNode flow, TRuntimeNode dict, EJoinKind joinKind,
- const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& leftRenames,
- const TArrayRef<const ui32>& rightRenames, TType* returnType);
+ const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& leftRenames,
+ const TArrayRef<const ui32>& rightRenames, TType* returnType);
TRuntimeNode CommonJoinCore(TRuntimeNode list, EJoinKind joinKind,
- const TArrayRef<const ui32>& leftColumns, const TArrayRef<const ui32>& rightColumns,
- const TArrayRef<const ui32>& requiredColumns, const TArrayRef<const ui32>& keyColumns,
- ui64 memLimit, std::optional<ui32> sortedTableOrder,
- EAnyJoinSettings anyJoinSettings, const ui32 tableIndexField,
- TType* returnType);
+ const TArrayRef<const ui32>& leftColumns, const TArrayRef<const ui32>& rightColumns,
+ const TArrayRef<const ui32>& requiredColumns, const TArrayRef<const ui32>& keyColumns,
+ ui64 memLimit, std::optional<ui32> sortedTableOrder,
+ EAnyJoinSettings anyJoinSettings, const ui32 tableIndexField,
+ TType* returnType);
TRuntimeNode GraceJoinCommon(const TStringBuf& funcName, TRuntimeNode flowLeft, TRuntimeNode flowRight, EJoinKind joinKind,
- const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
- const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
+ const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
+ const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
TRuntimeNode GraceJoin(TRuntimeNode flowLeft, TRuntimeNode flowRight, EJoinKind joinKind,
- const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
- const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
- TRuntimeNode GraceSelfJoin(TRuntimeNode flowLeft, EJoinKind joinKind, const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
- const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
+ const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
+ const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
+ TRuntimeNode GraceSelfJoin(TRuntimeNode flowLeft, EJoinKind joinKind, const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
+ const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
TRuntimeNode GraceJoinWithSpilling(TRuntimeNode flowLeft, TRuntimeNode flowRight, EJoinKind joinKind,
- const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
- const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
- TRuntimeNode GraceSelfJoinWithSpilling(TRuntimeNode flowLeft, EJoinKind joinKind, const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
- const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
+ const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
+ const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
+ TRuntimeNode GraceSelfJoinWithSpilling(TRuntimeNode flowLeft, EJoinKind joinKind, const TArrayRef<const ui32>& leftKeyColumns, const TArrayRef<const ui32>& rightKeyColumns,
+ const TArrayRef<const ui32>& leftRenames, const TArrayRef<const ui32>& rightRenames, TType* returnType, EAnyJoinSettings anyJoinSettings = EAnyJoinSettings::None);
TRuntimeNode CombineCore(TRuntimeNode stream,
- const TUnaryLambda& keyExtractor,
- const TBinaryLambda& init,
- const TTernaryLambda& update,
- const TBinaryLambda& finish,
- ui64 memLimit);
+ const TUnaryLambda& keyExtractor,
+ const TBinaryLambda& init,
+ const TTernaryLambda& update,
+ const TBinaryLambda& finish,
+ ui64 memLimit);
TRuntimeNode GroupingCore(TRuntimeNode stream,
- const TBinaryLambda& groupSwitch,
- const TUnaryLambda& keyExtractor,
- const TUnaryLambda& handler = {});
+ const TBinaryLambda& groupSwitch,
+ const TUnaryLambda& keyExtractor,
+ const TUnaryLambda& handler = {});
TRuntimeNode HoppingCore(TRuntimeNode list,
- const TUnaryLambda& timeExtractor,
- const TUnaryLambda& init,
- const TBinaryLambda& update,
- const TUnaryLambda& save,
- const TUnaryLambda& load,
- const TBinaryLambda& merge,
- const TBinaryLambda& finish,
- TRuntimeNode hop, TRuntimeNode interval, TRuntimeNode delay);
+ const TUnaryLambda& timeExtractor,
+ const TUnaryLambda& init,
+ const TBinaryLambda& update,
+ const TUnaryLambda& save,
+ const TUnaryLambda& load,
+ const TBinaryLambda& merge,
+ const TBinaryLambda& finish,
+ TRuntimeNode hop, TRuntimeNode interval, TRuntimeNode delay);
TRuntimeNode MultiHoppingCore(TRuntimeNode list,
- const TUnaryLambda& keyExtractor,
- const TUnaryLambda& timeExtractor,
- const TUnaryLambda& init,
- const TBinaryLambda& update,
- const TUnaryLambda& save,
- const TUnaryLambda& load,
- const TBinaryLambda& merge,
- const TTernaryLambda& finish,
- TRuntimeNode hop, TRuntimeNode interval, TRuntimeNode delay,
- TRuntimeNode dataWatermarks, TRuntimeNode watermarksMode);
+ const TUnaryLambda& keyExtractor,
+ const TUnaryLambda& timeExtractor,
+ const TUnaryLambda& init,
+ const TBinaryLambda& update,
+ const TUnaryLambda& save,
+ const TUnaryLambda& load,
+ const TBinaryLambda& merge,
+ const TTernaryLambda& finish,
+ TRuntimeNode hop, TRuntimeNode interval, TRuntimeNode delay,
+ TRuntimeNode dataWatermarks, TRuntimeNode watermarksMode);
TRuntimeNode Chopper(TRuntimeNode flow, const TUnaryLambda& keyExtractor, const TBinaryLambda& groupSwitch, const TBinaryLambda& groupHandler);
TRuntimeNode WideChopper(TRuntimeNode flow, const TWideLambda& keyExtractor, const TWideSwitchLambda& groupSwitch,
- const std::function<TRuntimeNode (TRuntimeNode::TList, TRuntimeNode)>& groupHandler
- );
+ const std::function<TRuntimeNode(TRuntimeNode::TList, TRuntimeNode)>& groupHandler);
//-- dict functions
TRuntimeNode Contains(TRuntimeNode dict, TRuntimeNode key);
TRuntimeNode Lookup(TRuntimeNode dict, TRuntimeNode key);
// all - keep all payloads in list or keep first payload only
TRuntimeNode ToSortedDict(TRuntimeNode list, bool all, const TUnaryLambda& keySelector,
- const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
+ const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
TRuntimeNode ToHashedDict(TRuntimeNode list, bool all, const TUnaryLambda& keySelector,
- const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
+ const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
TRuntimeNode SqueezeToSortedDict(TRuntimeNode stream, bool all, const TUnaryLambda& keySelector,
- const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
+ const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
TRuntimeNode SqueezeToHashedDict(TRuntimeNode stream, bool all, const TUnaryLambda& keySelector,
- const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
+ const TUnaryLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
TRuntimeNode NarrowSqueezeToSortedDict(TRuntimeNode stream, bool all, const TNarrowLambda& keySelector,
- const TNarrowLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
+ const TNarrowLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
TRuntimeNode NarrowSqueezeToHashedDict(TRuntimeNode stream, bool all, const TNarrowLambda& keySelector,
- const TNarrowLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
+ const TNarrowLambda& payloadSelector, bool isCompact = false, ui64 itemsCountHint = 0);
TRuntimeNode SqueezeToList(TRuntimeNode flow, TRuntimeNode limit);
// return list of 2-item tuples with key and payload
@@ -725,7 +720,7 @@ public:
TRuntimeNode PgConst(TPgType* pgType, const std::string_view& value, TRuntimeNode typeMod = {});
TRuntimeNode PgResolvedCall(bool useContext, const std::string_view& name, ui32 id,
- const TArrayRef<const TRuntimeNode>& args, TType* returnType, bool rangeFunction);
+ const TArrayRef<const TRuntimeNode>& args, TType* returnType, bool rangeFunction);
TRuntimeNode PgCast(TRuntimeNode input, TType* returnType, TRuntimeNode typeMod = {});
TRuntimeNode FromPg(TRuntimeNode input, TType* returnType);
TRuntimeNode ToPg(TRuntimeNode input, TType* returnType);
@@ -752,16 +747,14 @@ public:
const TVector<TTernaryLambda>& getDefines,
bool streamingMode,
const NYql::NMatchRecognize::TAfterMatchSkipTo& skipTo,
- NYql::NMatchRecognize::ERowsPerMatch rowsPerMatch
- );
+ NYql::NMatchRecognize::ERowsPerMatch rowsPerMatch);
TRuntimeNode TimeOrderRecover(
TRuntimeNode inputStream,
const TUnaryLambda& getTimeExtractor,
TRuntimeNode delay,
TRuntimeNode ahead,
- TRuntimeNode rowLimit
- );
+ TRuntimeNode rowLimit);
protected:
TRuntimeNode Invoke(const std::string_view& funcName, TType* resultType, const TArrayRef<const TRuntimeNode>& args);
@@ -799,32 +792,32 @@ private:
TRuntimeNode BuildWideFilter(const std::string_view& callableName, TRuntimeNode flow, const TNarrowLambda& handler);
TRuntimeNode BuildBlockCombineAll(const std::string_view& callableName, TRuntimeNode input, std::optional<ui32> filterColumn,
- const TArrayRef<const TAggInfo>& aggs, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, TType* returnType);
TRuntimeNode BuildBlockCombineHashed(const std::string_view& callableName, TRuntimeNode input, std::optional<ui32> filterColumn,
- const TArrayRef<ui32>& keys, const TArrayRef<const TAggInfo>& aggs, TType* returnType);
+ const TArrayRef<ui32>& keys, const TArrayRef<const TAggInfo>& aggs, TType* returnType);
TRuntimeNode BuildBlockMergeFinalizeHashed(const std::string_view& callableName, TRuntimeNode input, const TArrayRef<ui32>& keys,
- const TArrayRef<const TAggInfo>& aggs, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, TType* returnType);
TRuntimeNode BuildBlockMergeManyFinalizeHashed(const std::string_view& callableName, TRuntimeNode input, const TArrayRef<ui32>& keys,
- const TArrayRef<const TAggInfo>& aggs, ui32 streamIndex, const TVector<TVector<ui32>>& streams, TType* returnType);
+ const TArrayRef<const TAggInfo>& aggs, ui32 streamIndex, const TVector<TVector<ui32>>& streams, TType* returnType);
TRuntimeNode If(TRuntimeNode condition, TRuntimeNode thenBranch, TRuntimeNode elseBranch, TType* resultType);
TRuntimeNode ToDict(TRuntimeNode list, bool multi, const TUnaryLambda& keySelector,
- const TUnaryLambda& payloadSelector, std::string_view callableName, bool isCompact, ui64 itemsCountHint);
+ const TUnaryLambda& payloadSelector, std::string_view callableName, bool isCompact, ui64 itemsCountHint);
TRuntimeNode SqueezeToDict(TRuntimeNode stream, bool multi, const TUnaryLambda& keySelector,
- const TUnaryLambda& payloadSelector, std::string_view callableName, bool isCompact, ui64 itemsCountHint);
+ const TUnaryLambda& payloadSelector, std::string_view callableName, bool isCompact, ui64 itemsCountHint);
TRuntimeNode NarrowSqueezeToDict(TRuntimeNode stream, bool multi, const TNarrowLambda& keySelector,
- const TNarrowLambda& payloadSelector, std::string_view callableName, bool isCompact, ui64 itemsCountHint);
+ const TNarrowLambda& payloadSelector, std::string_view callableName, bool isCompact, ui64 itemsCountHint);
TRuntimeNode UnaryDataFunction(TRuntimeNode data, const std::string_view& callableName, ui32 flags);
- template<bool IsFilter, bool OnStruct>
+ template <bool IsFilter, bool OnStruct>
TRuntimeNode BuildFilterNulls(TRuntimeNode list);
- template<bool IsFilter, bool OnStruct>
+ template <bool IsFilter, bool OnStruct>
TRuntimeNode BuildFilterNulls(TRuntimeNode list, const TArrayRef<std::conditional_t<OnStruct, const std::string_view, const ui32>>& members);
- template<bool OnStruct>
+ template <bool OnStruct>
TRuntimeNode BuildFilterNulls(TRuntimeNode list, const TArrayRef<std::conditional_t<OnStruct, const std::string_view, const ui32>>& members,
- const std::conditional_t<OnStruct, std::vector<std::pair<std::string_view, TType*>>, std::vector<TType*>>& filteredItems);
+ const std::conditional_t<OnStruct, std::vector<std::pair<std::string_view, TType*>>, std::vector<TType*>>& filteredItems);
TRuntimeNode BuildWideTopOrSort(const std::string_view& callableName, TRuntimeNode flow, TMaybe<TRuntimeNode> count, const std::vector<std::pair<ui32, TRuntimeNode>>& keys, bool isBlocks);
TRuntimeNode BuildWideTopOrSortImpl(const std::string_view& callableName, TRuntimeNode flow, TMaybe<TRuntimeNode> count, const std::vector<std::pair<ui32, TRuntimeNode>>& keys, TType::EKind streamKind);
@@ -835,43 +828,43 @@ private:
TRuntimeNode BuildRangeLogical(const std::string_view& callableName, const TArrayRef<const TRuntimeNode>& lists);
- template<bool Default>
+ template <bool Default>
TRuntimeNode DefaultResult(TRuntimeNode data);
- template<BinaryFunctionMethod Compare>
+ template <BinaryFunctionMethod Compare>
TRuntimeNode BuildOptionalCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Compare, bool OnEqual>
+ template <BinaryFunctionMethod Compare, bool OnEqual>
TRuntimeNode BuildOptionalCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Compare, bool OnEqual, bool Asc>
+ template <BinaryFunctionMethod Compare, bool OnEqual, bool Asc>
TRuntimeNode BuildOptionalCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare>
+ template <BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare>
TRuntimeNode BuildByNthCompare(ui32 count, TRuntimeNode data1, TRuntimeNode data2, ui32 index = 0U);
- template<BinaryFunctionMethod Compare, bool Fallback>
+ template <BinaryFunctionMethod Compare, bool Fallback>
TRuntimeNode BuildVariantCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Compare>
+ template <BinaryFunctionMethod Compare>
TRuntimeNode BuildVariantCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare>
+ template <BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare>
TRuntimeNode BuildMembersCompare(const TStructType* type, TRuntimeNode data1, TRuntimeNode data2, ui32 index = 0U);
- template<TProgramBuilder::BinaryFunctionMethod Compare, TProgramBuilder::ArrayFunctionMethod Join, bool OnEqual>
+ template <TProgramBuilder::BinaryFunctionMethod Compare, TProgramBuilder::ArrayFunctionMethod Join, bool OnEqual>
TRuntimeNode BuildStructCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare, bool OnEqual>
+ template <BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare, bool OnEqual>
TRuntimeNode BuildStructCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<TProgramBuilder::BinaryFunctionMethod Compare, TProgramBuilder::ArrayFunctionMethod Join, bool OnEqual>
+ template <TProgramBuilder::BinaryFunctionMethod Compare, TProgramBuilder::ArrayFunctionMethod Join, bool OnEqual>
TRuntimeNode BuildTupleCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare, bool OnEqual>
+ template <BinaryFunctionMethod Equal, BinaryFunctionMethod Compare, BinaryFunctionMethod FinalCompare, bool OnEqual>
TRuntimeNode BuildTupleCompare(TRuntimeNode data1, TRuntimeNode data2);
- template<bool Equal>
+ template <bool Equal>
TRuntimeNode BuildAggrCompare(const std::string_view& callableName, TRuntimeNode data1, TRuntimeNode data2);
template <bool Equal>
@@ -889,6 +882,7 @@ private:
bool IsNull(TRuntimeNode arg);
void ValidateMutDictType(TType* type) const;
+
protected:
const IFunctionRegistry& FunctionRegistry_;
const bool VoidWithEffects_;
@@ -899,5 +893,5 @@ protected:
bool CanExportType(TType* type, const TTypeEnvironment& env);
void EnsureDataOrOptionalOfData(TRuntimeNode node);
-}
-}
+} // namespace NMiniKQL
+} // namespace NKikimr