This is an automated email from the ASF dual-hosted git repository.
Jackie-Jiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 4102ec8d2e8 Add IndexType.shouldCreateIndex hook to filter columns at
dispatch time (#18450)
4102ec8d2e8 is described below
commit 4102ec8d2e80faad2883e787493c778c5c9f8d9e
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Sat May 9 18:51:10 2026 -0700
Add IndexType.shouldCreateIndex hook to filter columns at dispatch time
(#18450)
---
.../segment/local/segment/creator/impl/BaseSegmentCreator.java | 3 ++-
.../java/org/apache/pinot/segment/spi/index/IndexType.java | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/BaseSegmentCreator.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/BaseSegmentCreator.java
index 006e85612c8..a5118be2fd4 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/BaseSegmentCreator.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/BaseSegmentCreator.java
@@ -342,7 +342,8 @@ public abstract class BaseSegmentCreator implements
SegmentCreator {
IndexType<C, ?, ?> index, IndexCreationContext.Common context,
FieldIndexConfigs fieldIndexConfigs)
throws Exception {
C config = fieldIndexConfigs.getConfig(index);
- if (config.isEnabled()) {
+ if (config.isEnabled() && index.shouldCreateIndex(context, config)) {
+ //noinspection resource
creatorsByIndex.put(index, index.createIndexCreator(context, config));
}
}
diff --git
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/IndexType.java
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/IndexType.java
index 7afccb1ad03..83313a942f2 100644
---
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/IndexType.java
+++
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/IndexType.java
@@ -87,6 +87,16 @@ public interface IndexType<C extends IndexConfig, IR extends
IndexReader, IC ext
return getId();
}
+ /// Returns whether this index should be built for the given column at
segment-creation time. Default `true`. The
+ /// segment-creator dispatch loop calls this after confirming
`indexConfig.isEnabled()`; if this returns `false`,
+ /// [#createIndexCreator] is not invoked. Implementations should inspect
column-shape signals on `context` (e.g.
+ /// `isSorted`, `isSingleValueField`, stored type) to filter out columns
that are not candidates for this index even
+ /// when the config is enabled. Use this when the inability to build is a
runtime property of the column rather than
+ /// a config issue (config-level invalidity should still throw from
[#validate]).
+ default boolean shouldCreateIndex(IndexCreationContext context, C
indexConfig) {
+ return true;
+ }
+
/**
* Returns the {@link IndexCreator} that can should be used to create an
index of this type with the given context
* and configuration.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]