/tags/release-0.0.0-rc0/hive/external/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnInfo.java
Java | 136 lines | 73 code | 31 blank | 32 comment | 0 complexity | e5efa79555ffdc72de2cc9376c63e4fd MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
- /**
- * 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.exec;
- import java.io.Serializable;
- import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
- import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
- /**
- * Implementation for ColumnInfo which contains the internal name for the column
- * (the one that is used by the operator to access the column) and the type
- * (identified by a java class).
- **/
- public class ColumnInfo implements Serializable {
- private static final long serialVersionUID = 1L;
- private String internalName;
- private String alias = null; // [optional] alias of the column (external name
- // as seen by the users)
- /**
- * Store the alias of the table where available.
- */
- private String tabAlias;
- /**
- * Indicates whether the column is a virtual column.
- */
- private boolean isVirtualCol;
- private transient TypeInfo type;
- private boolean isHiddenVirtualCol;
- public ColumnInfo() {
- }
- public ColumnInfo(String internalName, TypeInfo type, String tabAlias,
- boolean isVirtualCol) {
- this(internalName, type, tabAlias, isVirtualCol, false);
- }
- public ColumnInfo(String internalName, Class type, String tabAlias,
- boolean isVirtualCol) {
- this(internalName, TypeInfoFactory
- .getPrimitiveTypeInfoFromPrimitiveWritable(type), tabAlias,
- isVirtualCol, false);
- }
- public ColumnInfo(String internalName, TypeInfo type, String tabAlias,
- boolean isVirtualCol, boolean isHiddenVirtualCol) {
- this.internalName = internalName;
- this.type = type;
- this.tabAlias = tabAlias;
- this.isVirtualCol = isVirtualCol;
- this.isHiddenVirtualCol = isHiddenVirtualCol;
- }
- public TypeInfo getType() {
- return type;
- }
- public String getInternalName() {
- return internalName;
- }
- public void setType(TypeInfo type) {
- this.type = type;
- }
- public void setInternalName(String internalName) {
- this.internalName = internalName;
- }
- public String getTabAlias() {
- return tabAlias;
- }
- public boolean getIsVirtualCol() {
- return isVirtualCol;
- }
- public boolean isHiddenVirtualCol() {
- return isHiddenVirtualCol;
- }
- /**
- * Returns the string representation of the ColumnInfo.
- */
- @Override
- public String toString() {
- return internalName + ": " + type;
- }
- public void setAlias(String col_alias) {
- alias = col_alias;
- }
- public String getAlias() {
- return alias;
- }
- public void setTabAlias(String tabAlias) {
- this.tabAlias = tabAlias;
- }
- public void setVirtualCol(boolean isVirtualCol) {
- this.isVirtualCol = isVirtualCol;
- }
- public void setHiddenVirtualCol(boolean isHiddenVirtualCol) {
- this.isHiddenVirtualCol = isHiddenVirtualCol;
- }
- }