Class PlanStreamInput
java.lang.Object
java.io.InputStream
org.elasticsearch.common.io.stream.StreamInput
org.elasticsearch.common.io.stream.FilterStreamInput
org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput
org.elasticsearch.xpack.esql.io.stream.PlanStreamInput
- All Implemented Interfaces:
Closeable,AutoCloseable,PlanStreamInput
public final class PlanStreamInput
extends NamedWriteableAwareStreamInput
implements PlanStreamInput
A customized stream input used to deserialize ESQL physical plan fragments. Complements stream
input with methods that read plan nodes, Attributes, Expressions, etc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Mapper of stream named id, represented as a primitive long value, to NameId instance. -
Field Summary
Fields inherited from class org.elasticsearch.common.io.stream.FilterStreamInput
delegate -
Constructor Summary
ConstructorsConstructorDescriptionPlanStreamInput(StreamInput streamInput, NamedWriteableRegistry namedWriteableRegistry, Configuration configuration) PlanStreamInput(StreamInput streamInput, NamedWriteableRegistry namedWriteableRegistry, Configuration configuration, PlanStreamInput.NameIdMapper idMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()mapNameId(long l) <A extends Attribute>
AreadAttributeWithCache(org.elasticsearch.core.CheckedFunction<StreamInput, A, IOException> constructor) Reads an Attribute using the attribute cache.Read aBlockas part of the plan.Block[]Read an array ofBlocks as part of the plan.Reads a cached string, serialized withPlanStreamOutput.writeCachedString(String).<A extends EsField>
AThe query sent by the user to build this plan.Methods inherited from class org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput
namedWriteableRegistry, readNamedWriteable, readNamedWriteable, readNamedWriteableCollectionAsListMethods inherited from class org.elasticsearch.common.io.stream.FilterStreamInput
available, ensureCanReadBytes, getTransportVersion, read, read, readAllToReleasableBytesReference, readByte, readBytes, readInt, readLong, readReleasableBytesReference, readReleasableBytesReference, readShort, readSlicedBytesReference, readString, readVInt, readVLong, reset, setTransportVersion, supportReadAllToReleasableBytesReferenceMethods inherited from class org.elasticsearch.common.io.stream.StreamInput
doReadString, readArray, readArraySize, readBigInteger, readBoolean, readByteArray, readBytesRef, readBytesRef, readBytesReference, readBytesReference, readBytesRefOrNullIfEmpty, readCollection, readCollectionAsImmutableList, readCollectionAsImmutableSet, readCollectionAsList, readCollectionAsSet, readDouble, readDoubleArray, readEnum, readEnumSet, readException, readFloat, readFloatArray, readFully, readGenericMap, readGenericValue, readGeoPoint, readImmutableMap, readImmutableMap, readImmutableOpenMap, readInstant, readIntArray, readLongArray, readMap, readMap, readMapOfLists, readMapValues, readMapValues, readOptional, readOptionalArray, readOptionalBoolean, readOptionalByteArray, readOptionalBytesReference, readOptionalCollectionAsList, readOptionalDouble, readOptionalEnum, readOptionalException, readOptionalFloat, readOptionalFloatArray, readOptionalImmutableMap, readOptionalInstant, readOptionalInt, readOptionalLong, readOptionalNamedWriteable, readOptionalSecureString, readOptionalString, readOptionalStringArray, readOptionalStringCollectionAsList, readOptionalText, readOptionalTimeValue, readOptionalVInt, readOptionalVLong, readOptionalWriteable, readOptionalZoneId, readOrderedMap, readSecureString, readSlicedBytesReference, readStringArray, readStringCollectionAsImmutableList, readStringCollectionAsList, readText, readTimeValue, readVIntArray, readVIntSlow, readVLongArray, readVLongSlow, readZLong, readZoneId, throwEOF, throwOnBrokenVInt, throwOnBrokenVLong, throwOnNullRead, tryReadStringFromBytes, wrap, wrapMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
PlanStreamInput
public PlanStreamInput(StreamInput streamInput, NamedWriteableRegistry namedWriteableRegistry, Configuration configuration) -
PlanStreamInput
public PlanStreamInput(StreamInput streamInput, NamedWriteableRegistry namedWriteableRegistry, Configuration configuration, PlanStreamInput.NameIdMapper idMapper) - Parameters:
idMapper- should always be null in production! Custom mappers are only used in tests to force ID values to be the same after serialization and deserialization, which is not the case when they are generated as usual.
-
-
Method Details
-
configuration
- Throws:
IOException
-
readCachedBlock
Read aBlockas part of the plan.These
Blocks are not tracked byBlockFactoryand closing them does nothing so they should be small. We do make sure not to send duplicates, reusing blocks sent as part of theConfiguration.tables()if possible, otherwise sending a Block inline.- Throws:
IOException
-
readCachedBlockArray
Read an array ofBlocks as part of the plan.These
Blocks are not tracked byBlockFactoryand closing them does nothing so they should be small. We do make sure not to send duplicates, reusing blocks sent as part of theConfiguration.tables()if possible, otherwise sending a Block inline.- Throws:
IOException
-
sourceText
Description copied from interface:PlanStreamInputThe query sent by the user to build this plan. This is used to rebuildSourcewithout sending the query over the wire over and over and over again.- Specified by:
sourceTextin interfacePlanStreamInput
-
mapNameId
Description copied from interface:PlanStreamInputTranslate alonginto aNameId, mapping the samelonginto the sameNameIdeach time. Each newlonggets assigned a unique id to the node, but when the same id is sent in the stream we get the same result.- Specified by:
mapNameIdin interfacePlanStreamInput
-
readAttributeWithCache
public <A extends Attribute> A readAttributeWithCache(org.elasticsearch.core.CheckedFunction<StreamInput, A, throws IOExceptionIOException> constructor) Description copied from interface:PlanStreamInputReads an Attribute using the attribute cache.- Specified by:
readAttributeWithCachein interfacePlanStreamInput- 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
- Specified by:
readEsFieldWithCachein interfacePlanStreamInput- Throws:
IOException
-
readCachedString
Reads a cached string, serialized withPlanStreamOutput.writeCachedString(String).- Specified by:
readCachedStringin interfacePlanStreamInput- Throws:
IOException
-
readOptionalCachedString
- Specified by:
readOptionalCachedStringin interfacePlanStreamInput- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterStreamInput- Throws:
IOException
-