apache / apache/pinot

Cannot Apply JSON Index on STRING Column

Open
#10,079 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
2d 55m
Merged PRs (30d)
182

Description

Applied JSON index on a tags column with the following config (0.9.0):

```
"jsonIndexColumns": [
"tags"
],
```

Ran the query:

`select span_id from spanEventView where JSON_MATCH(tags, '"$.http.status"=''200''')`

This throws:

```
[
{
"errorCode": 200,
"message": "QueryExecutionError:\njava.lang.IllegalStateException: Cannot apply JSON_MATCH on column: tags without json index\n\tat shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:518)\n\tat org.apache.pinot.core.plan.FilterPlanNode.constructPhysicalOperator(FilterPlanNode.java:225)\n\tat org.apache.pinot.core.plan.FilterPlanNode.run(FilterPlanNode.java:87)\n\tat org.apache.pinot.core.plan.DocIdSetPlanNode.run(DocIdSetPlanNode.java:49)"
}
]
```

There is no JSON index created on this column (even after reloading the table). This, however, worked after making the datatype as JSON. Looks like a bug, as the docs say: Note that JSON index can only be applied to STRING/JSON columns whose values are JSON strings.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown jsonIndexColumns configuration and JSON_MATCH query on a STRING tags column, then compare behavior after changing the column to JSON. Trace the JSON index creation and query execution paths that handle STRING columns. Done means the documented STRING-column case creates an index and the query succeeds, with regression coverage if the project provides a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.