Interface MetadataContext

All Known Subinterfaces:
CompositionContext, DeferredCompositionContext, ExecutionContext, IterativeExecutionContext, IterativeMetadataContext, MetadataCalculationContext, StreamingMetadataContext

public interface MetadataContext
Base interface for various contexts in which port metadata can be resolved.
  • Method Details

    • getSourceMetadata

      PortMetadata getSourceMetadata(LogicalPort logicalPort)
      Returns the source metadata associated with the given port. Note that operators should generally not call this method directly. Rather they should use one of the type-safe/convenience methods on the various subclasses of LogicalPort. For example:
          //get the record type for the "input" RecordPort
          input.getType(ctx)
          //get the full record metadata for the "input" RecordPort
          input.getSourceMetadata(ctx)
       
      Parameters:
      logicalPort - the input port
      Returns:
      the metadata associated with the given port
    • getRequiredMetadata

      PortMetadata getRequiredMetadata(LogicalPort logicalPort)
      Gets the required metadata for the given input. Note that operators should generally not call this method directly. Rather they should use one of the type-safe/convenience methods on the various subclasses of LogicalPort. For example:
          //get the required data ordering for the "input" record port
          input.getRequiredDataOrdering(ctx)
       
      Parameters:
      logicalPort - must be an input port for a non-composite operator
      Returns:
      the required metadata for the given input.
    • getCombinedMetadata

      PortMetadata getCombinedMetadata(LogicalPort logicalPort)
      Returns the source metadata combined with the required metadata to determine the actual metadata that the operator will receive. This also takes into account the operator's max parallelism setting. This method should always be used when determining output metadata as a function of the input metadata. Note that operators should generally not call this method directly. Rather they should use one of the type-safe/convenience methods on the various subclasses of LogicalPort. For example:
          //get the required data ordering for the "input" record port
          input.getCombinedDataOrdering(ctx)
       
      Parameters:
      logicalPort - must be an input port for a non-composite operator.
      Returns:
      the combined metadata
    • isSourceParallel

      boolean isSourceParallel(LogicalPort port)
      Deprecated.
      Returns whether the source of the given port is parallel. If the given logical port is an input port this will return whether the output to which the input is connected is parallel. This is commonly used by operators that wish to determine their parallelism based on whether their source is parallel.
      Parameters:
      port - the port
      Returns:
      whether the source of the given port is parallel
    • getSourceMaxParallelism

      int getSourceMaxParallelism(LogicalPort port)
      Returns whether the max parallelism of the source of this port. If the given logical port is an input port this will return whether max parallelism of the output to which the input is connected is parallel. Operators should seldom need this method directly. However, they may use this method indirectly by specifying a ParallelismStrategy. For example, this is used by ParallelismStrategy.NEGOTIATE_BASED_ON_SOURCE to determine parallelism of an operator based on the input parallelism.
      Parameters:
      port - the port
      Returns:
      whether the source of the given port is parallel
    • isParallel

      boolean isParallel()
      Deprecated.
      Use getMaxParallelism() instead.
      Returns whether the current operator is parallel. Will be true if the operator has declared that it is distributed via StreamingMetadataContext.setParallelizable(boolean) and distribution was not disabled via OperatorSettings#isParallelismDisabled(). For CompositeOperator's and IterativeOperator's this will be true as long as parallelism has not been disabled; if it returns true, the composite node may consist of a mixture of parallel and non-parallel components.
      Returns:
      whether the current operator is parallel.
    • getMaxParallelism

      int getMaxParallelism()
      Returns the max parallelism of the current operator. This will be determined by StreamingMetadataContext.parallelize(ParallelismStrategy). For CompositeOperator's and IterativeOperator's this will be equal to that specified via OperatorSettings.getMaxParallelism(); if it returns a value other than 1, the composite or iterative node may consist of a mixture of parallel and non-parallel components.
      Returns:
      the max parallelism of the current operator.
    • isSourceConnected

      boolean isSourceConnected(LogicalPort inPort)
      Tests whether the given input port is connected. This only applies to ports that were declared as "optional" since graph compilation will fail unless all non-optional ports are connected.
      Parameters:
      inPort - must be an input port
      Returns:
      whether the given input port is connected
    • getPath

      GraphPath getPath()
      Returns the path of the operator being composed.
      Returns:
      the path of the operator being composed.
    • getEngineConfig

      EngineConfig getEngineConfig()
      Returns the engine settings that were passed to the graph being composed/executed.
      Returns:
      the engine settings
    • getFileClient

      FileClient getFileClient()
      Returns the file client to be used within the graph
      Returns:
      the file client to be used for all file access