- java.lang.Object
-
- com.pervasive.datarush.operators.AbstractLogicalOperator
-
- com.pervasive.datarush.operators.CompositeOperator
-
- com.pervasive.datarush.operators.join.AbstractRelationalJoin
-
- All Implemented Interfaces:
LogicalOperator
- Direct Known Subclasses:
FilterExistingRows,Join,SemiJoin
public abstract class AbstractRelationalJoin extends CompositeOperator
Common base class for the various types of join that we support.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRelationalJoin()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcompose(CompositionContext ctx)Compose the body of this operator.protected abstract RecordPortcomposeJoin(CompositionContext ctx, RecordPort left, RecordPort right, JoinKey[] keys)ScalarValuedFunctiongetJoinCondition()If non-null, the condition is evaluated for every possible matching row.JoinKey[]getJoinKeys()Returns the join keys to use when performing the join.RecordPortgetLeft()Returns the left input port.RecordPortgetOutput()Returns the output port.RecordPortgetRight()Returns the right input port.booleangetUseHashJoinHint()Returns whether to perform the join as a hash join.protected intnewJoinID()voidsetJoinCondition(ScalarValuedFunction joinCondition)Sets the join condition.voidsetJoinCondition(String joinCondition)Sets the join condition.voidsetJoinKeys(JoinKey[] joinKeys)Sets the join keys to use when performing the join.voidsetJoinKeys(String[] keyFieldNames)Sets the join keys to use when performing the join.voidsetJoinKeys(String[] leftKeyFieldNames, String[] rightKeyFieldNames)Sets the join keys to use when performing the join.voidsetJoinKeys(List<JoinKey> joinKeys)Sets the join keys to use when performing the join.voidsetUseHashJoinHint(boolean useHashJoinHint)Sets whether to perform the join as a hash join.-
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
-
-
-
Method Detail
-
getLeft
public RecordPort getLeft()
Returns the left input port.- Returns:
- the left input port.
-
getRight
public RecordPort getRight()
Returns the right input port.- Returns:
- the right input port
-
getOutput
public RecordPort getOutput()
Returns the output port. This will output the joined data.- Returns:
- the output port.
-
getJoinCondition
public final ScalarValuedFunction getJoinCondition()
If non-null, the condition is evaluated for every possible matching row. Only those rows for which the keys match and the condition returns true will be output as an inner join. When determining the set of rows to output for an outer join, we output the set for which the join condition never evaluated to true. Note that, if specified, the left fields and right fields must be distinct from each other. This is because the function will be evaluated in a namespace containing all fields from the left and right.- Returns:
- the join condition
-
setJoinCondition
public final void setJoinCondition(ScalarValuedFunction joinCondition)
Sets the join condition. If non-null, the condition is evaluated for every possible matching row. Only those rows for which the keys match and the condition returns true will be output as an inner join. When determining the set of rows to output for an outer join, we output the set for which the join condition never evaluated to true. Note that, if specified, the left fields and right fields must be distinct from each other. This is because the function will be evaluated in a namespace containing all fields from the left and right.- Parameters:
joinCondition- the join condition
-
setJoinCondition
public final void setJoinCondition(String joinCondition)
Sets the join condition. If non-null, the condition is evaluated for every possible matching row. Only those rows for which the keys match and the condition returns true will be output as an inner join. When determining the set of rows to output for an outer join, we output the set for which the join condition never evaluated to true. Note that, if specified, the left fields and right fields must be distinct from each other. This is because the function will be evaluated in a namespace containing all fields from the left and right.- Parameters:
joinCondition- a predicate expression in SQL-like syntax parsed into the join condition
-
getUseHashJoinHint
public final boolean getUseHashJoinHint()
Returns whether to perform the join as a hash join. If so, all rows on the right side will be loaded into into memory and joined with the left. This is an optimization for the case where the right side is small enough to fit into memory since it implies that the left side need not be sorted or repartitioned.- Returns:
- whether to perform the join as a hash join
-
setUseHashJoinHint
public final void setUseHashJoinHint(boolean useHashJoinHint)
Sets whether to perform the join as a hash join. If so, all rows on the right side will be loaded into into memory and joined with the left. This is an optimization for the case where the right side is small enough to fit into memory since it implies that the left side need not be sorted or repartitioned.- Parameters:
useHashJoinHint- whether to perform the join as a hash join
-
getJoinKeys
public final JoinKey[] getJoinKeys()
Returns the join keys to use when performing the join.- Returns:
- the join keys to use when performing the join.
-
setJoinKeys
public final void setJoinKeys(JoinKey[] joinKeys)
Sets the join keys to use when performing the join.- Parameters:
joinKeys- the join keys to use when performing the join.
-
setJoinKeys
public final void setJoinKeys(String[] keyFieldNames)
Sets the join keys to use when performing the join.- Parameters:
keyFieldNames- the join keys to use when performing the join.
-
setJoinKeys
public final void setJoinKeys(List<JoinKey> joinKeys)
Sets the join keys to use when performing the join.- Parameters:
joinKeys- the join keys to use when performing the join.
-
setJoinKeys
public final void setJoinKeys(String[] leftKeyFieldNames, String[] rightKeyFieldNames)
Sets the join keys to use when performing the join.- Parameters:
leftKeyFieldNames- the left join keys to use when performing the join.rightKeyFieldNames- the right join keys to use when performing the join.
-
newJoinID
protected final int newJoinID()
-
composeJoin
protected abstract RecordPort composeJoin(CompositionContext ctx, RecordPort left, RecordPort right, JoinKey[] keys)
-
compose
protected void compose(CompositionContext ctx)
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
-
-