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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 3a7a80be0b6 [fix](replay) sql mode helper throw npe when ctx == null 
(#40906)
3a7a80be0b6 is described below

commit 3a7a80be0b64dbac38bef81acf9028b12f7d951b
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Thu Sep 19 08:01:56 2024 +0800

    [fix](replay) sql mode helper throw npe when ctx == null (#40906)
---
 .../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