clintropolis commented on code in PR #18541:
URL: https://github.com/apache/druid/pull/18541#discussion_r2408846105


##########
processing/src/main/java/org/apache/druid/segment/nested/StructuredData.java:
##########
@@ -133,16 +135,28 @@ private Number asNumber()
     return (Number) value;
   }
 
+  @SuppressWarnings("ReturnValueIgnored")
+  public int getSizeEstimate()
+  {
+    if (sizeEstimate < 0) {
+      hash.getAsLong(); // trigger hash computation which also sets 
sizeEstimate
+    }
+    Preconditions.checkState(sizeEstimate >= 0, "sizeEstimate not 
initialized");
+    return sizeEstimate;
+  }
+
   @Override
   public int compareTo(StructuredData o)
   {
-    if (this.equals(o)) {
+    if (this == o) {

Review Comment:
   i feel like we should leave this, since `StructuredData` is also used as a 
wrapper at ingest time for all 'auto' types, primitive types can short-circuit 
out of this comparison before forcing stuff to be serialized, which seems like 
it would add a bit of overhead.
   
   I guess you're trying to make all of equals/hashcode/compareTo like 
consistently weird the same way with the occasional hash collisions, instead of 
just isolating the weirdness where it falls to the hash in just the compareTo?
   
   Fwiw, I was trying to keep the strangeness of using the hash instead of 
performing full byte comparison isolated in compareTo (since ideally we would 
be performing full comparison), is there a reason related to this PR of why 
these need to change?



##########
processing/src/main/java/org/apache/druid/segment/column/TypeStrategies.java:
##########
@@ -697,4 +704,103 @@ public Class<?> getClazz()
       return Object[].class;
     }
   }
+
+  public static final class NestedDataTypeStrategy implements 
TypeStrategy<Object>
+  {
+    public static final NestedDataTypeStrategy INSTANCE = new 
NestedDataTypeStrategy();

Review Comment:
   nit, could put this at the top of `TypeStrategies` alongside the other 
static instances then would be `TypeStrategies.NESTED_DATA` or whatever



-- 
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: [email protected]

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