You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "gianm (via GitHub)" <gi...@apache.org> on 2024/06/05 05:08:36 UTC

[PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

gianm opened a new pull request, #16550:
URL: https://github.com/apache/druid/pull/16550

   The version originally added in #13819 was missing an annotation for the "value" property. Fixes #16539.
   
   Line endings for ArrayOfDoublesSketchConstantPostAggregator.java are changed from `\r\n` to `\n`. Try viewing with whitespace ignored to make the diff easier to read. The really meaningful change is adding a single line.
   
   Adds a serde test, and improves various other datasketches post-aggregator serde tests to deserialize into PostAggregator. This verifies that the type information is set up correctly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm commented on PR #16550:
URL: https://github.com/apache/druid/pull/16550#issuecomment-2149208873

   Fixed the excessive imports. Thanks for reviewing!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm merged PR #16550:
URL: https://github.com/apache/druid/pull/16550


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

Posted by "asdf2014 (via GitHub)" <gi...@apache.org>.
asdf2014 commented on code in PR #16550:
URL: https://github.com/apache/druid/pull/16550#discussion_r1627118051


##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchUnionPostAggregatorTest.java:
##########
@@ -24,6 +24,7 @@
 import org.apache.datasketches.hll.TgtHllType;
 import org.apache.druid.jackson.DefaultObjectMapper;
 import org.apache.druid.query.aggregation.PostAggregator;
+import org.apache.druid.query.aggregation.datasketches.kll.KllSketchModule;

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk commented on code in PR #16550:
URL: https://github.com/apache/druid/pull/16550#discussion_r1627086505


##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregatorTest.java:
##########
@@ -66,6 +67,24 @@ public void testComparator()
     Assert.assertEquals(Comparators.alwaysEqual(), postAgg.getComparator());
   }
 
+  @Test
+  public void testSerde() throws JsonProcessingException
+  {
+    final PostAggregator there = new ArrayOfDoublesSketchConstantPostAggregator(
+        "p",
+        "AQEJAwgBzJP/////////fwIAAAAAAAAAzT6NGdX0aWUOJvS5EIhpLwAAAAAAAAAAAAAAAAAAAAA="
+    );
+    DefaultObjectMapper mapper = new DefaultObjectMapper();
+    mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules());
+    PostAggregator andBackAgain = mapper.readValue(
+        mapper.writeValueAsString(there),
+        PostAggregator.class
+    );

Review Comment:
   its stunning to see that this was not caught earlier - I wonder if  exercising the serde-s in the `Calcite*Test` classes might make these issues surface
   
   ...another possible way could be to ensure that annotations inside the classes are consistent - but I guess that can't be enforced for all classes as custom serializers might also be 
   
   we'll keep these in mind :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

Posted by "asdf2014 (via GitHub)" <gi...@apache.org>.
asdf2014 commented on code in PR #16550:
URL: https://github.com/apache/druid/pull/16550#discussion_r1627126178


##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToHistogramPostAggregatorTest.java:
##########
@@ -28,6 +28,7 @@
 import org.apache.druid.query.aggregation.Aggregator;
 import org.apache.druid.query.aggregation.PostAggregator;
 import org.apache.druid.query.aggregation.TestDoubleColumnSelectorImpl;
+import org.apache.druid.query.aggregation.datasketches.tuple.ArrayOfDoublesSketchModule;

Review Comment:
   ```suggestion
   ```



##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilePostAggregatorTest.java:
##########
@@ -23,6 +23,7 @@
 import nl.jqno.equalsverifier.EqualsVerifier;
 import org.apache.druid.jackson.DefaultObjectMapper;
 import org.apache.druid.query.aggregation.PostAggregator;
+import org.apache.druid.query.aggregation.datasketches.tuple.ArrayOfDoublesSketchModule;

Review Comment:
   ```suggestion
   ```



##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchToStringPostAggregatorTest.java:
##########
@@ -24,6 +24,7 @@
 import org.apache.druid.jackson.DefaultObjectMapper;
 import org.apache.druid.java.util.common.IAE;
 import org.apache.druid.query.aggregation.PostAggregator;
+import org.apache.druid.query.aggregation.datasketches.theta.SketchModule;

Review Comment:
   ```suggestion
   ```



##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToCDFPostAggregatorTest.java:
##########
@@ -28,6 +28,7 @@
 import org.apache.druid.query.aggregation.Aggregator;
 import org.apache.druid.query.aggregation.PostAggregator;
 import org.apache.druid.query.aggregation.TestDoubleColumnSelectorImpl;
+import org.apache.druid.query.aggregation.datasketches.tuple.ArrayOfDoublesSketchModule;

Review Comment:
   ```suggestion
   ```



##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToRankPostAggregatorTest.java:
##########
@@ -27,6 +27,7 @@
 import org.apache.druid.query.aggregation.Aggregator;
 import org.apache.druid.query.aggregation.PostAggregator;
 import org.apache.druid.query.aggregation.TestDoubleColumnSelectorImpl;
+import org.apache.druid.query.aggregation.datasketches.tuple.ArrayOfDoublesSketchModule;

Review Comment:
   ```suggestion
   ```



##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToStringPostAggregatorTest.java:
##########
@@ -24,6 +24,7 @@
 import org.apache.druid.jackson.DefaultObjectMapper;
 import org.apache.druid.java.util.common.IAE;
 import org.apache.druid.query.aggregation.PostAggregator;
+import org.apache.druid.query.aggregation.datasketches.tuple.ArrayOfDoublesSketchModule;

Review Comment:
   ```suggestion
   ```



##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchToQuantilesPostAggregatorTest.java:
##########
@@ -28,6 +28,7 @@
 import org.apache.druid.query.aggregation.Aggregator;
 import org.apache.druid.query.aggregation.PostAggregator;
 import org.apache.druid.query.aggregation.TestDoubleColumnSelectorImpl;
+import org.apache.druid.query.aggregation.datasketches.tuple.ArrayOfDoublesSketchModule;

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] Fix serde for ArrayOfDoublesSketchConstantPostAggregator. (druid)

Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm commented on code in PR #16550:
URL: https://github.com/apache/druid/pull/16550#discussion_r1627259662


##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchConstantPostAggregatorTest.java:
##########
@@ -66,6 +67,24 @@ public void testComparator()
     Assert.assertEquals(Comparators.alwaysEqual(), postAgg.getComparator());
   }
 
+  @Test
+  public void testSerde() throws JsonProcessingException
+  {
+    final PostAggregator there = new ArrayOfDoublesSketchConstantPostAggregator(
+        "p",
+        "AQEJAwgBzJP/////////fwIAAAAAAAAAzT6NGdX0aWUOJvS5EIhpLwAAAAAAAAAAAAAAAAAAAAA="
+    );
+    DefaultObjectMapper mapper = new DefaultObjectMapper();
+    mapper.registerModules(new ArrayOfDoublesSketchModule().getJacksonModules());
+    PostAggregator andBackAgain = mapper.readValue(
+        mapper.writeValueAsString(there),
+        PostAggregator.class
+    );

Review Comment:
   Perhaps we could use some approach like `EqualsVerifier`. Whatever magic it does to verify `equals` and `hashCode` could possible be used to verify serde as well? I never looked inside it to see what it's doing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org