Class NoFrameSupportTemplate
java.lang.Object
org.apache.drill.exec.physical.impl.window.NoFrameSupportTemplate
- All Implemented Interfaces:
WindowFramer
WindowFramer implementation that doesn't support the FRAME clause (will
assume the default frame).
According to the SQL standard, LEAD, LAG, ROW_NUMBER, NTILE and all ranking functions don't support the FRAME clause. This class will handle such functions.
-
Field Summary
Fields inherited from interface org.apache.drill.exec.physical.impl.window.WindowFramer
FRAME_TEMPLATE_DEFINITION, NOFRAME_TEMPLATE_DEFINITION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()abstract voidcopyFromInternal(int inIndex, int outIndex) abstract voidcopyNext(int inIndex, int outIndex) Copies value(s) from inIndex row to outIndex row.abstract voidcopyPrev(int inIndex, int outIndex) Copies value(s) from inIndex row to outIndex row.voiddoWork()Processes all rows of the first batch.intabstract booleanisPeer(int b1Index, VectorAccessible b1, int b2Index, VectorAccessible b2) Compares two rows from different batches (can be the same), if they have the same value for the order by expressionabstract booleanisSamePartition(int b1Index, VectorAccessible b1, int b2Index, VectorAccessible b2) Compares two rows from different batches (can be the same), if they have the same value for the partition by expressionabstract voidCalled once for each row after we evaluate all peer rows.abstract booleanReset all window functionsvoidsetup(List<WindowDataBatch> batches, VectorContainer container, OperatorContext oContext, boolean requireFullPartition, WindowPOP popConfig) abstract voidsetupCopyFromInternal(VectorAccessible incoming, VectorAccessible outgoing) abstract voidsetupCopyNext(VectorAccessible incoming, VectorAccessible outgoing) abstract voidsetupCopyPrev(VectorAccessible incoming, VectorAccessible outgoing) abstract voidsetupPartition(WindowDataBatch incoming, VectorAccessible outgoing) Called once per partition, before processing the partition.toString()
-
Constructor Details
-
NoFrameSupportTemplate
public NoFrameSupportTemplate()
-
-
Method Details
-
setup
public void setup(List<WindowDataBatch> batches, VectorContainer container, OperatorContext oContext, boolean requireFullPartition, WindowPOP popConfig) throws SchemaChangeException - Specified by:
setupin interfaceWindowFramer- Throws:
SchemaChangeException
-
doWork
public void doWork()Processes all rows of the first batch.- Specified by:
doWorkin interfaceWindowFramer
-
getOutputCount
public int getOutputCount()- Specified by:
getOutputCountin interfaceWindowFramer- Returns:
- number rows processed in last batch
-
cleanup
public void cleanup()- Specified by:
cleanupin interfaceWindowFramer
-
toString
-
outputRow
public abstract void outputRow(@Named("outIndex") int outIndex, @Named("partition") Partition partition) throws SchemaChangeException Called once for each row after we evaluate all peer rows. Used to write a value in the row- Parameters:
outIndex- index of rowpartition- object used by "computed" window functions- Throws:
SchemaChangeException
-
setupPartition
public abstract void setupPartition(@Named("incoming") WindowDataBatch incoming, @Named("outgoing") VectorAccessible outgoing) throws SchemaChangeException Called once per partition, before processing the partition. Used to setup read/write vectors- Parameters:
incoming- batch we will read fromoutgoing- batch we will be writing to- Throws:
SchemaChangeException
-
copyNext
public abstract void copyNext(@Named("inIndex") int inIndex, @Named("outIndex") int outIndex) throws SchemaChangeException Copies value(s) from inIndex row to outIndex row. Mostly used by LEAD. inIndex always points to the row next to outIndex- Parameters:
inIndex- source row of the copyoutIndex- destination row of the copy.- Throws:
SchemaChangeException
-
setupCopyNext
public abstract void setupCopyNext(@Named("incoming") VectorAccessible incoming, @Named("outgoing") VectorAccessible outgoing) throws SchemaChangeException - Throws:
SchemaChangeException
-
copyPrev
public abstract void copyPrev(@Named("inIndex") int inIndex, @Named("outIndex") int outIndex) throws SchemaChangeException Copies value(s) from inIndex row to outIndex row. Mostly used by LAG. inIndex always points to the previous row- Parameters:
inIndex- source row of the copyoutIndex- destination row of the copy.- Throws:
SchemaChangeException
-
setupCopyPrev
public abstract void setupCopyPrev(@Named("incoming") VectorAccessible incoming, @Named("outgoing") VectorAccessible outgoing) throws SchemaChangeException - Throws:
SchemaChangeException
-
copyFromInternal
public abstract void copyFromInternal(@Named("inIndex") int inIndex, @Named("outIndex") int outIndex) throws SchemaChangeException - Throws:
SchemaChangeException
-
setupCopyFromInternal
public abstract void setupCopyFromInternal(@Named("incoming") VectorAccessible incoming, @Named("outgoing") VectorAccessible outgoing) throws SchemaChangeException - Throws:
SchemaChangeException
-
resetValues
Reset all window functions- Throws:
SchemaChangeException
-
isSamePartition
public abstract boolean isSamePartition(@Named("b1Index") int b1Index, @Named("b1") VectorAccessible b1, @Named("b2Index") int b2Index, @Named("b2") VectorAccessible b2) throws SchemaChangeException Compares two rows from different batches (can be the same), if they have the same value for the partition by expression- Specified by:
isSamePartitionin interfaceWindowFramer- Parameters:
b1Index- index of first rowb1- batch for first rowb2Index- index of second rowb2- batch for second row- Returns:
- true if the rows are in the same partition
- Throws:
SchemaChangeException
-
isPeer
public abstract boolean isPeer(@Named("b1Index") int b1Index, @Named("b1") VectorAccessible b1, @Named("b2Index") int b2Index, @Named("b2") VectorAccessible b2) throws SchemaChangeException Compares two rows from different batches (can be the same), if they have the same value for the order by expression- Specified by:
isPeerin interfaceWindowFramer- Parameters:
b1Index- index of first rowb1- batch for first rowb2Index- index of second rowb2- batch for second row- Returns:
- true if the rows are in the same partition
- Throws:
SchemaChangeException
-