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.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---