001/* 002 * Copyright (c) 2007-2022 The Cascading Authors. All Rights Reserved. 003 * 004 * Project and contact information: https://cascading.wensel.net/ 005 * 006 * This file is part of the Cascading project. 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package cascading.flow.tez.planner; 022 023import cascading.flow.planner.rule.RuleRegistry; 024import cascading.flow.planner.rule.annotator.LogicalMergeAnnotator; 025import cascading.flow.planner.rule.assertion.BufferAfterEveryAssert; 026import cascading.flow.planner.rule.assertion.EveryAfterBufferAssert; 027import cascading.flow.planner.rule.assertion.LoneGroupAssert; 028import cascading.flow.planner.rule.assertion.MissingGroupAssert; 029import cascading.flow.planner.rule.assertion.SplitBeforeEveryAssert; 030import cascading.flow.planner.rule.partitioner.WholeGraphStepPartitioner; 031import cascading.flow.planner.rule.transformer.ApplyAssertionLevelTransformer; 032import cascading.flow.planner.rule.transformer.ApplyDebugLevelTransformer; 033import cascading.flow.planner.rule.transformer.RemoveNoOpPipeTransformer; 034import cascading.flow.tez.planner.rule.assertion.NoHashJoinAssert; 035import cascading.flow.tez.planner.rule.partitioner.ConsecutiveGroupOrMergesNodePartitioner; 036import cascading.flow.tez.planner.rule.partitioner.SplitJoinBoundariesNodeRePartitioner; 037import cascading.flow.tez.planner.rule.partitioner.TopDownBoundariesNodePartitioner; 038import cascading.flow.tez.planner.rule.transformer.BoundaryBalanceCheckpointTransformer; 039import cascading.flow.tez.planner.rule.transformer.BoundaryBalanceGroupSplitSpliceTransformer; 040 041/** 042 * The NoHashJoinHadoop2TezRuleRegistry assumes the plan has no {@link cascading.pipe.HashJoin} Pipes in the 043 * assembly, otherwise an planner failure will be thrown. 044 * <p> 045 * This rule registry can be used if the default registry is failing or producing less than optimal plans. 046 * 047 * @see cascading.flow.tez.planner.HashJoinHadoop2TezRuleRegistry 048 */ 049public class NoHashJoinHadoop2TezRuleRegistry extends RuleRegistry 050 { 051 public NoHashJoinHadoop2TezRuleRegistry() 052 { 053// enableDebugLogging(); 054 055 // PreBalance 056 addRule( new NoHashJoinAssert() ); // fail if we encounter a HashJoin 057 058 addRule( new LoneGroupAssert() ); 059 addRule( new MissingGroupAssert() ); 060 addRule( new BufferAfterEveryAssert() ); 061 addRule( new EveryAfterBufferAssert() ); 062 addRule( new SplitBeforeEveryAssert() ); 063 064 addRule( new BoundaryBalanceGroupSplitSpliceTransformer() ); // prevents AssemblyHelpersPlatformTest#testSameSourceMerge deadlock 065 addRule( new BoundaryBalanceCheckpointTransformer() ); 066 067 // PreResolve 068 addRule( new RemoveNoOpPipeTransformer() ); 069 addRule( new ApplyAssertionLevelTransformer() ); 070 addRule( new ApplyDebugLevelTransformer() ); 071 addRule( new LogicalMergeAnnotator() ); // MergePipesPlatformTest#testSameSourceMergeHashJoin 072 073 // PostResolve 074 075 // PartitionSteps 076 addRule( new WholeGraphStepPartitioner() ); 077 078 // PostSteps 079 080 // PartitionNodes 081 addRule( new TopDownBoundariesNodePartitioner() ); 082 addRule( new ConsecutiveGroupOrMergesNodePartitioner() ); 083 addRule( new SplitJoinBoundariesNodeRePartitioner() ); // testCoGroupSelf - compensates for tez-1190 084 085 // PostNodes 086 } 087 }