[ 
https://issues.apache.org/jira/browse/TAJO-1284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14375928#comment-14375928
 ] 

ASF GitHub Bot commented on TAJO-1284:
--------------------------------------

Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/448#discussion_r26938947
  
    --- Diff: 
tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/partition/PartitionKey.java
 ---
    @@ -0,0 +1,148 @@
    +/**
    + * 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.catalog.partition;
    +
    +import com.google.common.base.Objects;
    +import com.google.gson.annotations.Expose;
    +import org.apache.tajo.catalog.json.CatalogGsonHelper;
    +import org.apache.tajo.catalog.proto.CatalogProtos;
    +import org.apache.tajo.common.ProtoObject;
    +import org.apache.tajo.json.GsonObject;
    +
    +
    +/**
    + * This presents column name and partition value pairs of column 
partitioned table.
    + *
    + * For example, consider you have a partitioned table as follows:
    + *
    + * create external table table1 (id text, name text) PARTITION BY COLUMN 
(dt text, phone text,
    + * gender text) USING RCFILE LOCATION '/tajo/data/table1';
    + *
    + * Then, its data will be stored on HDFS as follows:
    + * - /tajo/data/table1/dt=20150301/phone=1300/gender=m
    + * - /tajo/data/table1/dt=20150301/phone=1300/gender=f
    + * - /tajo/data/table1/dt=20150302/phone=1500/gender=m
    + * - /tajo/data/table1/dt=20150302/phone=1500/gender=f
    + *
    + * In such as above, first directory can be presented with this class as 
follows:
    + * The first pair: column name = dt, partition value = 20150301
    + * The second pair: column name = phone, partition value = 1300
    + * The thris pair: column name = gender, partition value = m
    + *
    + */
    +public class PartitionKey implements 
ProtoObject<CatalogProtos.PartitionKeyProto>, Cloneable, GsonObject {
    +  @Expose protected String columnName;                       // required
    +  @Expose protected String partitionValue;                      // required
    +
    +  private CatalogProtos.PartitionKeyProto.Builder builder = 
CatalogProtos.PartitionKeyProto.newBuilder();
    +
    +  public PartitionKey() {
    +  }
    +
    +  public PartitionKey(String columnName, String partitionValue) {
    +    this.columnName = columnName;
    +    this.partitionValue = partitionValue;
    +  }
    +
    +  public PartitionKey(PartitionKey partition) {
    +    this.columnName = partition.columnName;
    +    this.partitionValue = partition.partitionValue;
    +  }
    +
    +  public PartitionKey(CatalogProtos.PartitionKeyProto proto) {
    +    if (proto.hasColumnName()) {
    +      this.columnName = proto.getColumnName();
    +    }
    +    if (proto.hasPartitionValue()) {
    +      this.partitionValue = proto.getPartitionValue();
    +    }
    +  }
    +
    +  public String getPartitionValue() {
    +    return partitionValue;
    +  }
    +
    +  public void setPartitionValue(String partitionValue) {
    +    this.partitionValue = partitionValue;
    +  }
    +
    +  public String getColumnName() { return columnName; }
    +
    +  public void setColumnName(String columnName) { this.columnName = 
columnName; }
    +
    +  public int hashCode() {
    +    return Objects.hashCode(partitionValue, columnName);
    +  }
    +
    +  public boolean equals(Object o) {
    +    if (o instanceof PartitionKey) {
    +      PartitionKey another = (PartitionKey) o;
    +      boolean eq = ((columnName != null && another.columnName != null
    --- End diff --
    
    How about to use TUtil.checkEquals()?


> Add alter partition method to CatalogStore
> ------------------------------------------
>
>                 Key: TAJO-1284
>                 URL: https://issues.apache.org/jira/browse/TAJO-1284
>             Project: Tajo
>          Issue Type: Sub-task
>          Components: catalog
>            Reporter: Jaehwa Jung
>            Assignee: Jaehwa Jung
>         Attachments: TAJO-1260.png, TAJO-1260.sql, TAJO-1284.patch, 
> TAJO-1284_2.png, TAJO-1284_2.sql
>
>
> This patch will implement  ALTER TABLE ADD PARTITION method and ALTER TABLE 
> DROP PARTITION method to CatalogStore.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to