aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials
diff options
context:
space:
mode:
authoraneporada <aneporada@yandex-team.com>2024-11-29 23:59:52 +0300
committeraneporada <aneporada@yandex-team.com>2024-11-30 00:09:13 +0300
commitf4d9e6b05d8c72b02c0cbd2dfc4e7c1b7f86b19f (patch)
treeabd8c8e53a78c440434e5d4ceec30805ed8a9c1d /yql/essentials
parentc88c90429a4914a0b120be7191d1572c43cc2a55 (diff)
downloadydb-f4d9e6b05d8c72b02c0cbd2dfc4e7c1b7f86b19f.tar.gz
Make a clone of DQ nodes in yql/essentials
commit_hash:00e744cfe198dba16af67209723070b40f5726c8
Diffstat (limited to 'yql/essentials')
-rw-r--r--yql/essentials/core/dq_expr_nodes/dq_expr_nodes.h71
-rw-r--r--yql/essentials/core/dq_expr_nodes/dq_expr_nodes.json316
-rw-r--r--yql/essentials/core/dq_expr_nodes/ya.make53
-rw-r--r--yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.h10
-rw-r--r--yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.json50
-rw-r--r--yql/essentials/core/dqs_expr_nodes/ya.make53
-rwxr-xr-xyql/essentials/core/expr_nodes_gen/gen/__main__.py13
-rw-r--r--yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.jnj50
-rw-r--r--yql/essentials/core/ya.make2
9 files changed, 603 insertions, 15 deletions
diff --git a/yql/essentials/core/dq_expr_nodes/dq_expr_nodes.h b/yql/essentials/core/dq_expr_nodes/dq_expr_nodes.h
new file mode 100644
index 0000000000..c6a9ce8119
--- /dev/null
+++ b/yql/essentials/core/dq_expr_nodes/dq_expr_nodes.h
@@ -0,0 +1,71 @@
+#pragma once
+
+#include <yql/essentials/core/dq_expr_nodes/dq_expr_nodes.gen.h>
+
+#include <yql/essentials/core/expr_nodes/yql_expr_nodes.h>
+
+namespace NYql::NNodes {
+
+#include <yql/essentials/core/dq_expr_nodes/dq_expr_nodes.decl.inl.h>
+
+namespace NDq {
+struct TTopSortSettings {
+ static inline const TString AscendingSort = "Asc";
+ static inline const TString DescendingSort = "Desc";
+};
+
+class TDqConnection : public NGenerated::TDqConnectionStub<TExprBase, TCallable, TDqOutput> {
+public:
+ explicit TDqConnection(const TExprNode* node)
+ : TDqConnectionStub(node) {}
+
+ explicit TDqConnection(const TExprNode::TPtr& node)
+ : TDqConnectionStub(node) {}
+
+ static bool Match(const TExprNode* node) {
+ if (!node) {
+ return false;
+ }
+
+ if (!node->IsCallable()) {
+ return false;
+ }
+
+ if (node->ChildrenSize() < 1) {
+ return false;
+ }
+
+ return TDqOutput::Match(node->Child(0));
+ }
+};
+
+class TDqOutputAnnotationBase : public NGenerated::TDqOutputAnnotationBaseStub<TExprBase, TCallable, TCoAtom> {
+public:
+ explicit TDqOutputAnnotationBase(const TExprNode* node)
+ : TDqOutputAnnotationBaseStub(node) {}
+
+ explicit TDqOutputAnnotationBase(const TExprNode::TPtr& node)
+ : TDqOutputAnnotationBaseStub(node) {}
+
+ static bool Match(const TExprNode* node) {
+ if (!node) {
+ return false;
+ }
+
+ if (!node->IsCallable()) {
+ return false;
+ }
+
+ if (node->ChildrenSize() < 2) {
+ return false;
+ }
+
+ return TCoAtom::Match(node->Child(0))
+ && TCallable::Match(node->Child(1));
+ }
+};
+} // namespace NDq
+
+#include <yql/essentials/core/dq_expr_nodes/dq_expr_nodes.defs.inl.h>
+
+} // namespace NYql::NNodes
diff --git a/yql/essentials/core/dq_expr_nodes/dq_expr_nodes.json b/yql/essentials/core/dq_expr_nodes/dq_expr_nodes.json
new file mode 100644
index 0000000000..e9efb8c204
--- /dev/null
+++ b/yql/essentials/core/dq_expr_nodes/dq_expr_nodes.json
@@ -0,0 +1,316 @@
+{
+ "NodeRootType": "TExprBase",
+ "NodeBuilderBase": "TNodeBuilderBase",
+ "ListBuilderBase": "TListBuilderBase",
+ "FreeArgCallableBase": "TFreeArgCallable",
+ "FreeArgBuilderBase": "TFreeArgCallableBuilderBase",
+ "Nodes": [
+ {
+ "Name": "TDqJoinKeyTuple",
+ "Base": "TExprBase",
+ "Match": {"Type": "Tuple"},
+ "Children": [
+ {"Index": 0, "Name": "LeftLabel", "Type": "TCoAtom"},
+ {"Index": 1, "Name": "LeftColumn", "Type": "TCoAtom"},
+ {"Index": 2, "Name": "RightLabel", "Type": "TCoAtom"},
+ {"Index": 3, "Name": "RightColumn", "Type": "TCoAtom"}
+ ]
+ },
+ {
+ "Name": "TDqJoinKeyTupleList",
+ "ListBase": "TDqJoinKeyTuple"
+ },
+ {
+ "Name": "TDqJoinBase",
+ "Base": "TCallable",
+ "Match": {"Type": "CallableBase"},
+ "Builder": {"Generate": "None"},
+ "Children": [
+ {"Index": 0, "Name": "LeftInput", "Type": "TExprBase"},
+ {"Index": 2, "Name": "LeftLabel", "Type": "TExprBase",
+ "NB": "Atom - if left is real table, Void - otherwise"},
+ {"Index": 1, "Name": "RightInput", "Type": "TExprBase"},
+ {"Index": 3, "Name": "RightLabel", "Type": "TExprBase",
+ "NB": "Atom - if right is real table, Void - otherwise"},
+ {"Index": 4, "Name": "JoinType", "Type": "TCoAtom"},
+ {"Index": 5, "Name": "JoinKeys", "Type": "TDqJoinKeyTupleList"},
+ {"Index": 6, "Name": "LeftJoinKeyNames", "Type": "TCoAtomList"},
+ {"Index": 7, "Name": "RightJoinKeyNames", "Type": "TCoAtomList"}
+ ]
+ },
+ {
+ "Name": "TDqJoin",
+ "Base": "TDqJoinBase",
+ "Match": {"Type": "Callable", "Name": "DqJoin"},
+ "Children": [
+ {"Index": 8, "Name": "JoinAlgo", "Type": "TCoAtom"},
+ {"Index": 9, "Name": "Flags", "Type": "TCoAtomList", "Optional": true}
+ ]
+ },
+ {
+ "Name": "TDqPhyGraceJoin",
+ "Base": "TDqJoinBase",
+ "Match": {"Type": "Callable", "Name": "DqPhyGraceJoin"},
+ "Children": [
+ {"Index": 8, "Name": "Flags", "Type": "TCoAtomList", "Optional": true}
+ ]
+ },
+ {
+ "Name": "TDqPhyMapJoin",
+ "Base": "TDqJoinBase",
+ "Match": {"Type": "Callable", "Name": "DqPhyMapJoin"}
+ },
+ {
+ "Name": "TDqPhyCrossJoin",
+ "Base": "TDqJoinBase",
+ "Match": {"Type": "Callable", "Name": "DqPhyCrossJoin"}
+ },
+ {
+ "Name": "TDqPhyJoinDict",
+ "Base": "TDqJoinBase",
+ "Match": {"Type": "Callable", "Name": "DqPhyJoinDict"}
+ },
+ {
+ "Name": "TDqSource",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "DqSource"},
+ "Children": [
+ {"Index": 0, "Name": "DataSource", "Type": "TCallable"},
+ {"Index": 1, "Name": "Settings", "Type": "TExprBase"}
+ ]
+ },
+ {
+ "Name": "TDqOutputAnnotationBase",
+ "Base": "TCallable",
+ "Definition": "Custom",
+ "Builder": {"Generate": "None"},
+ "Children": [
+ {"Index": 0, "Name": "Index", "Type": "TCoAtom"},
+ {"Index": 1, "Name": "DataSink", "Type": "TCallable"}
+ ]
+ },
+ {
+ "Name": "TDqTransform",
+ "Base": "TDqOutputAnnotationBase",
+ "Match": {"Type": "Callable", "Name": "DqTransform"},
+ "Children": [
+ {"Index": 2, "Name": "Type", "Type": "TCoAtom"},
+ {"Index": 3, "Name": "InputType", "Type": "TExprBase"},
+ {"Index": 4, "Name": "OutputType", "Type": "TExprBase"},
+ {"Index": 5, "Name": "Settings", "Type": "TCallable"}
+ ]
+ },
+ {
+ "Name": "TDqSink",
+ "Base": "TDqOutputAnnotationBase",
+ "Match": {"Type": "Callable", "Name": "DqSink"},
+ "Children": [
+ {"Index": 2, "Name": "Settings", "Type": "TCallable"}
+ ]
+ },
+ {
+ "Name": "TDqStageOutputsList",
+ "ListBase": "TDqOutputAnnotationBase"
+ },
+ {
+ "Name": "TDqStageBase",
+ "Base": "TCallable",
+ "Match": {"Type": "CallableBase"},
+ "Builder": {"Generate": "None"},
+ "Children": [
+ {"Index": 0, "Name": "Inputs", "Type": "TExprList"},
+ {"Index": 1, "Name": "Program", "Type": "TCoLambda"},
+ {"Index": 2, "Name": "Settings", "Type": "TCoNameValueTupleList"},
+ {"Index": 3, "Name": "Outputs", "Type": "TDqStageOutputsList", "Optional": true}
+ ]
+ },
+ {
+ "Name": "TDqStage",
+ "Base": "TDqStageBase",
+ "Match": {"Type": "Callable", "Name": "DqStage"}
+ },
+ {
+ "Name": "TDqPhyStage",
+ "Base": "TDqStageBase",
+ "Match": {"Type": "Callable", "Name": "DqPhyStage"}
+ },
+ {
+ "Name": "TDqStageList",
+ "ListBase": "TDqStageBase"
+ },
+ {
+ "Name": "TDqPhyStageList",
+ "ListBase": "TDqPhyStage"
+ },
+ {
+ "Name": "TDqOutput",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "TDqOutput"},
+ "Children": [
+ {"Index": 0, "Name": "Stage", "Type": "TDqStageBase"},
+ {"Index": 1, "Name": "Index", "Type": "TCoAtom"}
+ ]
+ },
+ {
+ "Name": "TDqConnection",
+ "Base": "TCallable",
+ "Definition": "Custom",
+ "Builder": {"Generate": "None"},
+ "Children": [
+ {"Index": 0, "Name": "Output", "Type": "TDqOutput"}
+ ]
+ },
+ {
+ "Name": "TDqCnHashShuffle",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnHashShuffle"},
+ "Children": [
+ {"Index": 1, "Name": "KeyColumns", "Type": "TCoAtomList"}
+ ]
+ },
+ {
+ "Name": "TDqCnBroadcast",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnBroadcast"}
+ },
+ {
+ "Name": "TDqCnUnionAll",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnUnionAll"}
+ },
+ {
+ "Name": "TDqCnMap",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnMap"}
+ },
+ {
+ "Name": "TDqCnStreamLookup",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnStreamLookup"},
+ "Children": [
+ {"Index": 1, "Name": "LeftLabel", "Type": "TCoAtom"},
+ {"Index": 2, "Name": "RightInput", "Type": "TExprBase"},
+ {"Index": 3, "Name": "RightLabel", "Type": "TCoAtom"},
+ {"Index": 4, "Name": "JoinType", "Type": "TCoAtom"},
+ {"Index": 5, "Name": "JoinKeys", "Type": "TDqJoinKeyTupleList"},
+ {"Index": 6, "Name": "LeftJoinKeyNames", "Type": "TCoAtomList"},
+ {"Index": 7, "Name": "RightJoinKeyNames", "Type": "TCoAtomList"},
+ {"Index": 8, "Name": "TTL", "Type": "TCoAtom"},
+ {"Index": 9, "Name": "MaxDelayedRows", "Type": "TCoAtom"},
+ {"Index": 10, "Name": "MaxCachedRows", "Type": "TCoAtom"}
+ ]
+ },
+ {
+ "Name": "TDqCnResult",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnResult"},
+ "Children": [
+ {"Index": 1, "Name": "ColumnHints", "Type": "TCoAtomList"}
+ ]
+ },
+ {
+ "Name": "TDqCnValue",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnValue"}
+ },
+ {
+ "Name": "TDqSortColumn",
+ "Base": "TExprBase",
+ "Match": {"Type": "Tuple"},
+ "Children": [
+ {"Index": 0, "Name": "Column", "Type": "TCoAtom"},
+ {"Index": 1, "Name": "SortDirection", "Type": "TCoAtom"}
+ ]
+ },
+ {
+ "Name": "TDqSortColumnList",
+ "ListBase": "TDqSortColumn"
+ },
+ {
+ "Name": "TDqCnMerge",
+ "Base": "TDqConnection",
+ "Match": {"Type": "Callable", "Name": "DqCnMerge"},
+ "Children": [
+ {"Index": 1, "Name": "SortColumns", "Type": "TDqSortColumnList"}
+ ]
+ },
+ {
+ "Name": "TDqReplicate",
+ "Base": "TFreeArgCallable",
+ "Match": {"Type": "Callable", "Name": "DqReplicate"},
+ "Children": [
+ {"Index": 0, "Name": "Input", "Type": "TExprBase"}
+ ]
+ },
+ {
+ "Name": "TDqQuery",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "DqQuery!"},
+ "Children": [
+ {"Index": 0, "Name": "World", "Type": "TExprBase"},
+ {"Index": 1, "Name": "SinkStages", "Type": "TDqStageList"}
+ ]
+ },
+ {
+ "Name": "TDqPrecompute",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "DqPrecompute"},
+ "Children": [
+ {"Index": 0, "Name": "Input", "Type": "TExprBase"}
+ ]
+ },
+ {
+ "Name": "TDqPhyPrecompute",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "DqPhyPrecompute"},
+ "Children": [
+ {"Index": 0, "Name": "Connection", "Type": "TDqConnection"}
+ ]
+ },
+ {
+ "Name": "TDqSqlExternalFunction",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "SqlExternalFunction"},
+ "Children": [
+ {"Index": 0, "Name": "TransformType", "Type": "TExprBase"},
+ {"Index": 1, "Name": "TransformName", "Type": "TExprBase"},
+ {"Index": 2, "Name": "Settings", "Type": "TCoNameValueTupleList"}
+ ]
+ },
+ {
+ "Name": "TDqPhyLength",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "DqPhyLength"},
+ "Children": [
+ {"Index": 0, "Name": "Input", "Type": "TExprBase"},
+ {"Index": 1, "Name": "Name", "Type": "TCoAtom"}
+ ]
+ },
+ {
+ "Name": "TDqReadWrapBase",
+ "Base": "TExprBase",
+ "Match": {"Type": "CallableBase"},
+ "Builder": {"Generate": "None"},
+ "Children": [
+ {"Index": 0, "Name": "Input", "Type": "TExprBase"},
+ {"Index": 1, "Name": "Flags", "Type": "TCoAtomList"},
+ {"Index": 2, "Name": "Token", "Type": "TCoSecureParam", "Optional": true}
+ ]
+ },
+ {
+ "Name": "TDqReadWrap",
+ "Base": "TDqReadWrapBase",
+ "Match": {"Type": "Callable", "Name": "DqReadWrap"}
+ },
+ {
+ "Name": "TDqReadWideWrap",
+ "Base": "TDqReadWrapBase",
+ "Match": {"Type": "Callable", "Name": "DqReadWideWrap"}
+ },
+ {
+ "Name": "TDqReadBlockWideWrap",
+ "Base": "TDqReadWrapBase",
+ "Match": {"Type": "Callable", "Name": "DqReadBlockWideWrap"}
+ }
+ ]
+}
diff --git a/yql/essentials/core/dq_expr_nodes/ya.make b/yql/essentials/core/dq_expr_nodes/ya.make
new file mode 100644
index 0000000000..e1acd2003e
--- /dev/null
+++ b/yql/essentials/core/dq_expr_nodes/ya.make
@@ -0,0 +1,53 @@
+LIBRARY()
+
+SRCS(
+ dq_expr_nodes.h
+)
+
+PEERDIR(
+ yql/essentials/core/expr_nodes
+)
+
+SRCDIR(
+ yql/essentials/core/expr_nodes_gen
+)
+
+IF(EXPORT_CMAKE)
+ RUN_PYTHON3(
+ ${ARCADIA_ROOT}/yql/essentials/core/expr_nodes_gen/gen/__main__.py
+ yql_expr_nodes_gen.jnj
+ dq_expr_nodes.json
+ dq_expr_nodes.gen.h
+ dq_expr_nodes.decl.inl.h
+ dq_expr_nodes.defs.inl.h
+ NDq
+ IN yql_expr_nodes_gen.jnj
+ IN dq_expr_nodes.json
+ OUT dq_expr_nodes.gen.h
+ OUT dq_expr_nodes.decl.inl.h
+ OUT dq_expr_nodes.defs.inl.h
+ OUTPUT_INCLUDES
+ ${ARCADIA_ROOT}/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h
+ ${ARCADIA_ROOT}/util/generic/hash_set.h
+ )
+ELSE()
+ RUN_PROGRAM(
+ yql/essentials/core/expr_nodes_gen/gen
+ yql_expr_nodes_gen.jnj
+ dq_expr_nodes.json
+ dq_expr_nodes.gen.h
+ dq_expr_nodes.decl.inl.h
+ dq_expr_nodes.defs.inl.h
+ NDq
+ IN yql_expr_nodes_gen.jnj
+ IN dq_expr_nodes.json
+ OUT dq_expr_nodes.gen.h
+ OUT dq_expr_nodes.decl.inl.h
+ OUT dq_expr_nodes.defs.inl.h
+ OUTPUT_INCLUDES
+ ${ARCADIA_ROOT}/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h
+ ${ARCADIA_ROOT}/util/generic/hash_set.h
+ )
+ENDIF()
+
+END()
diff --git a/yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.h b/yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.h
new file mode 100644
index 0000000000..8851127f83
--- /dev/null
+++ b/yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.gen.h>
+
+#include <yql/essentials/core/expr_nodes/yql_expr_nodes.h>
+
+namespace NYql::NNodes {
+#include <yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.decl.inl.h>
+#include <yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.defs.inl.h>
+}
diff --git a/yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.json b/yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.json
new file mode 100644
index 0000000000..7ee283859f
--- /dev/null
+++ b/yql/essentials/core/dqs_expr_nodes/dqs_expr_nodes.json
@@ -0,0 +1,50 @@
+{
+ "NodeRootType": "TExprBase",
+ "NodeBuilderBase": "TNodeBuilderBase",
+ "ListBuilderBase": "TListBuilderBase",
+ "FreeArgCallableBase": "TFreeArgCallable",
+ "FreeArgBuilderBase": "TFreeArgCallableBuilderBase",
+ "Nodes": [
+ {
+ "Name": "TDqWrite",
+ "Base": "TCallable",
+ "Match": {"Type": "Callable", "Name": "DqWrite"},
+ "Children": [
+ {"Index": 0, "Name": "Input", "Type": "TExprBase"},
+ {"Index": 1, "Name": "Provider", "Type": "TCoAtom"},
+ {"Index": 2, "Name": "Settings", "Type": "TCoNameValueTupleList", "Optional": true}
+ ]
+ },
+ {
+ "Name": "TDqSourceWrapBase",
+ "Base": "TExprBase",
+ "Match": {"Type": "CallableBase"},
+ "Children": [
+ {"Index": 0, "Name": "Input", "Type": "TExprBase"},
+ {"Index": 1, "Name": "DataSource", "Type": "TCoDataSource"},
+ {"Index": 2, "Name": "RowType", "Type": "TExprBase"},
+ {"Index": 3, "Name": "Settings", "Type": "TExprBase", "Optional": true}
+ ]
+ },
+ {
+ "Name": "TDqSourceWrap",
+ "Base": "TDqSourceWrapBase",
+ "Match": {"Type": "Callable", "Name": "DqSourceWrap"}
+ },
+ {
+ "Name": "TDqSourceWideWrap",
+ "Base": "TDqSourceWrapBase",
+ "Match": {"Type": "Callable", "Name": "DqSourceWideWrap"}
+ },
+ {
+ "Name": "TDqSourceWideBlockWrap",
+ "Base": "TDqSourceWrapBase",
+ "Match": {"Type": "Callable", "Name": "DqSourceWideBlockWrap"}
+ },
+ {
+ "Name": "TDqLookupSourceWrap",
+ "Base": "TDqSourceWrapBase",
+ "Match": {"Type": "Callable", "Name": "TDqLookupSourceWrap"}
+ }
+ ]
+}
diff --git a/yql/essentials/core/dqs_expr_nodes/ya.make b/yql/essentials/core/dqs_expr_nodes/ya.make
new file mode 100644
index 0000000000..35519a2d71
--- /dev/null
+++ b/yql/essentials/core/dqs_expr_nodes/ya.make
@@ -0,0 +1,53 @@
+LIBRARY()
+
+SRCS(
+ dqs_expr_nodes.h
+)
+
+PEERDIR(
+ yql/essentials/core/expr_nodes
+)
+
+SRCDIR(
+ yql/essentials/core/expr_nodes_gen
+)
+
+IF(EXPORT_CMAKE)
+ RUN_PYTHON3(
+ ${ARCADIA_ROOT}/yql/essentials/core/expr_nodes_gen/gen/__main__.py
+ yql_expr_nodes_gen.jnj
+ dqs_expr_nodes.json
+ dqs_expr_nodes.gen.h
+ dqs_expr_nodes.decl.inl.h
+ dqs_expr_nodes.defs.inl.h
+ NDq
+ IN yql_expr_nodes_gen.jnj
+ IN dqs_expr_nodes.json
+ OUT dqs_expr_nodes.gen.h
+ OUT dqs_expr_nodes.decl.inl.h
+ OUT dqs_expr_nodes.defs.inl.h
+ OUTPUT_INCLUDES
+ ${ARCADIA_ROOT}/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h
+ ${ARCADIA_ROOT}/util/generic/hash_set.h
+ )
+ELSE()
+ RUN_PROGRAM(
+ yql/essentials/core/expr_nodes_gen/gen
+ yql_expr_nodes_gen.jnj
+ dqs_expr_nodes.json
+ dqs_expr_nodes.gen.h
+ dqs_expr_nodes.decl.inl.h
+ dqs_expr_nodes.defs.inl.h
+ NDq
+ IN yql_expr_nodes_gen.jnj
+ IN dqs_expr_nodes.json
+ OUT dqs_expr_nodes.gen.h
+ OUT dqs_expr_nodes.decl.inl.h
+ OUT dqs_expr_nodes.defs.inl.h
+ OUTPUT_INCLUDES
+ ${ARCADIA_ROOT}/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.h
+ ${ARCADIA_ROOT}/util/generic/hash_set.h
+ )
+ENDIF()
+
+END()
diff --git a/yql/essentials/core/expr_nodes_gen/gen/__main__.py b/yql/essentials/core/expr_nodes_gen/gen/__main__.py
index b381e64b5d..39e182e194 100755
--- a/yql/essentials/core/expr_nodes_gen/gen/__main__.py
+++ b/yql/essentials/core/expr_nodes_gen/gen/__main__.py
@@ -12,8 +12,13 @@ jsonFile = sys.argv[2]
headerOutFile = sys.argv[3]
declOutFile = sys.argv[4]
defsOutFile = sys.argv[5]
+nodeNspace = sys.argv[6] if len(sys.argv) >= 7 else ""
+nodeNspacePrefix = nodeNspace + "::" if nodeNspace else ""
+
+os.environ['NODES_NAMESPACE'] = nodeNspace
env = Environment(loader=FileSystemLoader(templateDir))
+env.globals['ENV'] = os.getenv
template = env.get_template(templateFilename)
json_data = open(jsonFile)
@@ -24,8 +29,10 @@ json_data.close()
for node in model["Nodes"]:
aux = node["aux"] = {}
+ aux["qName"] = nodeNspacePrefix + node["Name"]
aux["stubName"] = node["Name"] + "Stub"
aux["stubMaybeName"] = node["Name"] + "MaybeStub"
+ aux["qStubMaybeName"] = nodeNspacePrefix + node["Name"] + "MaybeStub"
aux["stubBuilderName"] = node["Name"] + "BuilderStub"
aux["stubBuilderAliasName"] = node["Name"] + "Builder"
@@ -109,6 +116,11 @@ for node in model["Nodes"]:
aux["generateBuilderStub"] = node["Builder"]["Generate"] != "None" and node["Builder"]["Kind"] != "List"
aux["generateBuilder"] = node["Builder"]["Generate"] == "Auto"
+ if isListBuilder(node):
+ if node["Builder"]["ListItemType"] in nodesMap:
+ aux["qListItemType"] = nodeNspacePrefix + node["Builder"]["ListItemType"]
+ else:
+ aux["qListItemType"] = node["Builder"]["ListItemType"]
# Get all children
allChildren = []
@@ -174,6 +186,7 @@ for node in model["Nodes"]:
for child in node["Children"]:
addUsages(child["Type"])
aux["usages"] = usages
+ aux["qUsages"] = [name if name not in nodesMap else nodeNspacePrefix + name for name in usages]
aux["typenames"] = declarations
usages = []
diff --git a/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.jnj b/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.jnj
index 94225db9ea..7d074a070d 100644
--- a/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.jnj
+++ b/yql/essentials/core/expr_nodes_gen/yql_expr_nodes_gen.jnj
@@ -1,5 +1,17 @@
// Auto-generated by {{ generator }}, do not modify.
+{% set nNspace = ENV("NODES_NAMESPACE") %}
+
+{%- if nNspace != "" %}
+
+{% set nPrefix = nNspace + "::" %}
+{% set nNspaceOpen = "namespace " + nNspace + " {" %}
+{% set nNspaceClose = "} // namespace " + nNspace %}
+
+{% else %}
+{% set nPrefix, nNspaceOpen, nNspaceClose = "", "", "" %}
+{%- endif %}
+
{% if genType == "Header" %}
#pragma once
@@ -8,6 +20,7 @@
namespace NYql {
namespace NNodes {
+{{ nNspaceOpen }}
namespace NGenerated {
{% for node in nodes -%}
@@ -243,10 +256,12 @@ public:
{% endfor %}
} // namespace NGenerated
+{{ nNspaceClose }}
} // namespace NNodes
} // namespace NYql
{% elif genType == "Declarations" -%}
+{{ nNspaceOpen }}
{% for node in nodes %}
{%- if node.Definition == "Custom" %}
class {{ node.Name }};
@@ -254,28 +269,32 @@ class {{ node.Name }};
using {{ node.Name }} = NGenerated::{{ node.aux.stubName }}<{{ node.aux.usages | join(", ") }}>;
{% endif %}
{%- endfor %}
+{{ nNspaceClose }}
{% elif genType == "Definitions" -%}
+{{ nNspaceOpen }}
{% for node in nodes %}
static_assert(std::is_constructible<{{ node.Name }}, const TExprNode*>::value,
"{{ node.Name }} isn't defined correctly.");
static_assert(std::is_constructible<{{ node.Name }}, const TExprNode::TPtr&>::value,
"{{ node.Name }} isn't defined correctly.");
{% endfor %}
+{{ nNspaceClose }}
{% for node in nodes %}
template<>
-class TMaybeNode<{{ node.Name }}> : public NGenerated::
- {{ node.aux.stubMaybeName }}<TMaybeNode, {{ node.Name }}, {{ node.aux.usages | join(", ") }}>
+class TMaybeNode<{{ node.aux.qName }}> : public {{ nPrefix }}NGenerated::
+ {{ node.aux.stubMaybeName }}<TMaybeNode, {{ node.aux.qName }}, {{ node.aux.qUsages | join(", ") }}>
{
public:
TMaybeNode(const TExprNode* node = nullptr) : {{ node.aux.stubMaybeName }}(node) {}
TMaybeNode(const TExprNode::TPtr& node) : {{ node.aux.stubMaybeName }}(node) {}
- TMaybeNode(const {{ node.Name }}& node) : {{ node.aux.stubMaybeName }}(node.template Maybe<{{ node.Name }}>()) {}
+ TMaybeNode(const {{ node.aux.qName }}& node) : {{ node.aux.stubMaybeName }}(node.template Maybe<{{ node.aux.qName }}>()) {}
};
{% endfor %}
+{{ nNspaceOpen }}
namespace NGenerated {
{% for node in nodes %}
{%- if node.aux.generateBuilderStub %}
@@ -293,34 +312,35 @@ using {{ node.aux.stubBuilderAliasName }} =
{% endif %}
{%- endfor %}
} // namespace NGenerated
+{{ nNspaceClose }}
{% for node in nodes %}
{%- if node.aux.generateBuilder %}
{% if node.Builder.Kind == "Node" or node.Builder.Kind == "FreeArg" %}
template<typename TParent>
-class TNodeBuilder<TParent, {{ node.Name }}> : public NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>
+class TNodeBuilder<TParent, {{ node.aux.qName }}> : public {{ nPrefix }}NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>
{
private:
- typedef typename NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>::BuildFuncType BuildFuncType;
- typedef typename NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>::GetArgFuncType GetArgFuncType;
+ typedef typename {{ nPrefix }}NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>::BuildFuncType BuildFuncType;
+ typedef typename {{ nPrefix }}NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>::GetArgFuncType GetArgFuncType;
public:
TNodeBuilder(TExprContext& ctx, TPositionHandle pos, BuildFuncType buildFunc, GetArgFuncType getArgFunc)
- : NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>(ctx, pos, buildFunc, getArgFunc) {}
+ : {{ nPrefix }}NGenerated::{{ node.aux.stubBuilderAliasName }}<TParent>(ctx, pos, buildFunc, getArgFunc) {}
{% elif node.Builder.Kind == "List" %}
template<typename TParent>
-class TNodeBuilder<TParent, {{ node.Name }}> : public TListBuilderBase<TParent, {{ node.Name }}, {{ node.Builder.ListItemType }}>
+class TNodeBuilder<TParent, {{ node.aux.qName }}> : public TListBuilderBase<TParent, {{ node.aux.qName }}, {{ node.aux.qListItemType }}>
{
private:
- typedef typename TListBuilderBase<TParent, {{ node.Name }}, {{ node.Builder.ListItemType }}>::BuildFuncType BuildFuncType;
- typedef typename TListBuilderBase<TParent, {{ node.Name }}, {{ node.Builder.ListItemType }}>::GetArgFuncType GetArgFuncType;
+ typedef typename TListBuilderBase<TParent, {{ node.aux.qName }}, {{ node.aux.qListItemType }}>::BuildFuncType BuildFuncType;
+ typedef typename TListBuilderBase<TParent, {{ node.aux.qName }}, {{ node.aux.qListItemType }}>::GetArgFuncType GetArgFuncType;
public:
TNodeBuilder(TExprContext& ctx, TPositionHandle pos, BuildFuncType buildFunc, GetArgFuncType getArgFunc)
- : TListBuilderBase<TParent, {{ node.Name }}, {{ node.Builder.ListItemType }}>(ctx, pos, buildFunc, getArgFunc) {}
+ : TListBuilderBase<TParent, {{ node.aux.qName }}, {{ node.aux.qListItemType }}>(ctx, pos, buildFunc, getArgFunc) {}
{% else %}
class UnknownBuilder {
static_assert(false, "Unknown builder kind: {{ node.Builder.Kind }}.");
{% endif %}
- {{ node.Name }} DoBuild() {
+ {{ node.aux.qName }} DoBuild() {
{%- if node.Match and (node.Match.Type == "Callable" or node.Match.Type == "CallableBase") %}
TExprNode::TListType argsList;
{%- if node.Builder.Kind == "List" %}
@@ -347,7 +367,7 @@ class UnknownBuilder {
{%- else %}
auto node = this->Ctx.NewCallable(this->Pos, "{{ node.Match.Name }}", std::move(argsList));
{%- endif %}
- return {{ node.Name }}(node);
+ return {{ node.aux.qName }}(node);
{%- elif node.Match and node.Match.Type == "Tuple"%}
TExprNode::TListType tupleItems;
{%- for child in node.aux.allChildren %}
@@ -357,14 +377,14 @@ class UnknownBuilder {
}
{%- endfor %}
auto node = this->Ctx.NewList(this->Pos, std::move(tupleItems));
- return {{ node.Name }}(node);
+ return {{ node.aux.qName }}(node);
{%- elif node.ListBase and node.Builder.Kind == "List"%}
TExprNode::TListType nodeChildren;
for (auto child : this->Items) {
nodeChildren.push_back(child.Ptr());
}
auto node = this->Ctx.NewList(this->Pos, std::move(nodeChildren));
- return {{ node.Name }}(node);
+ return {{ node.aux.qName }}(node);
{%- else %}
static_assert(false, "Don't know how to build {{ node.Name }}.");
{% endif %}
diff --git a/yql/essentials/core/ya.make b/yql/essentials/core/ya.make
index 2e253709c2..100103b92f 100644
--- a/yql/essentials/core/ya.make
+++ b/yql/essentials/core/ya.make
@@ -98,7 +98,9 @@ END()
RECURSE(
cbo
credentials
+ dq_expr_nodes
dq_integration
+ dqs_expr_nodes
file_storage
issue
minsketch