Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue on Apache Tez where a split before and subsequent splicin…
…g back into a c.p.HashJoin could create an invalid plan.
- Loading branch information
Showing
5 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
.../cascading/flow/tez/planner/rule/expression/BalanceSplitToStreamedHashJoinExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (c) 2007-2015 Concurrent, Inc. All Rights Reserved. | ||
* | ||
* Project and contact information: http://www.cascading.org/ | ||
* | ||
* This file is part of the Cascading project. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package cascading.flow.tez.planner.rule.expression; | ||
|
||
import cascading.flow.planner.iso.expression.ElementCapture; | ||
import cascading.flow.planner.iso.expression.ExpressionGraph; | ||
import cascading.flow.planner.iso.expression.FlowElementExpression; | ||
import cascading.flow.planner.iso.expression.PathScopeExpression; | ||
import cascading.flow.planner.iso.expression.TypeExpression; | ||
import cascading.flow.planner.rule.RuleExpression; | ||
import cascading.pipe.Boundary; | ||
import cascading.pipe.HashJoin; | ||
import cascading.pipe.Pipe; | ||
|
||
import static cascading.flow.planner.iso.expression.AndElementExpression.and; | ||
import static cascading.flow.planner.iso.expression.NotElementExpression.not; | ||
|
||
/** | ||
* | ||
*/ | ||
public class BalanceSplitToStreamedHashJoinExpression extends RuleExpression | ||
{ | ||
private static final FlowElementExpression SHARED_SPLIT = new FlowElementExpression( Pipe.class, TypeExpression.Topo.Split ); | ||
public static final FlowElementExpression SHARED_HASHJOIN = new FlowElementExpression( HashJoin.class ); | ||
|
||
public BalanceSplitToStreamedHashJoinExpression() | ||
{ | ||
super( | ||
new ExpressionGraph( | ||
and( | ||
ElementCapture.Primary, | ||
not( and( new FlowElementExpression( Pipe.class, TypeExpression.Topo.Split ), not( new FlowElementExpression( Boundary.class ) ) ) ), | ||
not( new FlowElementExpression( HashJoin.class ) ) ) ), | ||
|
||
new ExpressionGraph() | ||
.arcs( SHARED_SPLIT, SHARED_HASHJOIN ) | ||
.arcs( SHARED_SPLIT, SHARED_HASHJOIN ), | ||
|
||
new ExpressionGraph() | ||
.arc( | ||
and( ElementCapture.Secondary, new FlowElementExpression( Pipe.class ), not( new FlowElementExpression( Boundary.class ) ) ), | ||
PathScopeExpression.NON_BLOCKING, | ||
new FlowElementExpression( ElementCapture.Primary, HashJoin.class ) | ||
) | ||
); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../flow/tez/planner/rule/transformer/BoundaryBalanceSplitToStreamedHashJoinTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (c) 2007-2015 Concurrent, Inc. All Rights Reserved. | ||
* | ||
* Project and contact information: http://www.cascading.org/ | ||
* | ||
* This file is part of the Cascading project. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package cascading.flow.tez.planner.rule.transformer; | ||
|
||
import cascading.flow.planner.iso.expression.ElementCapture; | ||
import cascading.flow.planner.rule.transformer.BoundaryElementFactory; | ||
import cascading.flow.planner.rule.transformer.RuleInsertionTransformer; | ||
import cascading.flow.tez.planner.rule.expression.BalanceSplitToStreamedHashJoinExpression; | ||
|
||
import static cascading.flow.planner.rule.PlanPhase.BalanceAssembly; | ||
|
||
/** | ||
* Inserts Boundary after split that joins back into a HashJoin. | ||
* <p/> | ||
* this allows testGroupBySplitGroupByJoin to pass, and simplifies testJoinSamePipeAroundGroupBy by preventing | ||
* the upstream operations to duplicate processing in parallel nodes | ||
*/ | ||
public class BoundaryBalanceSplitToStreamedHashJoinTransformer extends RuleInsertionTransformer | ||
{ | ||
public BoundaryBalanceSplitToStreamedHashJoinTransformer() | ||
{ | ||
super( | ||
BalanceAssembly, | ||
new BalanceSplitToStreamedHashJoinExpression(), | ||
ElementCapture.Secondary, | ||
BoundaryElementFactory.BOUNDARY_PIPE | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters