Class ExecNodeContext

java.lang.Object
org.apache.flink.table.planner.plan.nodes.exec.ExecNodeContext

@Internal public final class ExecNodeContext extends Object
Helper class that holds the necessary identifier fields that are used for JSON plan serialization and deserialization. It is instantiated using newContext(Class) when creating a new instance of an ExecNode, so that is contains the info from the ExecNodeMetadata annotation of the class with the latest ExecNodeMetadata.version(). It can also be instantiated with ExecNodeContext(String) automatically when the ExecNode is deserialized from a JSON Plan, and in this case the ExecNodeContext contains the version that is read from the JSON Plan and not the latest one. The serialization format is <name>_<version>, see getTypeAsString().
  • Constructor Details

    • ExecNodeContext

      public ExecNodeContext(String value)
  • Method Details

    • newNodeId

      public static int newNodeId()
      Generate an unique ID for ExecNode.
    • resetIdCounter

      @VisibleForTesting public static void resetIdCounter()
      Reset the id counter to 0.
    • getName

      public String getName()
      The type identifying an ExecNode in the JSON plan. See ExecNodeMetadata.name().
    • getVersion

      public Integer getVersion()
      The version of the ExecNode in the JSON plan. See ExecNodeMetadata.version().
    • generateUid

      public String generateUid(String transformationName, ExecNodeConfig config)
      Returns a new uid for transformations.
    • withId

      public ExecNodeContext withId(int id)
      Set the unique ID of the node, so that the ExecNodeContext, together with the type related name and version, stores all the necessary info to uniquely reconstruct the ExecNode, and avoid storing the id independently as a field in ExecNodeBase.
    • getTypeAsString

      public String getTypeAsString()
      Returns the name and version, to be serialized into the JSON plan as one string, which in turn will be parsed by ExecNodeContext(String) when deserialized from a JSON plan or when needed by TypeIdResolverBase.typeFromId(DatabindContext, String).
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • newContext

      public static <T extends ExecNode<?>> ExecNodeContext newContext(Class<T> execNodeClass)
    • newPersistedConfig

      public static <T extends ExecNode<?>> org.apache.flink.configuration.ReadableConfig newPersistedConfig(Class<T> execNodeClass, org.apache.flink.configuration.ReadableConfig tableConfig)
      Create a configuration for the ExecNode, ready to be persisted to a JSON plan.
      Parameters:
      execNodeClass - The ExecNode class.
      tableConfig - The planner configuration (include the TableConfig).
      Returns:
      The ExecNode configuration, which contains the consumed options for the node, defined by ExecNodeMetadata.consumedOptions(), along with their values.