org.apache.hadoop.hive.ql.plan.MuxDesc Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.hadoop.hive.ql.plan;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.hive.ql.exec.Operator;
import org.apache.hadoop.hive.ql.exec.ReduceSinkOperator;
import org.apache.hadoop.hive.ql.plan.Explain.Level;
/**
* Mux operator descriptor implementation..
*
*/
@Explain(displayName = "Mux Operator", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class MuxDesc extends AbstractOperatorDesc {
private static final long serialVersionUID = 1L;
private List> parentToKeyCols;
private List> parentToValueCols;
private List> parentToOutputKeyColumnNames;
private List> parentToOutputValueColumnNames;
private List parentToTag;
private Map newParentIndexToOldParentIndex;
public MuxDesc() {
}
// A MuxDesc is only generated from a corresponding ReduceSinkDesc.
public MuxDesc(List> ops){
int numParents = ops.size();
parentToKeyCols = new ArrayList>(numParents);
parentToOutputKeyColumnNames = new ArrayList>(numParents);
parentToValueCols = new ArrayList>(numParents);
parentToOutputValueColumnNames = new ArrayList>(numParents);
parentToTag = new ArrayList(numParents);
for (Operator extends OperatorDesc> op: ops) {
if (op != null && op instanceof ReduceSinkOperator) {
ReduceSinkOperator rsop = (ReduceSinkOperator)op;
List keyCols = rsop.getConf().getKeyCols();
List valueCols = rsop.getConf().getValueCols();
List outputKeyColumnNames = rsop.getConf().getOutputKeyColumnNames();
List outputValueColumnNames = rsop.getConf().getOutputValueColumnNames();
int tag = rsop.getConf().getTag();
parentToKeyCols.add(keyCols);
parentToValueCols.add(valueCols);
parentToOutputKeyColumnNames.add(outputKeyColumnNames);
parentToOutputValueColumnNames.add(outputValueColumnNames);
parentToTag.add(tag);
} else {
parentToKeyCols.add(null);
parentToValueCols.add(null);
parentToOutputKeyColumnNames.add(null);
parentToOutputValueColumnNames.add(null);
parentToTag.add(null);
}
}
}
public List> getParentToKeyCols() {
return parentToKeyCols;
}
public void setParentToKeyCols(List> parentToKeyCols) {
this.parentToKeyCols = parentToKeyCols;
}
public List> getParentToValueCols() {
return parentToValueCols;
}
public void setParentToValueCols(List> parentToValueCols) {
this.parentToValueCols = parentToValueCols;
}
public List> getParentToOutputKeyColumnNames() {
return parentToOutputKeyColumnNames;
}
public void setParentToOutputKeyColumnNames(
List> parentToOutputKeyColumnNames) {
this.parentToOutputKeyColumnNames = parentToOutputKeyColumnNames;
}
public List> getParentToOutputValueColumnNames() {
return parentToOutputValueColumnNames;
}
public void setParentToOutputValueColumnNames(
List> parentToOutputValueColumnNames) {
this.parentToOutputValueColumnNames = parentToOutputValueColumnNames;
}
public List getParentToTag() {
return parentToTag;
}
public void setParentToTag(List parentToTag) {
this.parentToTag = parentToTag;
}
public Map getNewParentIndexToOldParentIndex() {
return newParentIndexToOldParentIndex;
}
public void setNewParentIndexToOldParentIndex(
Map newParentIndexToOldParentIndex) {
this.newParentIndexToOldParentIndex = newParentIndexToOldParentIndex;
}
}