apache / apache/doris

[Bug] IllegalStateException Exception when running short-circuit query on table with `PARTITION BY LIST`

Open
#66,030 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
15.9k
Forks
3.9k
Avg merge
2d 23h
Merged PRs (30d)
520

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.

### Version

Tested `doris-4.1.1-rc01-b10073ad9ca` and `4.1.2-rc01-aec169d2025`. The following exceptions are captured with `doris-4.1.1-rc01-b10073ad9ca`.

### What's Wrong?

Given a table with both `PARTITION BY LIST` and `store_row_column`, `enable_unique_key_merge_on_write` and `light_schema_change` properties, which enables short-circuit queries, a point query will fail with `java.lang.IllegalStateException`.

Exception captured from FE:
```
[StmtExecutor.executeAndSendResult():1440] cancel fragment query_id:90349b0792234501-bd299dcc9db13ada cause null
[StmtExecutor.execute():570] Nereids execute failed. stmt[2396, 90349b0792234501-bd299dcc9db13ada]
java.lang.IllegalStateException
at com.google.common.base.Preconditions.checkState(Preconditions.java:499)
at org.apache.doris.qe.PointQueryExecutor.setScanRangeLocations(PointQueryExecutor.java:120)
at org.apache.doris.qe.PointQueryExecutor.getNext(PointQueryExecutor.java:254)
at org.apache.doris.qe.StmtExecutor.executeAndSendResult(StmtExecutor.java:1344)
at org.apache.doris.qe.StmtExecutor.handleQueryStmt(StmtExecutor.java:1274)
at org.apache.doris.qe.StmtExecutor.handleQueryWithRetry(StmtExecutor.java:931)
at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:838)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:555)
at org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:514)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:499)
at org.apache.doris.nereids.trees.plans.commands.ExecuteCommand.run(ExecuteCommand.java:115)
at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:698)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:555)
at org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:514)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:499)
at org.apache.doris.qe.MysqlConnectProcessor.handleExecute(MysqlConnectProcessor.java:174)
at org.apache.doris.qe.MysqlConnectProcessor.handleExecute(MysqlConnectProcessor.java:221)
at org.apache.doris.qe.MysqlConnectProcessor.dispatch(MysqlConnectProcessor.java:266)
at org.apache.doris.qe.MysqlConnectProcessor.processOnce(MysqlConnectProcessor.java:407)
at org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
RuntimeLogger 2026-07-25 01:28:27,545 WARN (mysql-nio-pool-5|355) [StmtExecutor.execute():566] Analyze failed. stmt[2396, 90349b0792234501-bd299dcc9db13ada]
org.apache.doris.common.NereidsException: errCode = 2, detailMessage = java.lang.IllegalStateException
at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:726)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:555)
at org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:514)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:499)
at org.apache.doris.qe.MysqlConnectProcessor.handleExecute(MysqlConnectProcessor.java:174)
at org.apache.doris.qe.MysqlConnectProcessor.handleExecute(MysqlConnectProcessor.java:221)
at org.apache.doris.qe.MysqlConnectProcessor.dispatch(MysqlConnectProcessor.java:266)
at org.apache.doris.qe.MysqlConnectProcessor.processOnce(MysqlConnectProcessor.java:407)
at org.apache.doris.mysql.ReadListener.lambda$handleEvent$0(ReadListener.java:52)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.doris.common.AnalysisException: errCode = 2, detailMessage = java.lang.IllegalStateException
... 12 more
Caused by: java.lang.IllegalStateException
at com.google.common.base.Preconditions.checkState(Preconditions.java:499)
at org.apache.doris.qe.PointQueryExecutor.setScanRangeLocations(PointQueryExecutor.java:120)
at org.apache.doris.qe.PointQueryExecutor.getNext(PointQueryExecutor.java:254)
at org.apache.doris.qe.StmtExecutor.executeAndSendResult(StmtExecutor.java:1344)
at org.apache.doris.qe.StmtExecutor.handleQueryStmt(StmtExecutor.java:1274)
at org.apache.doris.qe.StmtExecutor.handleQueryWithRetry(StmtExecutor.java:931)
at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:838)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:555)
at org.apache.doris.qe.StmtExecutor.queryRetry(StmtExecutor.java:514)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:499)
at org.apache.doris.nereids.trees.plans.commands.ExecuteCommand.run(ExecuteCommand.java:115)
at org.apache.doris.qe.StmtExecutor.executeByNereids(StmtExecutor.java:698)
... 11 more

finished to tablet scheduler. cost: 0 ms
Null packet received from network. remote: 127.0.0.1:43650

```

While no log from BE is seen.

### What You Expected?

The point query should succeed.

### How to Reproduce?

1. Create a doris cluster.
2. Create a table with both `PARTITION BY LIST` and enables short circuit query:
```
CREATE TABLE tbl_point_query (
pk varchar(64),
_id bigint
)
UNIQUE KEY(pk, _id)
PARTITION BY LIST (`pk`) (PARTITION p_abcd VALUES IN ('abcd'))
DISTRIBUTED BY HASH(pk, _id) BUCKETS AUTO
PROPERTIES (
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true",
"store_row_column" = "true",
"light_schema_change" = "true"
);
```
3. `INSERT INTO tbl_point_query (pk, _id) VALUES ('abcd', 1);`
4. `EXPLAIN SELECT * FROM tbl_point_query WHERE pk = 'abcd' AND _id = 1;` This shows `SHORT-CIRCUIT` in one of the steps.
5. Execute `SELECT * FROM tbl_point_query WHERE pk = 'abcd' AND _id = 1`.

An error is returned as `(1105, 'IllegalStateException, msg: null')`.

### Anything Else?

_No response_

### Are you willing to submit PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the listed PARTITION BY LIST table and point query, then inspect org.apache.doris.qe.PointQueryExecutor.setScanRangeLocations at line 120 and its getNext call path. Done means the query returns the inserted row without IllegalStateException and the reproduction is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.