Class PlanStreamOutput
java.lang.Object
java.io.OutputStream
org.elasticsearch.common.io.stream.StreamOutput
org.elasticsearch.xpack.esql.io.stream.PlanStreamOutput
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,PlanStreamOutput
A customized stream output used to serialize ESQL physical plan fragments. Complements stream
output with methods that write plan nodes, Attributes, Expressions, etc.
-
Field Summary
FieldsModifier and TypeFieldDescriptionCache for field attributes.Cache for EsFields.protected static final intmax number of attributes that can be cached for serializationFields inherited from class org.elasticsearch.common.io.stream.StreamOutput
GENERIC_LIST_HEADER -
Constructor Summary
ConstructorsConstructorDescriptionPlanStreamOutput(StreamOutput delegate, Configuration configuration) PlanStreamOutput(StreamOutput delegate, Configuration configuration, int maxSerializedAttributes) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidsetTransportVersion(TransportVersion version) booleanwriteAttributeCacheHeader(Attribute attribute) voidwriteByte(byte b) voidwriteBytes(byte[] b, int offset, int length) voidwriteCachedBlock(Block block) Write aBlockas part of the plan.voidwriteCachedString(String string) Writes a string caching it, ie.booleanwriteEsFieldCacheHeader(EsField field) voidMethods inherited from class org.elasticsearch.common.io.stream.StreamOutput
checkWriteable, legacyWriteWithSizePrefix, position, putVInt, write, write, writeArray, writeArray, writeBigInteger, writeBoolean, writeByteArray, writeBytes, writeBytes, writeBytesRef, writeBytesReference, writeCollection, writeCollection, writeDouble, writeDoubleArray, writeDoubleLE, writeEnum, writeEnumSet, writeException, writeFloat, writeFloatArray, writeGenericList, writeGenericMap, writeGenericNull, writeGenericString, writeGenericValue, writeGeoPoint, writeInstant, writeInt, writeIntArray, writeIntLE, writeLong, writeLongArray, writeLongLE, writeMap, writeMap, writeMap, writeMapValues, writeMapValues, writeMapWithConsistentOrder, writeMissingString, writeMissingWriteable, writeNamedWriteable, writeNamedWriteableCollection, writeOptional, writeOptionalArray, writeOptionalArray, writeOptionalBoolean, writeOptionalByteArray, writeOptionalBytesReference, writeOptionalCollection, writeOptionalCollection, writeOptionalDouble, writeOptionalEnum, writeOptionalFloat, writeOptionalFloatArray, writeOptionalInstant, writeOptionalInt, writeOptionalLong, writeOptionalNamedWriteable, writeOptionalSecureString, writeOptionalString, writeOptionalStringArray, writeOptionalStringCollection, writeOptionalText, writeOptionalTimeValue, writeOptionalVInt, writeOptionalVLong, writeOptionalWriteable, writeOptionalZoneId, writeSecureString, writeShort, writeString, writeStringArray, writeStringArrayNullable, writeStringCollection, writeText, writeTimeValue, writeVInt, writeVIntArray, writeVLong, writeVLongArray, writeWithSizePrefix, writeWriteable, writeZLong, writeZoneIdMethods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
MAX_SERIALIZED_ATTRIBUTES
protected static final int MAX_SERIALIZED_ATTRIBUTESmax number of attributes that can be cached for serializationTODO should this be a cluster setting...?
- See Also:
-
cachedAttributes
Cache for field attributes. Field attributes can be a significant part of the query execution plan, especially for queries like `from *`, that can have thousands of output columns. Attributes can be shared by many plan nodes (eg. ExcahngeSink output, Project output, EsRelation fields); in addition, multiple Attributes can share the same parent field. This cache allows to send each attribute only once; from the second occurrence, only an id will be sent -
cachedEsFields
Cache for EsFields. -
stringCache
-
-
Constructor Details
-
PlanStreamOutput
public PlanStreamOutput(StreamOutput delegate, @Nullable Configuration configuration) throws IOException - Throws:
IOException
-
PlanStreamOutput
public PlanStreamOutput(StreamOutput delegate, @Nullable Configuration configuration, int maxSerializedAttributes) throws IOException - Throws:
IOException
-
-
Method Details
-
writeByte
- Specified by:
writeBytein classStreamOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin classStreamOutput- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classStreamOutput- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classStreamOutput- Throws:
IOException
-
getTransportVersion
- Overrides:
getTransportVersionin classStreamOutput
-
setTransportVersion
- Overrides:
setTransportVersionin classStreamOutput
-
writeCachedBlock
Write 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
-
writeAttributeCacheHeader
- Specified by:
writeAttributeCacheHeaderin interfacePlanStreamOutput- Throws:
IOException
-
writeEsFieldCacheHeader
- Specified by:
writeEsFieldCacheHeaderin interfacePlanStreamOutput- Throws:
IOException
-
writeCachedString
Writes a string caching it, ie. the second time the same string is written, only a small, numeric ID will be sent. This should be used only to serialize recurring strings. Values serialized with this method have to be deserialized withPlanStreamInput.readCachedString()- Specified by:
writeCachedStringin interfacePlanStreamOutput- Throws:
IOException
-
writeOptionalCachedString
- Specified by:
writeOptionalCachedStringin interfacePlanStreamOutput- Throws:
IOException
-