Skip to content

Commit

Permalink
Improve collector insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Hafner committed Dec 31, 2024
1 parent 994b645 commit 8d25a70
Show file tree
Hide file tree
Showing 20 changed files with 287 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public final Exchange copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
return copy( traitSet, sole( inputs ), distribution );
}

public final Exchange copy(List<AlgNode> inputs ) {
return copy( traitSet, sole( inputs ), distribution );
}

public abstract Exchange copy( AlgTraitSet traitSet, AlgNode newInput, AlgDistribution newDistribution );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public AlgNode copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
}



@Override
public AlgWriter explainTerms( AlgWriter pw ) {
return super.explainTerms( pw )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
*/
public abstract class RelTableFunctionScan extends AbstractAlgNode {

private final RexNode rexCall;
protected final RexNode rexCall;

private final Type elementType;
protected final Type elementType;

private ImmutableList<AlgNode> inputs;

Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/org/polypheny/db/algebra/core/SetOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public SetOp copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
}


public SetOp copy( List<AlgNode> inputs ) {
return copy( traitSet, inputs, all );
}


@Override
public void replaceInput( int ordinalInParent, AlgNode p ) {
final List<AlgNode> newInputs = new ArrayList<>( inputs );
Expand Down Expand Up @@ -145,6 +150,7 @@ public boolean isHomogeneous( boolean compareNames ) {
return true;
}


@Override
public boolean isDataModifying() {
return false;
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/org/polypheny/db/algebra/core/Sort.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ public final Sort copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
return copy( traitSet, sole( inputs ), collation, fieldExps, offset, fetch );
}

public final Sort copy( List<AlgNode> inputs ) {
return copy( traitSet, sole( inputs ), collation, fieldExps, offset, fetch );
}

public abstract Sort copy( AlgTraitSet traitSet, AlgNode newInput, AlgCollation newCollation, ImmutableList<RexNode> fieldExps, RexNode offset, RexNode fetch );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,21 @@ public AlgNode copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
return lce;
}

public AlgNode copy( List<AlgNode> inputs ) {
final LogicalConditionalExecute lce = new LogicalConditionalExecute(
inputs.get( 0 ).getCluster(),
traitSet,
inputs.get( 0 ),
inputs.get( 1 ),
condition,
exceptionClass,
exceptionMessage );
lce.setCheckDescription( checkDescription );
lce.setLogicalNamespace( logicalNamespace );
lce.setCatalogTable( catalogTable );
lce.setCatalogColumns( catalogColumns );
lce.setValues( values );
return lce;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ public AlgNode copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
this.getExceptionMessages() );
}

public AlgNode copy( List<AlgNode> inputs ) {
return new LogicalConstraintEnforcer(
inputs.get( 0 ).getCluster(),
traitSet,
inputs.get( 0 ),
inputs.get( 1 ),
this.getExceptionClasses(),
this.getExceptionMessages() );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected LogicalDocIdCollector( AlgCluster cluster, AlgTraitSet traits, Transac
}


public static LogicalDocIdCollector create( Transaction transaction, Entity entity, final AlgNode input ) {
public static LogicalDocIdCollector create( final AlgNode input, Transaction transaction, Entity entity ) {
final AlgCluster cluster = input.getCluster();
final AlgTraitSet traits = input.getTraitSet();
return new LogicalDocIdCollector( cluster, traits, transaction, entity, input );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected LogicalLpgIdCollector( AlgCluster cluster, AlgTraitSet traits, Transac
}


public static LogicalLpgIdCollector create( Transaction transaction, Entity entity, final AlgNode input ) {
public static LogicalLpgIdCollector create( final AlgNode input, Transaction transaction, Entity entity ) {
final AlgCluster cluster = input.getCluster();
final AlgTraitSet traits = input.getTraitSet();
return new LogicalLpgIdCollector( cluster, traits, transaction, entity, input );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public LogicalRelAggregate copy( AlgTraitSet traitSet, AlgNode input, boolean in
return new LogicalRelAggregate( getCluster(), traitSet, input, indicator, groupSet, groupSets, aggCalls );
}

public LogicalRelAggregate copy( AlgNode input) {
assert traitSet.containsIfApplicable( Convention.NONE );
return new LogicalRelAggregate( getCluster(), traitSet, input, indicator, groupSet, groupSets, aggCalls );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ public LogicalRelCorrelate copy(
return new LogicalRelCorrelate( getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType );
}

public LogicalRelCorrelate copy(
AlgNode left,
AlgNode right) {
assert traitSet.containsIfApplicable( Convention.NONE );
return new LogicalRelCorrelate( getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public LogicalRelFilter copy( AlgTraitSet traitSet, AlgNode input, RexNode condi
return new LogicalRelFilter( getCluster(), traitSet, input, condition, variablesSet );
}

public LogicalRelFilter copy( AlgNode input) {
assert traitSet.containsIfApplicable( Convention.NONE );
return new LogicalRelFilter( getCluster(), traitSet, input, condition, variablesSet );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public LogicalRelIntersect copy( AlgTraitSet traitSet, List<AlgNode> inputs, boo
return new LogicalRelIntersect( getCluster(), traitSet, inputs, all );
}

public LogicalRelIntersect copy(List<AlgNode> inputs) {
return new LogicalRelIntersect( getCluster(), traitSet, inputs, all );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ public LogicalRelJoin copy( AlgTraitSet traitSet, RexNode conditionExpr, AlgNode
return new LogicalRelJoin( getCluster(), getCluster().traitSetOf( Convention.NONE ).replace( ModelTrait.RELATIONAL ), left, right, conditionExpr, variablesSet, joinType, semiJoinDone );
}

public LogicalRelJoin copy( AlgNode left, AlgNode right) {
assert traitSet.containsIfApplicable( Convention.NONE );
return new LogicalRelJoin( getCluster(), getCluster().traitSetOf( Convention.NONE ).replace( ModelTrait.RELATIONAL ), left, right, condition, variablesSet, joinType, semiJoinDone );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public Match copy(
return new LogicalRelMatch( getCluster(), traitSet, input, rowType, pattern, strictStart, strictEnd, patternDefinitions, measures, after, subsets, allRows, partitionKeys, orderKeys, interval );
}

public Match copy( AlgNode input ) {
final AlgTraitSet traitSet = getCluster().traitSetOf( Convention.NONE );
return new LogicalRelMatch( getCluster(), traitSet, input, rowType, pattern, strictStart, strictEnd, patternDefinitions, measures, after, subsets, allRows, partitionKeys, orderKeys, interval );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public LogicalRelModify copy( AlgTraitSet traitSet, List<AlgNode> inputs ) {
}


public LogicalRelModify copy( List<AlgNode> inputs ) {
assert traitSet.containsIfApplicable( Convention.NONE );
return (LogicalRelModify) new LogicalRelModify( getCluster(), traitSet, entity, sole( inputs ), getOperation(), getUpdateColumns(), getSourceExpressions(), isFlattened() ).streamed( streamed );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
return shuttle.visit( this );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public LogicalRelProject copy( AlgTraitSet traitSet, AlgNode input, List<RexNode
}


public LogicalRelProject copy( AlgNode input ) {
return new LogicalRelProject( getCluster(), traitSet, input, exps, rowType );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
return shuttle.visit( this );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public LogicalRelTableFunctionScan copy( AlgTraitSet traitSet, List<AlgNode> inp
return new LogicalRelTableFunctionScan( getCluster(), traitSet, inputs, rexCall, elementType, rowType, columnMappings );
}

public LogicalRelTableFunctionScan copy( List<AlgNode> inputs) {
assert traitSet.containsIfApplicable( Convention.NONE );
return new LogicalRelTableFunctionScan( getCluster(), traitSet, inputs, rexCall, elementType, rowType, columnMappings );
}


@Override
public AlgOptCost computeSelfCost( AlgPlanner planner, AlgMetadataQuery mq ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public LogicalRelUnion copy( AlgTraitSet traitSet, List<AlgNode> inputs, boolean
return new LogicalRelUnion( getCluster(), traitSet, inputs, all );
}

public LogicalRelUnion copy( List<AlgNode> inputs) {
assert traitSet.containsIfApplicable( Convention.NONE );
return new LogicalRelUnion( getCluster(), traitSet, inputs, all );
}


@Override
public AlgNode accept( AlgShuttle shuttle ) {
Expand Down
Loading

0 comments on commit 8d25a70

Please sign in to comment.