diff --git a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/Node.java b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/Node.java index cedc86dd3b690..ab5bb7579a6bb 100644 --- a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/Node.java +++ b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/Node.java @@ -307,13 +307,11 @@ protected final T transformNodeProps(Class typeToken, Function * Normally, you want to use one of the static {@code create} methods to implement this. *

* For {@code QueryPlan}s, it is very important that * the properties contain all of the expressions and references relevant to this node, and - * that all of the properties are used in the provided constructor; otherwise query plan + * that all the properties are used in the provided constructor; otherwise query plan * transformations like * {@code QueryPlan#transformExpressionsOnly(Function)} * will not have an effect. diff --git a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/NodeInfo.java b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/NodeInfo.java index 28e4e739085d4..856e3a0035a9a 100644 --- a/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/NodeInfo.java +++ b/x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/tree/NodeInfo.java @@ -16,7 +16,13 @@ import static java.util.Collections.unmodifiableList; /** - * Information about a {@link Node}. + * All the information about a {@link Node} that is needed to recreate or modify it. + *

+ * Generally, this will contain the longest constructor of the respective {@link Node} subclass; the non-{@link Source} arguments of that + * constructor are called "properties" of the node and are modified when transforming the node. + *

+ * This allows us to perform traversals and transformations of query plans and expressions without resorting to reflection, e.g. via + * {@link Node#transformNodeProps(Class, Function)}, which is used e.g. in {@code QueryPlan#transformExpressionsDown}. *

* All the uses of this are fairly non-OO and we're looking * for ways to use this less and less.