Class PlanStreamInput

All Implemented Interfaces:
Closeable, AutoCloseable

public final class PlanStreamInput extends NamedWriteableAwareStreamInput
A customized stream input used to deserialize ESQL physical plan fragments. Complements stream input with methods that read plan nodes, Attributes, Expressions, etc.
  • Constructor Details

  • Method Details

    • configuration

      public Configuration configuration() throws IOException
      Throws:
      IOException
    • readCachedBlock

      public Block readCachedBlock() throws IOException
      Read a Block as part of the plan.

      These Blocks are not tracked by BlockFactory and closing them does nothing so they should be small. We do make sure not to send duplicates, reusing blocks sent as part of the Configuration.tables() if possible, otherwise sending a Block inline.

      Throws:
      IOException
    • readCachedBlockArray

      public Block[] readCachedBlockArray() throws IOException
      Read an array of Blocks as part of the plan.

      These Blocks are not tracked by BlockFactory and closing them does nothing so they should be small. We do make sure not to send duplicates, reusing blocks sent as part of the Configuration.tables() if possible, otherwise sending a Block inline.

      Throws:
      IOException
    • sourceText

      public String sourceText()
      The query sent by the user to build this plan. This is used to rebuild Source without sending the query over the wire over and over and over again.
    • sourceText

      public String sourceText(String viewName)
      Returns the query text for the given view name, or the main query if viewName is null. This is used during Source deserialization to look up the correct query string based on where the Source originated from.
    • mapNameId

      public NameId mapNameId(long l)
      Translate a long into a NameId, mapping the same long into the same NameId each time. Each new long gets assigned a unique id to the node, but when the same id is sent in the stream we get the same result.
    • readAttributeWithCache

      public <A extends Attribute> A readAttributeWithCache(org.elasticsearch.core.CheckedFunction<StreamInput,A,IOException> constructor) throws IOException
      Reads an Attribute using the attribute cache.
      Parameters:
      constructor - the constructor needed to build the actual attribute when read from the wire
      Returns:
      An attribute; this will generally be the same type as the provided constructor
      Throws:
      IOException
    • readEsFieldWithCache

      public <A extends EsField> A readEsFieldWithCache() throws IOException
      Throws:
      IOException
    • readCachedString

      public String readCachedString() throws IOException
      Reads a cached string, serialized with PlanStreamOutput.writeCachedString(String).
      Throws:
      IOException
    • readOptionalCachedString

      public String readOptionalCachedString() throws IOException
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class FilterStreamInput
      Throws:
      IOException