This is an automated email from the ASF dual-hosted git repository.
morrySnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a1f87fbbd94 [fix](statistics) Fix NPE in SHOW ANALYZE TASK STATUS for
missing job id (#68469)
a1f87fbbd94 is described below
commit a1f87fbbd942e71c6126844bf80b8c981517d1ca
Author: yujun <[email protected]>
AuthorDate: Thu Sep 24 18:01:46 2026 +0800
[fix](statistics) Fix NPE in SHOW ANALYZE TASK STATUS for missing job id
(#68469)
### What problem does this PR solve?
Problem Summary: `SHOW ANALYZE TASK STATUS <id>` on a non-existent
analyze job id dereferenced the null `AnalysisInfo` returned by
`AnalysisManager.findJobInfo` without a null check, surfacing an
internal `NullPointerException` (`Cannot read field "catalogId" because
"jobInfo" is null`). It now reports `Analyze job [<id>] not exists`,
consistent with the existing error of `DROP ANALYZE JOB`. The regression
case `test_show_analyze_task_status_cmd` is extended with a
`test{sql,exception}` case for a missing job id.
### Release note
`SHOW ANALYZE TASK STATUS` with a non-existent analyze job id now
returns a clear "Analyze job [...] not exists" error instead of an
internal NullPointerException.
---
.../doris/nereids/trees/plans/commands/ShowAnalyzeTaskCommand.java | 3 +++
.../suites/query_p0/show/test_show_analyze_task_status_cmd.groovy | 6 ++++++
2 files changed, 9 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAnalyzeTaskCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAnalyzeTaskCommand.java
index a788ee484ed..d41dafb8134 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAnalyzeTaskCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAnalyzeTaskCommand.java
@@ -68,6 +68,9 @@ public class ShowAnalyzeTaskCommand extends ShowCommand {
+ "in your FE conf file");
}
AnalysisInfo jobInfo =
Env.getCurrentEnv().getAnalysisManager().findJobInfo(jobId);
+ if (jobInfo == null) {
+ throw new UserException(String.format("Analyze job [%d] not
exists", jobId));
+ }
TableIf table = StatisticsUtil.findTable(jobInfo.catalogId,
jobInfo.dbId, jobInfo.tblId);
List<AnalysisInfo> analysisInfos =
Env.getCurrentEnv().getAnalysisManager().findTasks(jobId);
List<List<String>> rows = new ArrayList<>();
diff --git
a/regression-test/suites/query_p0/show/test_show_analyze_task_status_cmd.groovy
b/regression-test/suites/query_p0/show/test_show_analyze_task_status_cmd.groovy
index 8702ef57c79..d927dde3b0e 100644
---
a/regression-test/suites/query_p0/show/test_show_analyze_task_status_cmd.groovy
+++
b/regression-test/suites/query_p0/show/test_show_analyze_task_status_cmd.groovy
@@ -37,6 +37,12 @@ suite("test_show_analyze_task_status_cmd", "query_p0") {
// Insert some data
sql """ INSERT INTO ${tableName} VALUES (1, 'a'), (2, 'b') """
+ // SHOW ANALYZE TASK STATUS for a non-existent job should report a clear
error
+ test {
+ sql """ SHOW ANALYZE TASK STATUS 922337203685477 """
+ exception "Analyze job [922337203685477] not exists"
+ }
+
// Run analyze asynchronously
def analyzeResult = sql """ ANALYZE TABLE ${tableName} """
assertTrue(analyzeResult.size() == 1, "Unexpected analyze result size")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]