924060929 commented on code in PR #70907:
URL: https://github.com/apache/doris/pull/70907#discussion_r4739334662


##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -4211,7 +4221,29 @@ public String getBlockEncryptionMode() {
     }
 
     public void setBlockEncryptionMode(String blockEncryptionMode) {
-        this.blockEncryptionMode = blockEncryptionMode;
+        this.blockEncryptionMode = blockEncryptionMode == null ? null : 
blockEncryptionMode.toUpperCase(Locale.ROOT);
+    }
+
+    public void setForceSortAlgorithm(String forceSortAlgorithm) {

Review Comment:
   [P2] Note (pre-existing, non-blocking): `SessionVariable.readFromJson()` and 
`readFromMap()` assign `String` fields directly via reflection (`field.set`) 
and bypass `@VarAttr.setter()`. Historical image values or variables forwarded 
from an older follower can still retain unnormalized case and miss exact-match 
consumers (`SortNode.updateSortAlgorithm()`, `PreRewriteStrategy.getEnum()`, 
`hiveTextCompression()`). Centralizing string normalization (similar to 
`normalizeIntValue`/`normalizeLongValue` or via a `@VarAttr` attribute) would 
cover all write paths and avoid per-variable boilerplate setters.



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -4146,7 +4147,8 @@ private static void addOlapTablePropertyInfo(OlapTable 
olapTable, StringBuilder
         }
 

Review Comment:
   [P2] Pre-existing bug (non-blocking): 
`TCompressionType.valueOf(Config.default_compression_type.toUpperCase(Locale.ROOT))`
 diverges from `PropertyAnalyzer.stringToCompressionType()`. If 
`Config.default_compression_type` is `"default_compression"`, table creation 
resolves it to `LZ4F`, while `valueOf` returns `DEFAULT_COMPRESSION` (causing a 
mismatch in `SHOW CREATE TABLE`); if set to `"NONE"` (listed in 
`Config.default_compression_type`), `valueOf` throws 
`IllegalArgumentException`. Reusing a shared resolver in `PropertyAnalyzer` 
would fix this cleanly.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java:
##########
@@ -1608,7 +1608,9 @@ private void tryAddResultSetToSqlCache(ResultSet 
resultSet) {
     private void setFormatOptions() {
         ConnectContext ctx = statementContext.getConnectContext();
         SessionVariable sessionVariable = ctx.getSessionVariable();
-        switch (sessionVariable.serdeDialect) {
+        String serdeDialect = sessionVariable.serdeDialect == null
+                ? "" : 
sessionVariable.serdeDialect.toLowerCase(java.util.Locale.ROOT);
+        switch (serdeDialect) {

Review Comment:
   [P2] `SessionVariable.getSerdeDialect()` already normalizes `serdeDialect` 
and maps it to `TSerdeDialect`. Switching on 
`sessionVariable.getSerdeDialect()` here avoids duplicating the 
string-to-dialect mapping and null/case handling.



##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveWritePlanProvider.java:
##########
@@ -384,7 +384,7 @@ private void setCompressType(THiveTableSink tSink, 
TFileFormatType formatType,
     private static String resolveTextCompressionDefault(ConnectorSession 
session) {
         String textCompression = session.getSessionProperties()
                 .get(HiveConnectorMetadata.SESSION_HIVE_TEXT_COMPRESSION);
-        if 
(HiveConnectorMetadata.TEXT_COMPRESSION_UNCOMPRESSED.equals(textCompression)) {
+        if 
(HiveConnectorMetadata.TEXT_COMPRESSION_UNCOMPRESSED.equalsIgnoreCase(textCompression))
 {

Review Comment:
   [P2] `resolveTextCompressionDefault` is duplicated in 
`HiveConnectorMetadata` and `HiveWritePlanProvider`, and their return values 
now diverge (`HiveConnectorMetadata` lowercases the returned string while this 
method does not). Consider sharing a single package-private helper to keep both 
paths consistent.



##########
fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudComputeGroupMeta.java:
##########
@@ -70,7 +70,7 @@ public class CloudComputeGroupMeta {
 
     static {
         ALL_PROPERTIES_DEFAULT_VALUE_MAP.put(BALANCE_TYPE, 
DEFAULT_COMPUTE_GROUP_BALANCE_ENUM.getValue());

Review Comment:
   [P2] `BalanceTypeEnum.fromString(...)` is already case-insensitive and 
`DEFAULT_COMPUTE_GROUP_BALANCE_ENUM` is parsed with it right above. Comparing 
`DEFAULT_COMPUTE_GROUP_BALANCE_ENUM == BalanceTypeEnum.ASYNC_WARMUP` (and using 
`BalanceTypeEnum.fromString(...)` in `validateTimeoutRestriction` and 
`applyBalanceTypeRule`) is cleaner than repeating 
`getValue().equalsIgnoreCase(...)`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to