Class NodeInfo<T extends Node<?>>

java.lang.Object
org.elasticsearch.xpack.esql.core.tree.NodeInfo<T>
Type Parameters:
T - actual subclass of node that produced this NodeInfo

public abstract class NodeInfo<T extends Node<?>> extends Object
All the information about a Node that is needed to recreate or modify it.

Generally, this will contain the longest constructor of the respective Node subclass; the non-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 Node.transformNodeProps(Class, Function), which is used e.g. in QueryPlan#transformExpressionsDown.

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

The implementations of this class are super copy-and-paste-ish but they are better then the sneaky reflection tricks we had earlier. Still terrifying.

  • Field Details

    • node

      protected final T extends Node<?> node
  • Method Details

    • properties

      public final List<Object> properties()
      Values for all properties on the instance that created this NodeInfo.
    • innerProperties

      protected abstract List<Object> innerProperties()
    • innerTransform

      protected abstract T innerTransform(Function<Object,Object> rule)
    • create

      public static <T extends Node<?>> NodeInfo<T> create(T n)
      Builds a NodeInfo for Nodes without any properties.
    • create

      public static <T extends Node<?>, P1> NodeInfo<T> create(T n, BiFunction<Source,P1,T> ctor, P1 p1)
    • create

      public static <T extends Node<?>, P1, P2> NodeInfo<T> create(T n, NodeInfo.NodeCtor2<P1,P2,T> ctor, P1 p1, P2 p2)
    • create

      public static <T extends Node<?>, P1, P2, P3> NodeInfo<T> create(T n, NodeInfo.NodeCtor3<P1,P2,P3,T> ctor, P1 p1, P2 p2, P3 p3)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4> NodeInfo<T> create(T n, NodeInfo.NodeCtor4<P1,P2,P3,P4,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4, P5> NodeInfo<T> create(T n, NodeInfo.NodeCtor5<P1,P2,P3,P4,P5,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4, P5, P6> NodeInfo<T> create(T n, NodeInfo.NodeCtor6<P1,P2,P3,P4,P5,P6,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4, P5, P6, P7> NodeInfo<T> create(T n, NodeInfo.NodeCtor7<P1,P2,P3,P4,P5,P6,P7,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4, P5, P6, P7, P8> NodeInfo<T> create(T n, NodeInfo.NodeCtor8<P1,P2,P3,P4,P5,P6,P7,P8,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4, P5, P6, P7, P8, P9> NodeInfo<T> create(T n, NodeInfo.NodeCtor9<P1,P2,P3,P4,P5,P6,P7,P8,P9,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9)
    • create

      public static <T extends Node<?>, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> NodeInfo<T> create(T n, NodeInfo.NodeCtor10<P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,T> ctor, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10)