java.lang.Object
com.pervasive.datarush.operators.AbstractLogicalOperator
com.pervasive.datarush.operators.CompositeOperator
com.pervasive.datarush.operators.AbstractRecordCompositeOperator
com.pervasive.datarush.operators.select.LimitRows
- All Implemented Interfaces:
LogicalOperator,PipelineOperator<RecordPort>,RecordPipelineOperator
Truncates a flow to a fixed number of records.
The output is a "window" on the original input.
This operator is most often used
on the output of a sort, reducing the original
unsorted data to the top N (as measured by the
sort criteria).
By default, all records are passed through unless explicitly specified.
-
Field Summary
Fields inherited from class com.pervasive.datarush.operators.AbstractRecordCompositeOperator
input, output -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCompose the body of this operator.longgetCount()Gets the maximum number of records which will be output.getInput()Returns the input portReturns the output portlonggetSkip()Gets the number of input records to skip before outputting records.voidsetCount(long count) Sets the maximum number of records which will be output.voidsetSkip(long skip) Sets the number of input records to skip before outputting records.Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pervasive.datarush.operators.LogicalOperator
disableParallelism, getInputPorts, getOutputPorts
-
Constructor Details
-
LimitRows
public LimitRows()Performs no truncation of the input flow. -
LimitRows
public LimitRows(long count) Truncates incoming data to the first N records of the input.- Parameters:
count- the number of records to pass through
-
LimitRows
public LimitRows(long skip, long count) Truncates incoming data to the first N records following a specified record. Records prior to the start position are discarded; if the input contains insufficient records to reach the starting point, the output will contain no records.- Parameters:
skip- the record at which to start passing through records. Indices are zero-based; that is, the first record is at index0.count- the number of records to pass through
-
-
Method Details
-
getInput
Description copied from interface:PipelineOperatorReturns the input port- Specified by:
getInputin interfacePipelineOperator<RecordPort>- Overrides:
getInputin classAbstractRecordCompositeOperator- Returns:
- the input port
-
getOutput
Description copied from interface:PipelineOperatorReturns the output port- Specified by:
getOutputin interfacePipelineOperator<RecordPort>- Overrides:
getOutputin classAbstractRecordCompositeOperator- Returns:
- the output port
-
getCount
public long getCount()Gets the maximum number of records which will be output.- Returns:
- the limit on the number of output records
-
setCount
public void setCount(long count) Sets the maximum number of records which will be output.- Parameters:
count- the limit on the number of output records.- Throws:
InvalidPropertyValueException- ifcount <= 0
-
getSkip
public long getSkip()Gets the number of input records to skip before outputting records.- Returns:
- the index of the first record to pass through
-
setSkip
public void setSkip(long skip) Sets the number of input records to skip before outputting records.- Parameters:
skip- the index of the first record to pass through- Throws:
InvalidPropertyValueException- ifcount < 0
-
compose
Description copied from class:CompositeOperatorCompose the body of this operator. Implementations should do the following:- Perform any validation of configuration, input types, etc
- Instantiate and configure sub-operators, adding them to the provided context via
the method
OperatorComposable.add(O) - Create necessary connections via the method
OperatorComposable.connect(P, P). This includes connections from the composite's input ports to sub-operators, connections between sub-operators, and connections from sub-operators output ports to the composite's output ports
- Specified by:
composein classCompositeOperator- Parameters:
ctx- the context
-