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


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/datasource/MapDataSource.java:
##########
@@ -33,6 +33,15 @@ public interface MapDataSource extends DataSource {
   /// Returns the DataSource for the given map key's values.
   DataSource getDataSource(String key);
 
+  /// Returns whether this segment MAY contain the given key. Implementations 
are allowed to return
+  /// `true` conservatively (i.e., when it is not possible to determine key 
presence without a
+  /// full scan). Callers must handle the case where the key is absent even 
when this returns
+  /// `true` — [#getDataSource(String)] will return a DataSource for an absent 
key
+  /// (forward-index reads return the column default value; null-value bitmap 
marks all rows as null).
+  default boolean mayContainKey(String key) {

Review Comment:
   Renamed to containsKey and clarified the Javadoc. 
   It IS deterministic per implementation — columnar segments do an O(1) 
key-set lookup, blob segments return true conservatively (they can't cheaply 
determine absence). Query operators (MapFilterOperator, AggregationPlanNode) 
use it to short-circuit: false -> EmptyFilterOperator / skip optimization; true 
→ proceed with per-key DataSource.



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