org.apache.hadoop.hive.ql.plan.SelectDesc 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 org.apache.hadoop.hive.ql.plan.Explain.Level;
/**
* SelectDesc.
*
*/
@Explain(displayName = "Select Operator", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class SelectDesc extends AbstractOperatorDesc {
private static final long serialVersionUID = 1L;
private List colList;
private List outputColumnNames;
private boolean selectStar;
private boolean selStarNoCompute;
public SelectDesc() {
}
public SelectDesc(final boolean selStarNoCompute) {
this.selStarNoCompute = selStarNoCompute;
}
public SelectDesc(
final List colList,
final List outputColumnNames) {
this(colList, outputColumnNames, false);
}
public SelectDesc(
final List colList,
List outputColumnNames,
final boolean selectStar) {
this.colList = colList;
this.selectStar = selectStar;
this.outputColumnNames = outputColumnNames;
}
@Override
public Object clone() {
SelectDesc ret = new SelectDesc();
ret.setColList(getColList() == null ? null : new ArrayList(getColList()));
ret.setOutputColumnNames(getOutputColumnNames() == null ? null :
new ArrayList(getOutputColumnNames()));
ret.setSelectStar(selectStar);
ret.setSelStarNoCompute(selStarNoCompute);
return ret;
}
@Explain(displayName = "expressions")
public String getColListString() {
return PlanUtils.getExprListString(colList);
}
public List getColList() {
return colList;
}
public void setColList(
final List colList) {
this.colList = colList;
}
@Explain(displayName = "outputColumnNames")
public List getOutputColumnNames() {
return outputColumnNames;
}
@Explain(displayName = "Output", explainLevels = { Level.USER })
public List getUserLevelExplainOutputColumnNames() {
return outputColumnNames;
}
public void setOutputColumnNames(
List outputColumnNames) {
this.outputColumnNames = outputColumnNames;
}
@Explain(displayName = "SELECT * ")
public String explainNoCompute() {
if (isSelStarNoCompute()) {
return "(no compute)";
} else {
return null;
}
}
/**
* @return the selectStar
*/
public boolean isSelectStar() {
return selectStar;
}
/**
* @param selectStar
* the selectStar to set
*/
public void setSelectStar(boolean selectStar) {
this.selectStar = selectStar;
}
/**
* @return the selStarNoCompute
*/
public boolean isSelStarNoCompute() {
return selStarNoCompute;
}
/**
* @param selStarNoCompute
* the selStarNoCompute to set
*/
public void setSelStarNoCompute(boolean selStarNoCompute) {
this.selStarNoCompute = selStarNoCompute;
}
}