This is an automated email from the ASF dual-hosted git repository.
morningman 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 d482595773c [fix](webui) add connection context to avoid NPE (#49213)
d482595773c is described below
commit d482595773c1bbcb3c6d059a5843bfe1b0aebfee
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Wed Mar 19 09:57:51 2025 +0800
[fix](webui) add connection context to avoid NPE (#49213)
### What problem does this PR solve?
Problem Summary:
When execute statement using Playgroup in FE webui, the NPE may thrown.
This is because we didn't set connection context when executing sql in
StatementSubmitter.
This PR fix it
---
.../main/java/org/apache/doris/httpv2/util/StatementSubmitter.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/util/StatementSubmitter.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/util/StatementSubmitter.java
index 2c9ef15bda0..60144df2c0e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/util/StatementSubmitter.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/util/StatementSubmitter.java
@@ -31,7 +31,9 @@ import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.common.util.SqlParserUtils;
import org.apache.doris.httpv2.util.streamresponse.JsonStreamResponse;
import org.apache.doris.httpv2.util.streamresponse.StreamResponseInf;
+import org.apache.doris.qe.AutoCloseConnectContext;
import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.statistics.util.StatisticsUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -250,7 +252,7 @@ public class StatementSubmitter {
public static StatementBase analyzeStmt(String stmtStr) throws Exception {
SqlParser parser = new SqlParser(new SqlScanner(new
StringReader(stmtStr)));
- try {
+ try (AutoCloseConnectContext a =
StatisticsUtil.buildConnectContext(false)) {
return SqlParserUtils.getFirstStmt(parser);
} catch (AnalysisException e) {
String errorMessage = parser.getErrorMsg(stmtStr);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]