This is an automated email from the ASF dual-hosted git repository.
xiangfu 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 9286da251fa Enable Json Index for MAP data type (#16808)
9286da251fa is described below
commit 9286da251fa60fe0dd762477997045926415e568
Author: RAGHVENDRA KUMAR YADAV <[email protected]>
AuthorDate: Fri Sep 12 20:43:40 2025 -0700
Enable Json Index for MAP data type (#16808)
* Fix an issue in update indices for Composite Json Index for MAP column.
* Fix an issue in update indices for Json Index for MAP column.
* Update
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/invertedindex/JsonIndexHandler.java
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
---
.../apache/pinot/core/operator/filter/MapFilterOperator.java | 11 +++++++++++
.../segment/index/loader/invertedindex/JsonIndexHandler.java | 4 ++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/MapFilterOperator.java
b/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/MapFilterOperator.java
index bc4b19e52b5..b4a338938c9 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/MapFilterOperator.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/operator/filter/MapFilterOperator.java
@@ -21,6 +21,7 @@ package org.apache.pinot.core.operator.filter;
import com.google.common.base.CaseFormat;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import org.apache.pinot.common.request.context.ExpressionContext;
import org.apache.pinot.common.request.context.FilterContext;
import org.apache.pinot.common.request.context.predicate.EqPredicate;
@@ -34,6 +35,8 @@ import org.apache.pinot.core.operator.ExplainAttributeBuilder;
import org.apache.pinot.core.query.request.context.QueryContext;
import org.apache.pinot.segment.spi.IndexSegment;
import org.apache.pinot.segment.spi.datasource.DataSource;
+import org.apache.pinot.segment.spi.index.IndexService;
+import org.apache.pinot.segment.spi.index.IndexType;
import org.apache.pinot.segment.spi.index.reader.JsonIndexReader;
@@ -70,6 +73,14 @@ public class MapFilterOperator extends BaseFilterOperator {
DataSource dataSource = indexSegment.getDataSourceNullable(_columnName);
if (dataSource != null) {
jsonIndex = dataSource.getJsonIndex();
+ if (jsonIndex == null) {
+ // Fallback to Composite JSON Index if standard JSON index is not
available
+ Optional<IndexType<?, ?, ?>> compositeIndex =
+ IndexService.getInstance().getOptional("composite_json_index");
+ if (compositeIndex.isPresent()) {
+ jsonIndex = (JsonIndexReader)
dataSource.getIndex(compositeIndex.get());
+ }
+ }
}
}
if (jsonIndex != null) {
diff --git
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/invertedindex/JsonIndexHandler.java
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/invertedindex/JsonIndexHandler.java
index 5636e447f1e..7821e76ab48 100644
---
a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/invertedindex/JsonIndexHandler.java
+++
b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/invertedindex/JsonIndexHandler.java
@@ -134,8 +134,8 @@ public class JsonIndexHandler extends BaseIndexHandler {
// Create new json index for the column.
LOGGER.info("Creating new json index for segment: {}, column: {}",
segmentName, columnName);
Preconditions.checkState(columnMetadata.isSingleValue() &&
(columnMetadata.getDataType() == DataType.STRING
- || columnMetadata.getDataType() == DataType.JSON),
- "Json index can only be applied to single-value STRING or JSON
columns");
+ || columnMetadata.getDataType() == DataType.JSON ||
columnMetadata.getDataType() == DataType.MAP),
+ "Json index can only be applied to single-value STRING, JSON, or MAP
columns");
if (columnMetadata.hasDictionary()) {
handleDictionaryBasedColumn(segmentWriter, columnMetadata);
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]