Class CopyingLocalSupplier

java.lang.Object
org.elasticsearch.xpack.esql.plan.logical.local.CopyingLocalSupplier
All Implemented Interfaces:
Supplier<Block[]>, NamedWriteable, Writeable, LocalSupplier

public class CopyingLocalSupplier extends Object implements LocalSupplier
A LocalSupplier that allways creates a new copy of the Blocks initially provided at creation time. This is created specifically for InlineStats usage in EsqlSession for queries that use ROW command. The ROW which gets replaced by ReplaceRowAsLocalRelation with a LocalRelation will have its blocks used (and released) at least twice: - the LocalRelation from the left-hand side is used as a source for the right-hand side - the same LocalRelation is then used to continue the execution of the query on the left-hand side It delegates all its operations to ImmediateLocalSupplier and, to prevent the double release, it will always create a deep copy of the blocks received in the constructor initially. Example with the flow and the blocks reuse for a query like "row x = 1 | inlinestats y = max(x)" Step 1: Limit[1000[INTEGER],true] \_InlineJoin[LEFT,[],[],[]] |_Limit[1000[INTEGER],false] | \_LocalRelation[[x{r}#99],[IntVectorBlock[vector=ConstantIntVector[positions=1, value=1]]]] \_Aggregate[[],[MAX(x{r}#99,true[BOOLEAN]) AS y#102]] \_StubRelation[[x{r}#99]] Step 2: Aggregate[[],[MAX(x{r}#99,true[BOOLEAN]) AS y#102]] \_Limit[1000[INTEGER],false] \_LocalRelation[[x{r}#99],[IntVectorBlock[vector=ConstantIntVector[positions=1, value=1]]]] Step 3: Limit[1000[INTEGER],true] \_Eval[[1[INTEGER] AS y#102]] \_Limit[1000[INTEGER],false] \_LocalRelation[[x{r}#99],[IntVectorBlock[vector=ConstantIntVector[positions=1, value=1]]]]