You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/08/25 04:06:55 UTC

[GitHub] [druid] jihoonson commented on a change in pull request #11574: Configurable maxStreamLength for doubles sketches

jihoonson commented on a change in pull request #11574:
URL: https://github.com/apache/druid/pull/11574#discussion_r695375561



##########
File path: extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketches.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.datasketches.quantiles;
+
+import org.apache.druid.java.util.common.ISE;
+
+public final class DoublesSketches
+{
+  /**
+   * Runs the given task that updates a Doubles sketch backed by a direct byte buffer. This method intentionally
+   * accepts the update task as a {@link Runnable} instead of accpeting parameters of a sketch and other values
+   * needed for the update. This is to avoid any potential performance impact especially when the sketch is updated

Review comment:
       I ran the benchmark I added in https://github.com/apache/druid/pull/11574/commits/7be41051242f16db225dfce48f86adc9b1966c3a. It doesn't seem to have any difference.
   
   ```
   // 20: doubles sketches
   query: "SELECT APPROX_QUANTILE_DS(sumFloatNormal, 0.5), DS_QUANTILES_SKETCH(maxLongUniform) FROM foo"
   
   master
   
   Benchmark              (query)  (rowsPerSegment)  (vectorize)  Mode  Cnt    Score   Error  Units
   SqlBenchmark.querySql       20           5000000        false  avgt   15  341.659 ± 0.932  ms/op
   SqlBenchmark.querySql       20           5000000        force  avgt   15  446.572 ± 3.279  ms/op
   
   PR
   
   Benchmark              (query)  (rowsPerSegment)  (vectorize)  Mode  Cnt    Score   Error  Units
   SqlBenchmark.querySql       20           5000000        false  avgt   15  341.956 ± 2.478  ms/op
   SqlBenchmark.querySql       20           5000000        force  avgt   15  442.048 ± 1.420  ms/op
   ```
   
   Interestingly, the query was _slower_ when the vectorization was on. AFAIT, the difference is that the non-vectorized version uses `HeapUpdateDoublesSketch` while the vectorized one uses `DirectUpdateDoublesSketch`. Attaching flame graphs.
   
   Non-vectorized
   ![Screenshot from 2021-08-24 21-02-35](https://user-images.githubusercontent.com/2322288/130724807-18b430fb-ca4c-4644-aae3-20612b0cd0cf.png)
   
   Vectorized
   ![Screenshot from 2021-08-24 21-02-57](https://user-images.githubusercontent.com/2322288/130724816-74bdabe7-b7cf-439f-855a-2dd7dbd6460e.png)
   




-- 
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