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

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


The following commit(s) were added to refs/heads/branch-4.2 by this push:
     new be64a28a033 branch-4.2: [fix](variables) Normalize case-insensitive 
session variables, configs, and load headers (#71263)
be64a28a033 is described below

commit be64a28a03397cb4998849525a08bc9f2866dfb1
Author: linrrarity <[email protected]>
AuthorDate: Thu Dec 3 16:02:20 2026 +0800

    branch-4.2: [fix](variables) Normalize case-insensitive session variables, 
configs, and load headers (#71263)
    
    pick: https://github.com/apache/doris/pull/70907
---
 be/src/agent/heartbeat_server.cpp                  |   3 +-
 be/src/common/daemon.cpp                           |   7 +-
 be/src/common/logconfig.cpp                        |   6 +-
 be/src/service/http/action/http_stream.cpp         |   6 +-
 be/src/service/http/action/stream_load.cpp         |   2 +-
 .../main/java/org/apache/doris/catalog/Env.java    |   3 +-
 .../java/org/apache/doris/common/Log4jConfig.java  |   8 +-
 .../apache/doris/common/util/PropertyAnalyzer.java |  15 +-
 .../org/apache/doris/nereids/NereidsPlanner.java   |  16 +-
 .../functions/scalar/AesCryptoFunction.java        |   3 +-
 .../functions/scalar/CryptoFunction.java           |   3 +-
 .../java/org/apache/doris/qe/SessionVariable.java  |  70 ++++---
 .../main/java/org/apache/doris/qe/VariableMgr.java |  28 ++-
 .../org/apache/doris/qe/VariableVarCallbacks.java  |   2 +-
 .../main/java/org/apache/doris/resource/Tag.java   |   6 +-
 .../apache/doris/service/FrontendServiceImpl.java  |   2 +-
 .../main/java/org/apache/doris/system/Backend.java |  23 ++-
 .../java/org/apache/doris/system/HeartbeatMgr.java |   3 +-
 .../apache/doris/common/PropertyAnalyzerTest.java  |  27 +++
 .../qe/SessionVariableCaseInsensitiveTest.java     | 207 +++++++++++++++++++++
 .../data/datatype_p0/serde/test_serde_dialect.out  |   6 +
 .../encryption_digest/test_encryption_function.out |  15 ++
 .../datatype_p0/serde/test_serde_dialect.groovy    |   6 +
 .../test_encryption_function.groovy                |  10 +
 24 files changed, 415 insertions(+), 62 deletions(-)

diff --git a/be/src/agent/heartbeat_server.cpp 
b/be/src/agent/heartbeat_server.cpp
index d66ec68f629..ee0d81ab0cd 100644
--- a/be/src/agent/heartbeat_server.cpp
+++ b/be/src/agent/heartbeat_server.cpp
@@ -41,6 +41,7 @@
 #include "util/debug_util.h"
 #include "util/mem_info.h"
 #include "util/network_util.h"
+#include "util/string_util.h"
 #include "util/thrift_server.h"
 #include "util/time.h"
 
@@ -87,7 +88,7 @@ void HeartbeatServer::heartbeat(THeartbeatResult& 
heartbeat_result,
         
heartbeat_result.backend_info.__set_arrow_flight_sql_port(config::arrow_flight_sql_port);
         heartbeat_result.backend_info.__set_version(get_short_version());
         heartbeat_result.backend_info.__set_be_start_time(_be_epoch);
-        heartbeat_result.backend_info.__set_be_node_role(config::be_node_role);
+        
heartbeat_result.backend_info.__set_be_node_role(to_lower(config::be_node_role));
         // If be is gracefully stop, then k_doris_exist is set to true
         heartbeat_result.backend_info.__set_is_shutdown(doris::k_doris_exit);
         heartbeat_result.backend_info.__set_fragment_executing_count(
diff --git a/be/src/common/daemon.cpp b/be/src/common/daemon.cpp
index 43772c14b0a..273d216412b 100644
--- a/be/src/common/daemon.cpp
+++ b/be/src/common/daemon.cpp
@@ -61,6 +61,7 @@
 #include "util/mem_info.h"
 #include "util/perf_counters.h"
 #include "util/s3_rate_limiter_manager.h"
+#include "util/string_util.h"
 #include "util/time.h"
 
 namespace doris {
@@ -101,12 +102,14 @@ void Daemon::tcmalloc_gc_thread() {
             std::min(MemInfo::physical_mem() - 
MemInfo::sys_mem_available_low_water_mark(),
                      MemInfo::mem_limit());
 
-    if (config::memory_mode == std::string("performance")) {
+    // be.conf may spell the mode in any letter case; "PERFORMANCE" or 
"Compact" must not silently
+    // fall back to the moderate defaults.
+    if (iequal(config::memory_mode, "performance")) {
         max_cache_percent = 100;
         pressure_limit = 90;
         is_performance_mode = true;
         physical_limit_bytes = std::min(MemInfo::mem_limit(), 
MemInfo::physical_mem());
-    } else if (config::memory_mode == std::string("compact")) {
+    } else if (iequal(config::memory_mode, "compact")) {
         max_cache_percent = 20;
         pressure_limit = 80;
     }
diff --git a/be/src/common/logconfig.cpp b/be/src/common/logconfig.cpp
index 73d4177a8de..30552f52720 100644
--- a/be/src/common/logconfig.cpp
+++ b/be/src/common/logconfig.cpp
@@ -211,13 +211,13 @@ bool init_glog(const char* basename) {
     std::string& rollmode = config::sys_log_roll_mode;
     std::string sizeflag = "SIZE-MB-";
     bool ok = false;
-    if (rollmode.compare("TIME-DAY") == 0) {
+    if (iequals(rollmode, "TIME-DAY")) {
         FLAGS_log_split_method = "day";
         ok = true;
-    } else if (rollmode.compare("TIME-HOUR") == 0) {
+    } else if (iequals(rollmode, "TIME-HOUR")) {
         FLAGS_log_split_method = "hour";
         ok = true;
-    } else if (rollmode.substr(0, sizeflag.length()).compare(sizeflag) == 0) {
+    } else if (iequals(rollmode.substr(0, sizeflag.length()), sizeflag)) {
         FLAGS_log_split_method = "size";
         std::string sizestr = rollmode.substr(sizeflag.size(), rollmode.size() 
- sizeflag.size());
         if (sizestr.size() != 0) {
diff --git a/be/src/service/http/action/http_stream.cpp 
b/be/src/service/http/action/http_stream.cpp
index bf4d9ba06f4..4cdd8732ad2 100644
--- a/be/src/service/http/action/http_stream.cpp
+++ b/be/src/service/http/action/http_stream.cpp
@@ -363,8 +363,8 @@ Status HttpStreamAction::process_put(HttpRequest* http_req,
     request.__set_loadId(ctx->id.to_thrift());
     request.__set_label(ctx->label);
     if (ctx->group_commit) {
-        if (!http_req->header(HTTP_GROUP_COMMIT).empty()) {
-            
request.__set_group_commit_mode(http_req->header(HTTP_GROUP_COMMIT));
+        if (http_req != nullptr && 
!http_req->header(HTTP_GROUP_COMMIT).empty()) {
+            
request.__set_group_commit_mode(to_lower(http_req->header(HTTP_GROUP_COMMIT)));
         } else {
             // used for wait_internal_group_commit_finish
             request.__set_group_commit_mode("sync_mode");
@@ -402,7 +402,7 @@ Status HttpStreamAction::process_put(HttpRequest* http_req,
     ctx->txn_id = ctx->put_result.pipeline_params.txn_conf.txn_id;
     ctx->label = ctx->put_result.pipeline_params.import_label;
     ctx->put_result.pipeline_params.__set_wal_id(ctx->wal_id);
-    if (http_req != nullptr && http_req->header(HTTP_GROUP_COMMIT) == 
"async_mode") {
+    if (http_req != nullptr && iequal(http_req->header(HTTP_GROUP_COMMIT), 
"async_mode")) {
         // FIXME find a way to avoid chunked stream load write large WALs
         size_t content_length = 0;
         if (!http_req->header(HttpHeaders::CONTENT_LENGTH).empty()) {
diff --git a/be/src/service/http/action/stream_load.cpp 
b/be/src/service/http/action/stream_load.cpp
index dd930f850f1..bef8d431626 100644
--- a/be/src/service/http/action/stream_load.cpp
+++ b/be/src/service/http/action/stream_load.cpp
@@ -992,7 +992,7 @@ Status StreamLoadAction::_handle_group_commit(HttpRequest* 
req,
         ctx->group_commit = false;
     } else {
         if (!group_commit_header.empty()) {
-            ctx->group_commit_mode = group_commit_header;
+            ctx->group_commit_mode = to_lower(group_commit_header);
             ctx->group_commit = true;
         } else {
             // use table property to decide group commit or not
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index 2b2bf640dbe..49e8d345988 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -284,7 +284,6 @@ import org.apache.doris.task.AgentTaskQueue;
 import org.apache.doris.task.CompactionTask;
 import org.apache.doris.task.MasterTaskExecutor;
 import org.apache.doris.task.PriorityMasterTaskExecutor;
-import org.apache.doris.thrift.TCompressionType;
 import org.apache.doris.thrift.TFrontendInfo;
 import org.apache.doris.thrift.TGetMetaDBMeta;
 import org.apache.doris.thrift.TGetMetaIndexMeta;
@@ -3891,7 +3890,7 @@ public class Env {
         }
 
         // compression type
-        if (olapTable.getCompressionType() != 
TCompressionType.valueOf(Config.default_compression_type)) {
+        if (olapTable.getCompressionType() != 
PropertyAnalyzer.getDefaultCompressionType()) {
             
sb.append(",\n\"").append(PropertyAnalyzer.PROPERTIES_COMPRESSION).append("\" = 
\"");
             sb.append(olapTable.getCompressionType()).append("\"");
         }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java
index b35e076c07f..312b052b50b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/Log4jConfig.java
@@ -219,9 +219,9 @@ public class Log4jConfig extends XmlConfiguration {
 
         String sysLogRollPattern = "%d{yyyyMMdd}";
         String sysRollMaxSize = String.valueOf(Config.log_roll_size_mb);
-        if (Config.sys_log_roll_interval.equals("HOUR")) {
+        if (Config.sys_log_roll_interval.equalsIgnoreCase("HOUR")) {
             sysLogRollPattern = "%d{yyyyMMddHH}";
-        } else if (Config.sys_log_roll_interval.equals("DAY")) {
+        } else if (Config.sys_log_roll_interval.equalsIgnoreCase("DAY")) {
             sysLogRollPattern = "%d{yyyyMMdd}";
         } else {
             throw new IOException("sys_log_roll_interval config error: " + 
Config.sys_log_roll_interval);
@@ -234,9 +234,9 @@ public class Log4jConfig extends XmlConfiguration {
         String auditRollMaxSize = String.valueOf(Config.log_roll_size_mb);
         String auditDeleteAge = String.valueOf(Config.audit_log_delete_age);
         boolean compressAuditLog = Config.audit_log_enable_compress;
-        if (Config.audit_log_roll_interval.equals("HOUR")) {
+        if (Config.audit_log_roll_interval.equalsIgnoreCase("HOUR")) {
             auditLogRollPattern = "%d{yyyyMMddHH}";
-        } else if (Config.audit_log_roll_interval.equals("DAY")) {
+        } else if (Config.audit_log_roll_interval.equalsIgnoreCase("DAY")) {
             auditLogRollPattern = "%d{yyyyMMdd}";
         } else {
             throw new IOException("audit_log_roll_interval config error: " + 
Config.audit_log_roll_interval);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java
index d792e08589b..10a05e41a33 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java
@@ -1153,7 +1153,8 @@ public class PropertyAnalyzer {
     }
 
     public static TCompressionType stringToCompressionType(String 
compressionType) throws AnalysisException {
-        if (compressionType.equalsIgnoreCase("no_compression")) {
+        if (compressionType.equalsIgnoreCase("no_compression")
+                || compressionType.equalsIgnoreCase("none")) {
             return TCompressionType.NO_COMPRESSION;
         } else if (compressionType.equalsIgnoreCase("lz4")) {
             return TCompressionType.LZ4;
@@ -1169,7 +1170,7 @@ public class PropertyAnalyzer {
             return TCompressionType.SNAPPY;
         } else if (compressionType.equalsIgnoreCase("default_compression")
                 && 
!Config.default_compression_type.equalsIgnoreCase("default_compression")) {
-            return TCompressionType.valueOf(Config.default_compression_type);
+            return stringToCompressionType(Config.default_compression_type);
         } else if (compressionType.equalsIgnoreCase("default_compression")) {
             return TCompressionType.LZ4F;
         } else {
@@ -1177,6 +1178,16 @@ public class PropertyAnalyzer {
         }
     }
 
+    public static TCompressionType getDefaultCompressionType() {
+        try {
+            return stringToCompressionType(Config.default_compression_type);
+        } catch (AnalysisException e) {
+            LOG.warn("Invalid Config.default_compression_type: {}, fallback to 
LZ4F",
+                    Config.default_compression_type, e);
+            return TCompressionType.LZ4F;
+        }
+    }
+
     // analyzeCompressionType will parse the compression type from properties
     public static TCompressionType 
getCompressionTypeFromProperties(Map<String, String> properties)
             throws AnalysisException {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
index 969e6f77708..047bad5f269 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
@@ -88,6 +88,7 @@ import org.apache.doris.qe.VariableMgr;
 import org.apache.doris.qe.cache.CacheAnalyzer;
 import org.apache.doris.statistics.util.StatisticsUtil;
 import org.apache.doris.thrift.TQueryCacheParam;
+import org.apache.doris.thrift.TSerdeDialect;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Lists;
@@ -1034,15 +1035,20 @@ public class NereidsPlanner extends Planner {
     private void setFormatOptions() {
         ConnectContext ctx = statementContext.getConnectContext();
         SessionVariable sessionVariable = ctx.getSessionVariable();
-        switch (sessionVariable.serdeDialect) {
-            case "presto":
-            case "trino":
+        TSerdeDialect serdeDialect;
+        try {
+            serdeDialect = sessionVariable.getSerdeDialect();
+        } catch (IllegalArgumentException e) {
+            throw new AnalysisException("Unsupported serde dialect: " + 
sessionVariable.serdeDialect, e);
+        }
+        switch (serdeDialect) {
+            case PRESTO:
                 
statementContext.setFormatOptions(FormatOptions.getForPresto());
                 break;
-            case "hive":
+            case HIVE:
                 statementContext.setFormatOptions(FormatOptions.getForHive());
                 break;
-            case "doris":
+            case DORIS:
                 statementContext.setFormatOptions(FormatOptions.getDefault());
                 break;
             default:
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesCryptoFunction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesCryptoFunction.java
index 4d9eb16679c..d36430e7fac 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesCryptoFunction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesCryptoFunction.java
@@ -25,6 +25,7 @@ import 
org.apache.doris.nereids.trees.expressions.literal.StringLiteral;
 import com.google.common.collect.ImmutableSet;
 
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /** AesCryptoFunction */
@@ -96,7 +97,7 @@ public abstract class AesCryptoFunction extends 
CryptoFunction {
     @Override
     public void checkLegalityAfterRewrite() {
         if (arity() >= 4 && child(3) instanceof StringLikeLiteral) {
-            String mode = ((StringLikeLiteral) 
child(3)).getValue().toUpperCase();
+            String mode = ((StringLikeLiteral) 
child(3)).getValue().toUpperCase(Locale.ROOT);
             if (!AES_MODES.contains(mode)) {
                 throw new AnalysisException("mode " + mode + " is not 
supported");
             }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CryptoFunction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CryptoFunction.java
index 09d540c9c28..929b269a3f8 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CryptoFunction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CryptoFunction.java
@@ -28,6 +28,7 @@ import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.List;
+import java.util.Locale;
 
 /** CryptoFunction */
 public abstract class CryptoFunction extends ScalarFunction
@@ -86,6 +87,6 @@ public abstract class CryptoFunction extends ScalarFunction
         if (StringUtils.isAllBlank(blockEncryptionMode)) {
             blockEncryptionMode = defaultMode;
         }
-        return new StringLiteral(blockEncryptionMode);
+        return new StringLiteral(blockEncryptionMode.toUpperCase(Locale.ROOT));
     }
 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index dbe92dc95d3..51f552eaeac 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -55,6 +55,7 @@ import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import org.apache.commons.lang3.StringUtils;
@@ -1846,8 +1847,9 @@ public class SessionVariable implements Serializable, 
Writable {
     @VariableMgr.VarAttr(name = ENABLE_REWRITE_ELEMENT_AT_TO_SLOT, fuzzy = 
true)
     private boolean enableRewriteElementAtToSlot = true;
 
-    @VariableMgr.VarAttr(name = FORCE_SORT_ALGORITHM, needForward = true, 
description = { "强制指定 SortNode 的排序算法",
-            "Force the sort algorithm of SortNode to be specified" })
+    @VariableMgr.VarAttr(name = FORCE_SORT_ALGORITHM, needForward = true, 
stringCase = VariableMgr.StringCase.LOWER,
+            description = {"强制指定 SortNode 的排序算法",
+                    "Force the sort algorithm of SortNode to be specified"})
     public String forceSortAlgorithm = "";
 
     @VariableMgr.VarAttr(name = FULL_SORT_MAX_BUFFERED_BYTES, needForward = 
true,
@@ -1913,7 +1915,8 @@ public class SessionVariable implements Serializable, 
Writable {
                     "set the number of sort phases 1 or 2. if set other value, 
let cbo decide the sort type"})
     public int sortPhaseNum = 0;
 
-    @VariableMgr.VarAttr(name = HIVE_TEXT_COMPRESSION, fuzzy = true, 
needForward = true)
+    @VariableMgr.VarAttr(name = HIVE_TEXT_COMPRESSION, fuzzy = true, 
needForward = true,
+            stringCase = VariableMgr.StringCase.LOWER)
     private String hiveTextCompression = "plain";
 
     @VariableMgr.VarAttr(name = READ_CSV_EMPTY_LINE_AS_NULL, needForward = 
true,
@@ -2092,7 +2095,8 @@ public class SessionVariable implements Serializable, 
Writable {
     @VariableMgr.VarAttr(name = RETURN_OBJECT_DATA_AS_BINARY, 
affectQueryResultInExecution = true)
     private boolean returnObjectDataAsBinary = false;
 
-    @VariableMgr.VarAttr(name = BLOCK_ENCRYPTION_MODE, affectQueryResultInPlan 
= true)
+    @VariableMgr.VarAttr(name = BLOCK_ENCRYPTION_MODE, affectQueryResultInPlan 
= true,
+            stringCase = VariableMgr.StringCase.UPPER)
     private String blockEncryptionMode = "";
 
     @VariableMgr.VarAttr(name = ENABLE_PROJECTION)
@@ -2487,10 +2491,11 @@ public class SessionVariable implements Serializable, 
Writable {
     public boolean enableFileCacheIoAdaptor = true;
 
     // Specify base path for file cache, or chose a random path.
-    @VariableMgr.VarAttr(name = FILE_CACHE_BASE_PATH, needForward = true, 
description = {
-            "指定 block file cache 在 BE 上的存储路径,默认 'random',随机选择 BE 配置的存储路径。",
-            "Specify the storage path of the block file cache on BE, default 
'random', "
-                    + "and randomly select the storage path configured by 
BE."})
+    @VariableMgr.VarAttr(name = FILE_CACHE_BASE_PATH, needForward = true, 
setter = "setFileCacheBasePath",
+            description = {
+                    "指定 block file cache 在 BE 上的存储路径,默认 'random',随机选择 BE 
配置的存储路径。",
+                    "Specify the storage path of the block file cache on BE, 
default 'random', "
+                            + "and randomly select the storage path configured 
by BE."})
     public String fileCacheBasePath = "random";
 
     // Whether enable query with inverted index.
@@ -2978,7 +2983,7 @@ public class SessionVariable implements Serializable, 
Writable {
     @VariableMgr.VarAttr(name = LOAD_STREAM_PER_NODE)
     public int loadStreamPerNode = 2;
 
-    @VariableMgr.VarAttr(name = GROUP_COMMIT, needForward = true)
+    @VariableMgr.VarAttr(name = GROUP_COMMIT, needForward = true, stringCase = 
VariableMgr.StringCase.LOWER)
     public String groupCommit = "off_mode";
 
     @VariableMgr.VarAttr(name = ENABLE_PREPARED_STMT_AUDIT_LOG, needForward = 
true)
@@ -3015,6 +3020,7 @@ public class SessionVariable implements Serializable, 
Writable {
     public boolean invertedIndexCompatibleRead = false;
 
     @VariableMgr.VarAttr(name = SQL_DIALECT, needForward = true, checker = 
"checkSqlDialect",
+            stringCase = VariableMgr.StringCase.LOWER,
             description = {"解析 sql 使用的方言", "The dialect used to parse sql."},
             affectQueryResultInPlan = true
     )
@@ -3026,9 +3032,10 @@ public class SessionVariable implements Serializable, 
Writable {
     public boolean retryOriginSqlOnConvertFail = false;
 
     @VariableMgr.VarAttr(name = SERDE_DIALECT, needForward = true, checker = 
"checkSerdeDialect",
+            stringCase = VariableMgr.StringCase.LOWER,
             description = {"返回给 MySQL 客户端时各数据类型的输出格式方言",
                     "The output format dialect of each data type returned to 
the MySQL client."},
-            options = {"doris", "presto", "trino"},
+            options = {"doris", "presto", "trino", "hive"},
             affectQueryResultInPlan = true, affectQueryResultInExecution = true
     )
     public String serdeDialect = "doris";
@@ -3157,6 +3164,7 @@ public class SessionVariable implements Serializable, 
Writable {
     public boolean enableMaterializedViewRewrite = true;
 
     @VariableMgr.VarAttr(name = PRE_MATERIALIZED_VIEW_REWRITE_STRATEGY, 
needForward = true, fuzzy = true,
+            stringCase = VariableMgr.StringCase.UPPER,
             description = {"在 RBO 阶段基于结构信息的物化视图透明改写的策略,FORCE_IN_RBO:强制在 RBO 
阶段透明改写,"
                     + "TRY_IN_RBO:如果在 NEED_PRE_REWRITE_RULE_TYPES 
中的规则改写成功了,那么就会尝试在 RBO 阶段透明改写"
                     + "NOT_IN_RBO:不尝试在 RBO 阶段改写,只在 CBO 阶段改写",
@@ -3451,7 +3459,8 @@ public class SessionVariable implements Serializable, 
Writable {
     public static final String ENABLE_SEGMENT_CACHE = "enable_segment_cache";
 
     public Set<String> getIgnoreShapePlanNodes() {
-        return 
Arrays.stream(ignoreShapePlanNodes.split(",[\\s]*")).collect(ImmutableSet.toImmutableSet());
+        return Arrays.stream(ignoreShapePlanNodes.split(",[\\s]*"))
+                
.collect(ImmutableSortedSet.toImmutableSortedSet(String.CASE_INSENSITIVE_ORDER));
     }
 
     public void setIgnoreShapePlanNodes(String ignoreShapePlanNodes) {
@@ -3482,7 +3491,7 @@ public class SessionVariable implements Serializable, 
Writable {
 
     public void setDetailShapePlanNodes(String detailShapePlanNodes) {
         this.detailShapePlanNodesSet = 
Arrays.stream(detailShapePlanNodes.split(",[\\s]*"))
-                .collect(ImmutableSet.toImmutableSet());
+                
.collect(ImmutableSortedSet.toImmutableSortedSet(String.CASE_INSENSITIVE_ORDER));
         this.detailShapePlanNodes = detailShapePlanNodes;
     }
 
@@ -3787,6 +3796,7 @@ public class SessionVariable implements Serializable, 
Writable {
     public boolean skipCheckingAcidVersionFile = false;
 
     @VariableMgr.VarAttr(name = ENABLE_SQL_CONVERTOR_FEATURES, needForward = 
true,
+            stringCase = VariableMgr.StringCase.LOWER,
             checker = "checkSqlConvertorFeatures",
             description = {
                     "开启 SQL 转换器的指定功能。多个功能使用逗号分隔",
@@ -4346,7 +4356,11 @@ public class SessionVariable implements Serializable, 
Writable {
     }
 
     public void setBlockEncryptionMode(String blockEncryptionMode) {
-        this.blockEncryptionMode = blockEncryptionMode;
+        this.blockEncryptionMode = blockEncryptionMode == null ? null : 
blockEncryptionMode.toUpperCase(Locale.ROOT);
+    }
+
+    public void setGroupCommit(String groupCommit) {
+        this.groupCommit = groupCommit == null ? null : 
groupCommit.toLowerCase(Locale.ROOT);
     }
 
     public void setRewriteOrToInPredicateThreshold(int threshold) {
@@ -5332,7 +5346,7 @@ public class SessionVariable implements Serializable, 
Writable {
     }
 
     public void setSqlDialect(String sqlDialect) {
-        this.sqlDialect = sqlDialect == null ? null : sqlDialect.toLowerCase();
+        this.sqlDialect = sqlDialect == null ? null : 
sqlDialect.toLowerCase(Locale.ROOT);
     }
 
     /**
@@ -5832,7 +5846,12 @@ public class SessionVariable implements Serializable, 
Writable {
     }
 
     public void setFileCacheBasePath(String basePath) {
-        this.fileCacheBasePath = basePath;
+        // "random" is a keyword compared case-insensitively; any other value 
is a directory path whose case matters.
+        if (basePath != null && basePath.equalsIgnoreCase("random")) {
+            this.fileCacheBasePath = "random";
+        } else {
+            this.fileCacheBasePath = basePath;
+        }
     }
 
     public boolean isEnableInvertedIndexQuery() {
@@ -6243,7 +6262,8 @@ public class SessionVariable implements Serializable, 
Writable {
                         field.set(this, root.get(attr.name()));
                         break;
                     case "String":
-                        field.set(this, root.get(attr.name()));
+                        field.set(this, 
VariableMgr.normalizeString(attr.stringCase(),
+                                (String) root.get(attr.name())));
                         break;
                     default:
                         // Unsupported type variable.
@@ -6298,7 +6318,8 @@ public class SessionVariable implements Serializable, 
Writable {
                         field.set(this, 
Double.valueOf(sessionVarMap.get(attr.name())));
                         break;
                     case "String":
-                        field.set(this, sessionVarMap.get(attr.name()));
+                        field.set(this, 
VariableMgr.normalizeString(attr.stringCase(),
+                                sessionVarMap.get(attr.name())));
                         break;
                     default:
                         // Unsupported type variable.
@@ -6434,7 +6455,7 @@ public class SessionVariable implements Serializable, 
Writable {
             if (innerParts.length != 2) {
                 continue;
             }
-            if (innerParts[0].equals("trace_id")) {
+            if (innerParts[0].equalsIgnoreCase("trace_id")) {
                 return innerParts[1];
             }
         }
@@ -6534,15 +6555,16 @@ public class SessionVariable implements Serializable, 
Writable {
     }
 
     public String hiveTextCompression() {
-        if (hiveTextCompression.equals("uncompressed")) {
+        if ("uncompressed".equalsIgnoreCase(hiveTextCompression)) {
             // This is for compatibility.
             return "plain";
         }
-        return hiveTextCompression;
+        return VariableMgr.normalizeString(VariableMgr.StringCase.LOWER, 
hiveTextCompression);
     }
 
     public void setHiveTextCompression(String hiveTextCompression) {
-        this.hiveTextCompression = hiveTextCompression;
+        this.hiveTextCompression = hiveTextCompression == null
+                ? null : hiveTextCompression.toLowerCase(Locale.ROOT);
     }
 
     public boolean enableSyncRuntimeFilterSize() {
@@ -6797,7 +6819,8 @@ public class SessionVariable implements Serializable, 
Writable {
     }
 
     public void setPreMaterializedViewRewriteStrategy(String 
preMaterializedViewRewriteStrategy) {
-        this.preMaterializedViewRewriteStrategy = 
preMaterializedViewRewriteStrategy;
+        this.preMaterializedViewRewriteStrategy = 
preMaterializedViewRewriteStrategy == null
+                ? null : 
preMaterializedViewRewriteStrategy.toUpperCase(Locale.ROOT);
     }
 
     public boolean isEnableDmlMaterializedViewRewrite() {
@@ -6938,7 +6961,8 @@ public class SessionVariable implements Serializable, 
Writable {
     }
 
     public TSerdeDialect getSerdeDialect() {
-        switch (serdeDialect) {
+        String normalized = serdeDialect == null ? "" : 
serdeDialect.toLowerCase(Locale.ROOT);
+        switch (normalized) {
             case "doris":
                 return TSerdeDialect.DORIS;
             case "presto":
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
index ccee72fe650..85c88ae51de 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
@@ -64,6 +64,7 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.StringJoiner;
 import java.util.concurrent.locks.Lock;
@@ -120,6 +121,27 @@ public class VariableMgr {
     // Variables with this flag can not be seen with `SHOW VARIABLES` 
statement.
     public static final int INVISIBLE = 16;
 
+    /** Case normalization applied when assigning a String variable. */
+    public enum StringCase {
+        NONE,
+        LOWER,
+        UPPER
+    }
+
+    static String normalizeString(StringCase stringCase, String value) {
+        if (value == null) {
+            return null;
+        }
+        switch (stringCase) {
+            case LOWER:
+                return value.toLowerCase(Locale.ROOT);
+            case UPPER:
+                return value.toUpperCase(Locale.ROOT);
+            default:
+                return value;
+        }
+    }
+
     // Map variable name to variable context which have enough information to 
change variable value.
     // This map contains info of all session and global variables.
     private static ImmutableMap<String, VarContext> ctxByVarName;
@@ -224,6 +246,7 @@ public class VariableMgr {
                 ErrorReport.reportDdlException(ErrorCode.ERR_INVALID_VALUE, 
value, attr.name(), e.getMessage());
             }
         }
+        value = normalizeString(attr.stringCase(), value);
         // If the session variable has specified the setter, then not use 
reflect
         if (!attr.setter().equals("")) {
             Preconditions.checkArgument(obj instanceof SessionVariable);
@@ -286,7 +309,8 @@ public class VariableMgr {
                 field.setDouble(obj, Double.parseDouble(value));
                 break;
             case "String":
-                field.set(obj, value);
+                VarAttr attr = field.getAnnotation(VarAttr.class);
+                field.set(obj, attr == null ? value : 
normalizeString(attr.stringCase(), value));
                 break;
             default:
                 // Unsupported type variable.
@@ -977,6 +1001,8 @@ public class VariableMgr {
         // could specify the setter method for a variable, not depend on 
reflect mechanism
         String setter() default "";
 
+        StringCase stringCase() default StringCase.NONE;
+
         // Set to true if the variables need to be forwarded along with 
forward statement.
         boolean needForward() default false;
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableVarCallbacks.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableVarCallbacks.java
index f1dc5e69c3c..5b8d22933b0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableVarCallbacks.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableVarCallbacks.java
@@ -63,7 +63,7 @@ public class VariableVarCallbacks {
                 if (innerParts.length != 2) {
                     continue;
                 }
-                if (innerParts[0].equals("trace_id")) {
+                if (innerParts[0].equalsIgnoreCase("trace_id")) {
                     ConnectContext.get().setTraceId(innerParts[1]);
                     break;
                 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/resource/Tag.java 
b/fe/fe-core/src/main/java/org/apache/doris/resource/Tag.java
index 17b7db694ef..9f549eee32f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/resource/Tag.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/resource/Tag.java
@@ -29,6 +29,7 @@ import com.google.gson.annotations.SerializedName;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 
@@ -125,6 +126,9 @@ public class Tag implements Writable {
         } else if (!value.matches(TAG_VALUE_REGEX)) {
             throw new AnalysisException("Invalid tag value format: " + value);
         }
+        if (TYPE_ROLE.equals(type) && validNodeRoleTag(value)) {
+            value = value.toLowerCase(Locale.ROOT);
+        }
         return new Tag(type, value);
     }
 
@@ -134,7 +138,7 @@ public class Tag implements Writable {
 
     // only support be and cn node role tag for be.
     public static boolean validNodeRoleTag(String value) {
-        return value != null && (value.equals(VALUE_MIX) || 
value.equals(VALUE_COMPUTATION));
+        return value != null && (VALUE_MIX.equalsIgnoreCase(value) || 
VALUE_COMPUTATION.equalsIgnoreCase(value));
     }
 
     public String toKey() {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 8d8f6c003fe..58476dc18b5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -2540,7 +2540,7 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
         } else {
             ctx.getSessionVariable().enableMemtableOnSinkNode = 
Config.stream_load_default_memtable_on_sink_node;
         }
-        ctx.getSessionVariable().groupCommit = request.getGroupCommitMode();
+        ctx.getSessionVariable().setGroupCommit(request.getGroupCommitMode());
         ctx.getSessionVariable().setEnableInsertStrict(false);
         if (request.isSetPartialUpdate() && !request.isPartialUpdate()) {
             ctx.getSessionVariable().setEnableUniqueKeyPartialUpdate(false);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java 
b/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
index adb4a57d448..ffcef7db43e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/Backend.java
@@ -54,6 +54,7 @@ import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -913,10 +914,11 @@ public class Backend implements Writable {
                 this.backendStatus.isShutdown = hbResponse.isShutDown();
             }
 
-            if (!this.getNodeRoleTag().value.equals(hbResponse.getNodeRole()) 
&& Tag.validNodeRoleTag(
-                    hbResponse.getNodeRole())) {
+            String hbNodeRole = hbResponse.getNodeRole() == null
+                    ? null : hbResponse.getNodeRole().toLowerCase(Locale.ROOT);
+            if (!this.getNodeRoleTag().value.equals(hbNodeRole) && 
Tag.validNodeRoleTag(hbNodeRole)) {
                 isChanged = true;
-                this.nodeRoleTag = Tag.createNotCheck(Tag.TYPE_ROLE, 
hbResponse.getNodeRole());
+                this.nodeRoleTag = Tag.createNotCheck(Tag.TYPE_ROLE, 
hbNodeRole);
             }
             if (this.beMemory != hbResponse.getBeMemory()) {
                 isChanged = true;
@@ -1051,20 +1053,23 @@ public class Backend implements Writable {
     }
 
     public boolean isMixNode() {
-        return nodeRoleTag.value.equals(Tag.VALUE_MIX);
+        return nodeRoleTag.value.equalsIgnoreCase(Tag.VALUE_MIX);
     }
 
     public boolean isComputeNode() {
-        return nodeRoleTag.value.equals(Tag.VALUE_COMPUTATION);
+        return nodeRoleTag.value.equalsIgnoreCase(Tag.VALUE_COMPUTATION);
     }
 
     public void setTagMap(Map<String, String> tagMap) {
         Preconditions.checkState(tagMap.containsKey(Tag.TYPE_LOCATION));
-        this.tagMap = tagMap;
-        this.locationTag = Tag.createNotCheck(Tag.TYPE_LOCATION, 
tagMap.get(Tag.TYPE_LOCATION));
-        if (tagMap.containsKey(Tag.TYPE_ROLE) && 
Tag.validNodeRoleTag(tagMap.get(Tag.TYPE_ROLE))) {
-            this.nodeRoleTag = Tag.createNotCheck(Tag.TYPE_ROLE, 
tagMap.get(Tag.TYPE_ROLE));
+        Map<String, String> normalizedMap = Maps.newHashMap(tagMap);
+        if (normalizedMap.containsKey(Tag.TYPE_ROLE) && 
Tag.validNodeRoleTag(normalizedMap.get(Tag.TYPE_ROLE))) {
+            String normalizedRole = 
normalizedMap.get(Tag.TYPE_ROLE).toLowerCase(Locale.ROOT);
+            normalizedMap.put(Tag.TYPE_ROLE, normalizedRole);
+            this.nodeRoleTag = Tag.createNotCheck(Tag.TYPE_ROLE, 
normalizedRole);
         }
+        this.tagMap = normalizedMap;
+        this.locationTag = Tag.createNotCheck(Tag.TYPE_LOCATION, 
normalizedMap.get(Tag.TYPE_LOCATION));
     }
 
     public Map<String, String> getTagMap() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/HeartbeatMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/system/HeartbeatMgr.java
index 7781ee952a3..77d7176324e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/HeartbeatMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/HeartbeatMgr.java
@@ -64,6 +64,7 @@ import org.apache.logging.log4j.Logger;
 import java.net.UnknownHostException;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
@@ -393,7 +394,7 @@ public class HeartbeatMgr extends MasterDaemon {
                     long beStartTime = tBackendInfo.getBeStartTime();
                     String nodeRole = Tag.VALUE_MIX;
                     if (tBackendInfo.isSetBeNodeRole()) {
-                        nodeRole = tBackendInfo.getBeNodeRole();
+                        nodeRole = 
tBackendInfo.getBeNodeRole().toLowerCase(Locale.ROOT);
                     }
 
                     long fragmentNum = 
tBackendInfo.getFragmentExecutingCount();
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/common/PropertyAnalyzerTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/common/PropertyAnalyzerTest.java
index 18f859edf94..47cf0103994 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/common/PropertyAnalyzerTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/common/PropertyAnalyzerTest.java
@@ -33,6 +33,7 @@ import org.apache.doris.common.util.PropertyAnalyzer;
 import org.apache.doris.common.util.TimeUtils;
 import org.apache.doris.qe.SessionVariable;
 import org.apache.doris.resource.Tag;
+import org.apache.doris.thrift.TCompressionType;
 import org.apache.doris.thrift.TInvertedIndexFileStorageFormat;
 import org.apache.doris.thrift.TStorageFormat;
 import org.apache.doris.thrift.TStorageMedium;
@@ -659,4 +660,30 @@ public class PropertyAnalyzerTest {
         
Assertions.assertTrue(org.apache.doris.nereids.types.VariantType.COMPUTE_V2_INSTANCE.isExecutionV2());
         Assertions.assertThrows(AnalysisException.class, () -> 
PropertyAnalyzer.requireVariantV2ForEscape(true));
     }
+
+    @Test
+    public void testCompressionTypeCaseAndDefaultResolution() throws Exception 
{
+        String original = Config.default_compression_type;
+        try {
+            Config.default_compression_type = "default_compression";
+            Assertions.assertEquals(TCompressionType.LZ4F,
+                    PropertyAnalyzer.getDefaultCompressionType());
+            Assertions.assertEquals(TCompressionType.LZ4F,
+                    
PropertyAnalyzer.stringToCompressionType("DEFAULT_COMPRESSION"));
+
+            Config.default_compression_type = "none";
+            Assertions.assertEquals(TCompressionType.NO_COMPRESSION,
+                    PropertyAnalyzer.getDefaultCompressionType());
+            Assertions.assertEquals(TCompressionType.NO_COMPRESSION,
+                    
PropertyAnalyzer.stringToCompressionType("default_compression"));
+
+            Config.default_compression_type = "zstd";
+            Assertions.assertEquals(TCompressionType.ZSTD,
+                    PropertyAnalyzer.getDefaultCompressionType());
+            Assertions.assertEquals(TCompressionType.ZSTD,
+                    
PropertyAnalyzer.stringToCompressionType("DEFAULT_COMPRESSION"));
+        } finally {
+            Config.default_compression_type = original;
+        }
+    }
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/qe/SessionVariableCaseInsensitiveTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/qe/SessionVariableCaseInsensitiveTest.java
new file mode 100644
index 00000000000..d42502b9c70
--- /dev/null
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/qe/SessionVariableCaseInsensitiveTest.java
@@ -0,0 +1,207 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.qe;
+
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.analysis.SetVar;
+import org.apache.doris.analysis.StringLiteral;
+import org.apache.doris.common.Config;
+import org.apache.doris.common.util.PropertyAnalyzer;
+import 
org.apache.doris.nereids.rules.exploration.mv.PreMaterializedViewRewriter.PreRewriteStrategy;
+import 
org.apache.doris.nereids.trees.expressions.functions.scalar.AesCryptoFunction;
+import org.apache.doris.resource.Tag;
+import org.apache.doris.system.Backend;
+import org.apache.doris.thrift.TCompressionType;
+import org.apache.doris.thrift.TSerdeDialect;
+
+import com.google.common.collect.ImmutableMap;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+class SessionVariableCaseInsensitiveTest {
+    private static void set(SessionVariable variables, String name, String 
value) throws Exception {
+        VariableMgr.setVar(variables, new SetVar(SetType.SESSION, name, new 
StringLiteral(value)));
+    }
+
+    @Test
+    void serdeDialectAcceptsAnyLetterCase() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "serde_dialect", "PRESTO");
+        Assertions.assertEquals(TSerdeDialect.PRESTO, 
variables.getSerdeDialect());
+        set(variables, "serde_dialect", "Hive");
+        Assertions.assertEquals(TSerdeDialect.HIVE, 
variables.getSerdeDialect());
+        set(variables, "serde_dialect", "DORIS");
+        Assertions.assertEquals(TSerdeDialect.DORIS, 
variables.getSerdeDialect());
+    }
+
+    @Test
+    void sqlDialectIsStoredInLowerCase() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "sql_dialect", "DORIS");
+        Assertions.assertEquals("doris", variables.getSqlDialect());
+    }
+
+    @Test
+    void blockEncryptionModeIsUsedByCryptoFunctionsInAnyLetterCase() throws 
Exception {
+        ConnectContext context = new ConnectContext();
+        context.setThreadLocalInfo();
+        try {
+            set(context.getSessionVariable(), "block_encryption_mode", 
"aes_256_cbc");
+            Assertions.assertEquals("AES_256_CBC", 
AesCryptoFunction.getDefaultBlockEncryptionMode().getValue());
+        } finally {
+            ConnectContext.remove();
+        }
+    }
+
+    @Test
+    void preMaterializedViewRewriteStrategyAcceptsAnyLetterCase() throws 
Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "pre_materialized_view_rewrite_strategy", "not_in_rbo");
+        Assertions.assertEquals(PreRewriteStrategy.NOT_IN_RBO,
+                
PreRewriteStrategy.getEnum(variables.getPreMaterializedViewRewriteStrategy()));
+    }
+
+    @Test
+    void forceSortAlgorithmIsStoredInLowerCase() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "force_sort_algorithm", "HEAP");
+        Assertions.assertEquals("heap", variables.forceSortAlgorithm);
+    }
+
+    @Test
+    void fileCacheBasePathNormalizesOnlyTheRandomKeyword() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "file_cache_base_path", "RANDOM");
+        Assertions.assertEquals("random", variables.getFileCacheBasePath());
+        set(variables, "file_cache_base_path", "/Data/MixedCaseCache");
+        Assertions.assertEquals("/Data/MixedCaseCache", 
variables.getFileCacheBasePath());
+    }
+
+    @Test
+    void hiveTextCompressionIsNormalized() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "hive_text_compression", "UNCOMPRESSED");
+        Assertions.assertEquals("plain", variables.hiveTextCompression());
+        set(variables, "hive_text_compression", "ZSTD");
+        Assertions.assertEquals("zstd", variables.hiveTextCompression());
+    }
+
+    @Test
+    void sqlConvertorFeaturesAreSentInLowerCase() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "enable_sql_convertor_features", 
"CTAS,DELETE_ALL_COMMENT");
+        Assertions.assertEquals(Arrays.asList("ctas", "delete_all_comment"),
+                Arrays.asList(variables.getSqlConvertorFeatures()));
+    }
+
+    @Test
+    void traceIdKeyIsCaseInsensitiveAndValueKeepsItsCase() throws Exception {
+        ConnectContext context = new ConnectContext();
+        context.setThreadLocalInfo();
+        try {
+            SessionVariable variables = context.getSessionVariable();
+            set(variables, "session_context", "TRACE_ID:AbCdEf");
+            Assertions.assertEquals("AbCdEf", variables.getTraceId());
+            Assertions.assertEquals("AbCdEf", context.traceId());
+        } finally {
+            ConnectContext.remove();
+        }
+    }
+
+    @Test
+    void shapeNodeNamesMatchInAnyLetterCase() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "ignore_shape_nodes", "physicaldistribute, 
PHYSICALPROJECT");
+        
Assertions.assertTrue(variables.getIgnoreShapePlanNodes().contains("PhysicalDistribute"));
+        
Assertions.assertTrue(variables.getIgnoreShapePlanNodes().contains("PhysicalProject"));
+        set(variables, "detail_shape_nodes", "physicalhashjoin, 
PHYSICALFILTER");
+        
Assertions.assertTrue(variables.getDetailShapePlanNodesSet().contains("PhysicalHashJoin"));
+        
Assertions.assertTrue(variables.getDetailShapePlanNodesSet().contains("PhysicalFilter"));
+    }
+
+    @Test
+    void groupCommitIsStoredInLowerCase() throws Exception {
+        SessionVariable variables = new SessionVariable();
+        set(variables, "group_commit", "ASYNC_MODE");
+        Assertions.assertEquals("async_mode", variables.getGroupCommit());
+    }
+
+    @Test
+    void nodeRoleTagIsValidInAnyLetterCase() {
+        Assertions.assertTrue(Tag.validNodeRoleTag("COMPUTATION"));
+        Assertions.assertTrue(Tag.validNodeRoleTag("Mix"));
+        Assertions.assertFalse(Tag.validNodeRoleTag("unknown"));
+        Backend backend = new Backend(1L, "127.0.0.1", 9050);
+        backend.setTagMap(ImmutableMap.of(Tag.TYPE_LOCATION, 
Tag.VALUE_DEFAULT_TAG,
+                Tag.TYPE_ROLE, "COMPUTATION"));
+        Assertions.assertTrue(backend.isComputeNode());
+        Assertions.assertEquals(Tag.VALUE_COMPUTATION, 
backend.getTagMap().get(Tag.TYPE_ROLE));
+    }
+
+    @Test
+    void defaultCompressionResolvesDefaultAndExplicitTypes() throws Exception {
+        String original = Config.default_compression_type;
+        try {
+            Config.default_compression_type = "default_compression";
+            Assertions.assertEquals(TCompressionType.LZ4F, 
PropertyAnalyzer.getDefaultCompressionType());
+            Assertions.assertEquals(TCompressionType.LZ4F,
+                    PropertyAnalyzer.getCompressionTypeFromProperties(
+                            
Collections.singletonMap(PropertyAnalyzer.PROPERTIES_COMPRESSION,
+                                    "DEFAULT_COMPRESSION")));
+            Config.default_compression_type = "NONE";
+            Assertions.assertEquals(TCompressionType.NO_COMPRESSION, 
PropertyAnalyzer.getDefaultCompressionType());
+            Assertions.assertEquals(TCompressionType.NO_COMPRESSION,
+                    PropertyAnalyzer.getCompressionTypeFromProperties(
+                            
Collections.singletonMap(PropertyAnalyzer.PROPERTIES_COMPRESSION,
+                                    "default_compression")));
+            Config.default_compression_type = "zstd";
+            Assertions.assertEquals(TCompressionType.ZSTD, 
PropertyAnalyzer.getDefaultCompressionType());
+            Assertions.assertEquals(TCompressionType.ZSTD,
+                    PropertyAnalyzer.getCompressionTypeFromProperties(
+                            
Collections.singletonMap(PropertyAnalyzer.PROPERTIES_COMPRESSION,
+                                    "default_compression")));
+        } finally {
+            Config.default_compression_type = original;
+        }
+    }
+
+    @Test
+    void readFromJsonAndMapNormalizeStringCaseVariables() throws Exception {
+        SessionVariable fromJson = new SessionVariable();
+        
fromJson.readFromJson("{\"serde_dialect\":\"PRESTO\",\"block_encryption_mode\":\"aes_256_cbc\","
+                + 
"\"force_sort_algorithm\":\"HEAP\",\"group_commit\":\"ASYNC_MODE\"}");
+        Assertions.assertEquals("presto", fromJson.serdeDialect);
+        Assertions.assertEquals("AES_256_CBC", 
fromJson.getBlockEncryptionMode());
+        Assertions.assertEquals("heap", fromJson.forceSortAlgorithm);
+        Assertions.assertEquals("async_mode", fromJson.getGroupCommit());
+
+        SessionVariable fromMap = new SessionVariable();
+        fromMap.readFromMap(ImmutableMap.of(
+                "serde_dialect", "HIVE",
+                "block_encryption_mode", "sm4_128_cbc",
+                "pre_materialized_view_rewrite_strategy", "not_in_rbo",
+                "hive_text_compression", "ZSTD"));
+        Assertions.assertEquals("hive", fromMap.serdeDialect);
+        Assertions.assertEquals("SM4_128_CBC", 
fromMap.getBlockEncryptionMode());
+        Assertions.assertEquals("NOT_IN_RBO", 
fromMap.getPreMaterializedViewRewriteStrategy());
+        Assertions.assertEquals("zstd", fromMap.hiveTextCompression());
+    }
+}
diff --git a/regression-test/data/datatype_p0/serde/test_serde_dialect.out 
b/regression-test/data/datatype_p0/serde/test_serde_dialect.out
index bb404123113..ca6877394cc 100644
--- a/regression-test/data/datatype_p0/serde/test_serde_dialect.out
+++ b/regression-test/data/datatype_p0/serde/test_serde_dialect.out
@@ -5,3 +5,9 @@
 -- !sql01 --
 1      2       3       4       5       1.1     2       123456.123456789        
2024-06-30      2024-06-30T10:10:11     2024-06-30T10:10:11.123456      
59.50.185.152   ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff this is a string with , 
and "   abc ef   123ndedwdw     true    [1,2,3,4,5]     [1, 2, 3, NULL, 5]      
[1.1, 2.1, 3.1, NULL, 5]        [1.10000, 2.10000, 3.00000, NULL, 5.12345]      
[abc, de, f", NULL, ]   [{k1=v1, k2=NULL, k3=, k4=a , "a}, {k1=v1, k2=NULL, k3 
, "abc=, k4=a , "a}]     [[abc, de, f", NULL, ], [], NULL]       \N      \N     
 {k1=v1, k2=NULL, k3=, k4=a , "a}        {k1=[[abc, de, f", NULL [...]
 
+-- !sql_upper_presto --
+1      2       3       4       5       1.1     2       123456.123456789        
2024-06-30      2024-06-30T10:10:11     2024-06-30T10:10:11.123456      
59.50.185.152   ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff this is a string with , 
and "   abc ef   123ndedwdw     true    [1,2,3,4,5]     [1, 2, 3, NULL, 5]      
[1.1, 2.1, 3.1, NULL, 5]        [1.10000, 2.10000, 3.00000, NULL, 5.12345]      
[abc, de, f", NULL, ]   [{k1=v1, k2=NULL, k3=, k4=a , "a}, {k1=v1, k2=NULL, k3 
, "abc=, k4=a , "a}]     [[abc, de, f", NULL, ], [], NULL]       \N      \N     
 {k1=v1, k2=NULL, k3=, k4=a , "a}        {k1=[[abc, de, f", NULL [...]
+
+-- !sql_mixed_doris --
+1      2       3       4       5       1.1     2       123456.123456789        
2024-06-30      2024-06-30T10:10:11     2024-06-30T10:10:11.123456      
59.50.185.152   ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff this is a string with , 
and "   abc ef   123ndedwdw     true    [1,2,3,4,5]     [1, 2, 3, null, 5]      
[1.1, 2.1, 3.1, null, 5]        [1.10000, 2.10000, 3.00000, null, 5.12345]      
["abc", "de, f"", null, ""]     [{"k1":"v1", "k2":null, "k3":"", "k4":"a , 
"a"}, {"k1":"v1", "k2":null, "k3 , "abc":"", "k4":"a , "a"}] [["abc", "de, f"", 
null, ""], [], null] \N      \N      {"k1":"v1", "k2" [...]
+
diff --git 
a/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
 
b/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
index 3b3f06d98d8..f46d0fc2b9d 100644
--- 
a/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
+++ 
b/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
@@ -275,3 +275,18 @@ zhang
 -- !sql57 --
 \N
 
+-- !sql58 --
+3dym0E7/+1zbrLIaBVNHSw==
+
+-- !sql59 --
+text
+
+-- !sql60 --
+FSYstvOmH2cXy7B/072Mug==
+
+-- !sql61 --
+text
+
+-- !sql62 --
+text
+
diff --git a/regression-test/suites/datatype_p0/serde/test_serde_dialect.groovy 
b/regression-test/suites/datatype_p0/serde/test_serde_dialect.groovy
index 2005296af3f..e59110d9b58 100644
--- a/regression-test/suites/datatype_p0/serde/test_serde_dialect.groovy
+++ b/regression-test/suites/datatype_p0/serde/test_serde_dialect.groovy
@@ -108,4 +108,10 @@ suite("test_serde_dialect", "p0") {
         sql """set serde_dialect="invalid""""
         exception "sqlDialect value is invalid"
     }
+
+    // the dialect name is accepted in any letter case and takes effect
+    sql """set serde_dialect="PRESTO";"""
+    order_qt_sql_upper_presto """select * from test_serde_dialect_tbl"""
+    sql """set serde_dialect="Doris";"""
+    order_qt_sql_mixed_doris """select * from test_serde_dialect_tbl"""
 }
diff --git 
a/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
 
b/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
index 69933b6fd87..f5ed1cd5559 100644
--- 
a/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
+++ 
b/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
@@ -229,4 +229,14 @@ suite("test_encryption_function") {
 
     //four arg (column/const) with wrong mode
     qt_sql57 """ select sm4_decrypt(sm4_encrypt(k,"doris","abcdefghij", 
"SM4_128_CBC"),"doris","abcdefghij","SM4_555_CBC") from quantile_table2; """
+
+    // the session variable accepts the mode name in any letter case
+    sql "set block_encryption_mode=\"aes_256_cbc\";"
+    order_qt_sql58 "SELECT 
TO_BASE64(AES_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3'));"
+    order_qt_sql59 "SELECT 
AES_DECRYPT(FROM_BASE64('3dym0E7/+1zbrLIaBVNHSw=='),'F3229A0B371ED2D9441B830D21A390C3');"
+    sql "set block_encryption_mode=\"sm4_128_cbc\";"
+    order_qt_sql60 "SELECT 
TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3'));"
+    order_qt_sql61 "SELECT 
SM4_DECRYPT(FROM_BASE64('FSYstvOmH2cXy7B/072Mug=='),'F3229A0B371ED2D9441B830D21A390C3');"
+    sql "set block_encryption_mode=\"\";"
+    order_qt_sql62 "SELECT AES_DECRYPT(AES_ENCRYPT('text', 'doris', 
'0123456789abcdef', 'aes_256_cfb'), 'doris', '0123456789abcdef', 
'Aes_256_Cfb');"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to