/** * 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.tajo.algebra; import com.google.common.base.Objects; import org.apache.tajo.util.TUtil; public class AlterTable extends Expr { private String tableName; private String newTableName; private String columnName; private String newColumnName; private ColumnDefinition addNewColumn; private AlterTableOpType alterTableOpType; public AlterTable(final String tableName) { super(OpType.AlterTable); this.tableName = tableName; } public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public String getNewTableName() { return newTableName; } public void setNewTableName(String newTableName) { this.newTableName = newTableName; } public String getColumnName() { return columnName; } public void setColumnName(String columnName) { this.columnName = columnName; } public String getNewColumnName() { return newColumnName; } public void setNewColumnName(String newColumnName) { this.newColumnName = newColumnName; } public ColumnDefinition getAddNewColumn() { return addNewColumn; } public void setAddNewColumn(ColumnDefinition addNewColumn) { this.addNewColumn = addNewColumn; } public AlterTableOpType getAlterTableOpType() { return alterTableOpType; } public void setAlterTableOpType(AlterTableOpType alterTableOpType) { this.alterTableOpType = alterTableOpType; } @Override public int hashCode() { return Objects.hashCode(tableName, null != newTableName ? Objects.hashCode(newTableName) : newTableName, null != columnName ? Objects.hashCode(columnName) : columnName, null != newColumnName ? Objects.hashCode(newColumnName) : newColumnName, null != addNewColumn ? Objects.hashCode(addNewColumn) : addNewColumn, null != alterTableOpType ? Objects.hashCode(alterTableOpType) : alterTableOpType); } @Override boolean equalsTo(Expr expr) { AlterTable another = (AlterTable) expr; return tableName.equals(another.tableName) && TUtil.checkEquals(newTableName, another.newTableName) && TUtil.checkEquals(columnName, another.columnName) && TUtil.checkEquals(newColumnName, another.newColumnName) && TUtil.checkEquals(addNewColumn, another.addNewColumn) && TUtil.checkEquals(alterTableOpType, another.alterTableOpType); } }