This is an automated email from the ASF dual-hosted git repository.
cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push:
new 3097562 Improper getter value is fixed. (#6930)
3097562 is described below
commit 3097562adf82dae195d258214467949308e0c3fe
Author: Furkan KAMACI <[email protected]>
AuthorDate: Thu Feb 7 22:51:07 2019 +0300
Improper getter value is fixed. (#6930)
* 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]