tarun11Mavani commented on code in PR #18368:
URL: https://github.com/apache/pinot/pull/18368#discussion_r3199523578


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/datasource/MapDataSource.java:
##########
@@ -32,9 +32,22 @@ public interface MapDataSource extends DataSource {
 
   /**
    * Get the Data Source representation of a single key within this map column.
+   * Only call after confirming the key exists via {@link 
#containsKey(String)}.
    */
   DataSource getKeyDataSource(String key);
 
+  /**
+   * Returns true if {@code key} is present in this MAP column for at least 
one document in
+   * this segment. Call this before {@link #getKeyDataSource(String)} to avoid 
undefined
+   * behaviour on absent keys.

Review Comment:
   ContainsKey is currently used as an early-exit guard in MapFilterOperator 
and the aggregation/group-by plan nodes to skip processing when a key is absent 
from the segment (backed by the map key set) which is O(1) lookup.
    
   Removing it would mean every caller replaces containsKey(key) with 
getDataSource(key) != null, which triggers a full NullDataSource construction 
just to check presence. 
   



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