This is an automated email from the ASF dual-hosted git repository.
fjy pushed a commit to branch 0.14.0-incubating
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/0.14.0-incubating by this push:
new da03057 Improper getter value is fixed. (#6930) (#7033)
da03057 is described below
commit da030570104bf9d0ddf426ed9da4230741b6ad26
Author: Clint Wylie <[email protected]>
AuthorDate: Fri Feb 8 10:02:28 2019 -0800
Improper getter value is fixed. (#6930) (#7033)
* Improper getter value is fixed.
* Test class is added.
---
.../histogram/BucketsPostAggregator.java | 2 +-
.../histogram/BucketsPostAggregatorTest.java | 45 ++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git
a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregator.java
b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregator.java
index 94400f7..c47044c 100644
---
a/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregator.java
+++
b/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregator.java
@@ -82,7 +82,7 @@ public class BucketsPostAggregator extends
ApproximateHistogramPostAggregator
@JsonProperty
public float getOffset()
{
- return bucketSize;
+ return offset;
}
@Override
diff --git
a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregatorTest.java
b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregatorTest.java
new file mode 100644
index 0000000..ebcd282
--- /dev/null
+++
b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregatorTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.druid.query.aggregation.histogram;
+
+import org.apache.druid.jackson.DefaultObjectMapper;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BucketsPostAggregatorTest
+{
+ @Test
+ public void testSerde() throws Exception
+ {
+ BucketsPostAggregator aggregator1 =
+ new BucketsPostAggregator("buckets_post_aggregator", "test_field", 2f,
4f);
+
+ DefaultObjectMapper mapper = new DefaultObjectMapper();
+ BucketsPostAggregator aggregator2 = mapper.readValue(
+ mapper.writeValueAsString(aggregator1),
+ BucketsPostAggregator.class
+ );
+
+ Assert.assertEquals(aggregator1.getBucketSize(),
aggregator2.getBucketSize(), 0.0001);
+ Assert.assertEquals(aggregator1.getOffset(), aggregator2.getOffset(),
0.0001);
+ Assert.assertArrayEquals(aggregator1.getCacheKey(),
aggregator2.getCacheKey());
+ Assert.assertEquals(aggregator1.getDependentFields(),
aggregator2.getDependentFields());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]