capistrant commented on issue #10042:
URL: https://github.com/apache/druid/issues/10042#issuecomment-676689583


   @gianm @leerho What would your opinion be in regards to something like this 
building a bridge from druid 15 to 18 (sketches 0.13.4 --> sketches-1.2 
incubating)? If this patched `druid-datasketches` jar got pushed to the 
Brokers, they would be able to handle the empty sketches returned from the 
updated data nodes. My canary test worked. Before I start heading down this 
road further, I wanted to see what you two thought.
   
   I see `wrapSketch` is also used for `arrayOfDoubles`, but our query tool on 
top of druid doesn't allow that aggregator as of now so I'm thinking I can 
ignore that for my particular case.
   
   ```JAVA
   public static final SketchHolder EMPTY = SketchHolder.of(
         Sketches.updateSketchBuilder()
                 .build()
                 .compact(true, null)
   
   ...
   
   public static SketchHolder deserialize(Object serializedSketch)
     {
       if (serializedSketch instanceof String) {
         byte[] byteArray = 
StringUtils.decodeBase64(StringUtils.toUtf8((String) serializedSketch));
         // See 
https://github.com/apache/druid/issues/10042#issuecomment-675664558
         // Returning empty SketchHolder when we know sketch is empty avoids 
compatibilty issue between dataSketches
         // versions
         if (byteArray.length < 16) {
           return EMPTY;
         }
         return SketchHolder.of(deserializeFromByteArray(byteArray));
       } else if (serializedSketch instanceof byte[]) {
         // See 
https://github.com/apache/druid/issues/10042#issuecomment-675664558
         // Returning empty SketchHolder when we know sketch is empty avoids 
compatibilty issue between dataSketches
         // versions
         if (((byte[]) serializedSketch).length < 16) {
           return EMPTY;
         }
         return SketchHolder.of(deserializeFromByteArray((byte[]) 
serializedSketch));
       } else if (serializedSketch instanceof SketchHolder) {
         return (SketchHolder) serializedSketch;
       } else if (serializedSketch instanceof Sketch
                  || serializedSketch instanceof Union
                  || serializedSketch instanceof Memory) {
         return SketchHolder.of(serializedSketch);
       }
   ```


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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to