This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 6c3a273d46b [fix](Nereids) replay create function npe since connect 
context not exists (#43075)
6c3a273d46b is described below

commit 6c3a273d46b6539aa1bddfeeec103dd8b9b55b60
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Fri Nov 1 21:01:24 2024 +0800

    [fix](Nereids) replay create function npe since connect context not exists 
(#43075)
    
    nereids will parse function statement when replay create alias function,
    when do parse, need to get sql mode and other variable. because replay
    thread do not have connect context, NPE be thrown when parsing
---
 .../src/main/java/org/apache/doris/qe/SqlModeHelper.java       | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SqlModeHelper.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SqlModeHelper.java
index 9a9eda648b2..d33800eeb8c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SqlModeHelper.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SqlModeHelper.java
@@ -210,12 +210,18 @@ public class SqlModeHelper {
     }
 
     public static boolean hasNoBackSlashEscapes() {
-        return ((ConnectContext.get().getSessionVariable().getSqlMode() & 
MODE_ALLOWED_MASK)
+        SessionVariable sessionVariable = ConnectContext.get() == null
+                ? VariableMgr.newSessionVariable()
+                : ConnectContext.get().getSessionVariable();
+        return ((sessionVariable.getSqlMode() & MODE_ALLOWED_MASK)
                 & MODE_NO_BACKSLASH_ESCAPES) != 0;
     }
 
     public static boolean hasPipeAsConcat() {
-        return ((ConnectContext.get().getSessionVariable().getSqlMode() & 
MODE_ALLOWED_MASK)
+        SessionVariable sessionVariable = ConnectContext.get() == null
+                ? VariableMgr.newSessionVariable()
+                : ConnectContext.get().getSessionVariable();
+        return ((sessionVariable.getSqlMode() & MODE_ALLOWED_MASK)
                 & MODE_PIPES_AS_CONCAT) != 0;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to