java.lang.Object
com.pervasive.datarush.operators.AbstractLogicalOperator
com.pervasive.datarush.operators.CompositeOperator
com.pervasive.datarush.operators.AbstractRecordCompositeOperator
com.pervasive.datarush.analytics.stats.DistinctValues
- All Implemented Interfaces:
LogicalOperator,PipelineOperator<RecordPort>,RecordPipelineOperator
Calculates distinct values of the given input field. This produces a
record consisting of the following fields:
- inputField: the value from the original dataset
- count_inputField the number of occurrences of that value
-
Field Summary
Fields inherited from class com.pervasive.datarush.operators.AbstractRecordCompositeOperator
input, output -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DistinctValues(String inputField) Computes distinct values for the given input field -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCompose the body of this operator.getInput()Returns the input portReturns the input field for which we calculate distinct valuesReturns the output portbooleanReturns a hint as to whether there are expected to be a small number of distinct values.booleanReturns whether to sort by value count.voidsetFewDistinctValuesHint(boolean fewDistinctValuesHint) Sets a hint as to whether there are expected to be a small number of distinct values.voidsetInputField(String inputField) Sets the input field for which we calculate distinct valuesvoidsetSortByCount(boolean sortByCount) Sets whether to sort by value count.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
-
DistinctValues
public DistinctValues()Default constructor. Prior to graph compilation the following property must be set: -
DistinctValues
Computes distinct values for the given input field- Parameters:
inputField- the input field for which we calculate distinct values
-
-
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
-
getInputField
Returns the input field for which we calculate distinct values- Returns:
- the input field for which we calculate distinct values
-
setInputField
Sets the input field for which we calculate distinct values- Parameters:
inputField- the input field for which we calculate distinct values
-
isSortByCount
public boolean isSortByCount()Returns whether to sort by value count. This is false by default and thus output order is unspecified.- Returns:
- whether to sort by value count
-
setSortByCount
public void setSortByCount(boolean sortByCount) Sets whether to sort by value count. This is false by default and thus output order is unspecified.- Parameters:
sortByCount- whether to sort by value count
-
isFewDistinctValuesHint
public boolean isFewDistinctValuesHint()Returns a hint as to whether there are expected to be a small number of distinct values. If not, we eagerly sort up-front.- Returns:
- whether few distinct values are expected
-
setFewDistinctValuesHint
public void setFewDistinctValuesHint(boolean fewDistinctValuesHint) Sets a hint as to whether there are expected to be a small number of distinct values. If not, we eagerly sort up-front.- Parameters:
fewDistinctValuesHint- whether few distinct values are expected
-
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
-