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

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

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

    https://github.com/apache/tajo/pull/200#discussion_r18819530
  
    --- Diff: 
tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/statistics/Histogram.java
 ---
    @@ -0,0 +1,238 @@
    +/**
    + * 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.statistics;
    +
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +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;
    +import org.apache.tajo.util.TUtil;
    +
    +import com.google.common.base.Objects;
    +import com.google.gson.annotations.Expose;
    +
    +public class Histogram implements 
ProtoObject<CatalogProtos.HistogramProto>, Cloneable, GsonObject {
    +  
    +  @Expose protected Long lastAnalyzed = null; // optional
    +  @Expose protected List<HistogramBucket> buckets = null; // repeated
    +  @Expose protected boolean isReady; // whether this histogram is ready to 
be used for selectivity estimation
    +  protected int DEFAULT_MAX_BUCKETS = 100; // Same as PostgreSQL
    +
    +  public Histogram() {
    +    buckets = TUtil.newList();
    +    isReady = false;
    +  }
    +  
    +  public Histogram(CatalogProtos.HistogramProto proto) {
    +    if (proto.hasLastAnalyzed()) {
    +      this.lastAnalyzed = proto.getLastAnalyzed();
    +    }    
    +    buckets = TUtil.newList();
    +    for (CatalogProtos.HistogramBucketProto bucketProto : 
proto.getBucketsList()) {
    +      this.buckets.add(new HistogramBucket(bucketProto));
    +    }
    +    isReady = true;
    +  }
    +  
    +  public Long getLastAnalyzed() {
    +    return this.lastAnalyzed;
    +  }
    +  
    +  public void setLastAnalyzed(Long lastAnalyzed) {
    +    this.lastAnalyzed = lastAnalyzed;
    +  }
    +  
    +  public List<HistogramBucket> getBuckets() {
    +    return this.buckets;
    +  }
    +
    +  public void setBuckets(List<HistogramBucket> buckets) {
    +    this.buckets = new ArrayList<HistogramBucket>(buckets);
    +  }
    +
    +  public void addBucket(HistogramBucket bucket) {
    +    this.buckets.add(bucket);
    +  }
    +
    +  public int getBucketsCount() {
    +    return this.buckets.size();
    +  }
    +
    +  public boolean getIsReady() {
    +    return this.isReady;
    +  }
    +  
    +  public void setIsReady(boolean isReady) {
    +    this.isReady = isReady;
    +  }
    +  
    +  public boolean equals(Object obj) {
    +    if (obj instanceof Histogram) {
    +      Histogram other = (Histogram) obj;
    +      return getLastAnalyzed().equals(other.getLastAnalyzed())
    --- End diff --
    
    It seems that the 'isReady' variable is missed.


> Implement histogram interface and a candidate histogram
> -------------------------------------------------------
>
>                 Key: TAJO-1112
>                 URL: https://issues.apache.org/jira/browse/TAJO-1112
>             Project: Tajo
>          Issue Type: Sub-task
>            Reporter: Long Mvh
>            Assignee: Long Mvh
>




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

Reply via email to