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


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/datasource/MapDataSource.java:
##########
@@ -33,6 +33,26 @@ public interface MapDataSource extends DataSource {
   /// Returns the DataSource for the given map key's values.
   DataSource getDataSource(String key);
 
+  /// Returns whether this segment has per-key index data for the given key.
+  ///
+  /// - **All-dense columnar segments:** exact (O(1) lookup into the 
materialized key set).
+  /// - **Mixed-tier columnar segments (dense + sparse):** exact for 
materialized keys; for any
+  ///   non-materialized key, returns `true` whenever a sparse blob exists 
(conservative — the
+  ///   sparse key set is not persisted today). Cost of the conservative 
answer is bounded:
+  ///   queries on truly-absent keys pay one wasted `getDataSource(key)` 
lookup, then fall
+  ///   through to expression-filter (which returns no matches via a full 
scan).
+  /// - **Blob-only segments:** `true` conservatively because determining key 
presence requires
+  ///   per-doc deserialization.
+  ///
+  /// Query operators use this to choose between fast-path (per-key 
inverted/dictionary index)
+  /// and fallback (expression scan). When this returns `false`, callers can 
short-circuit:
+  /// e.g. `MapFilterOperator` returns `EmptyFilterOperator` for value 
predicates and
+  /// `MatchAllFilterOperator` for IS_NULL. When this returns `true`, callers 
should
+  /// still handle absent-key DataSources gracefully (null-value bitmap marks 
all rows as null).
+  default boolean containsKey(String key) {

Review Comment:
   makes sense. updated.



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