github-actions[bot] commented on code in PR #61918:
URL: https://github.com/apache/doris/pull/61918#discussion_r3013333192
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ForeignKeyContext.java:
##########
@@ -102,10 +105,22 @@ public Void visitLogicalFilter(LogicalFilter<?> filter,
ForeignKeyContext contex
}
void putAllForeignKeys(TableIf table) {
- TableNameInfo tableNameInfo = TableNameInfo.createOrNull(table);
- if (tableNameInfo == null) {
+ if (table == null || table.getName() == null ||
table.getName().isEmpty()) {
return;
}
+ DatabaseIf<?> db = table.getDatabase();
+ if (db == null) {
+ return;
+ }
+ CatalogIf<?> catalog = db.getCatalog();
+ if (catalog == null) {
+ return;
+ }
+ String tableName = table.getName();
+ if (GlobalVariable.isStoredTableNamesLowerCase()) {
+ tableName = tableName.toLowerCase();
Review Comment:
[Minor] Same redundant lowercasing — the `TableNameInfo(ctl, db, tbl)`
constructor already normalizes case. This explicit `toLowerCase()` is
unnecessary (though harmless).
##########
fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java:
##########
@@ -408,8 +410,15 @@ private void processDropColumn(DropColumnOp dropColumnOp,
Table externalTable, L
throws DdlException {
String dropColName = dropColumnOp.getColName();
+ String tableName = externalTable.getName();
+ if (GlobalVariable.isStoredTableNamesLowerCase()) {
+ tableName = tableName.toLowerCase();
Review Comment:
[Minor] Same redundant lowercasing issue — `TableNameInfo` constructor
already handles `toLowerCase()` when `isStoredTableNamesLowerCase()` is true.
The explicit lowercasing before the constructor call can be removed.
##########
fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java:
##########
@@ -756,8 +757,22 @@ private void replaceTableInternal(Database db, OlapTable
origTable, OlapTable ne
String newTblName = newTbl.getName();
// Handle constraints for table replacement
- TableNameInfo origTableInfo = new TableNameInfo(origTable);
- TableNameInfo newTableInfo = new TableNameInfo(newTbl);
+ String origTblName = origTable.getName();
+ if (GlobalVariable.isStoredTableNamesLowerCase()) {
+ origTblName = origTblName.toLowerCase();
Review Comment:
[Minor] Redundant lowercasing: The `TableNameInfo(String ctl, String db,
String tbl)` constructor already calls `tbl.toLowerCase()` when
`isStoredTableNamesLowerCase()` is true (see `TableNameInfo.java:96-97`). This
explicit lowercasing before the constructor call is unnecessary. The same
applies to `newTblNameLower` below.
Suggestion: Just pass `origTable.getName()` directly and let the constructor
handle case normalization:
```java
TableNameInfo origTableInfo = new TableNameInfo(
origTable.getDatabase().getCatalog().getName(),
origTable.getDatabase().getFullName(),
origTable.getName());
```
##########
fe/fe-common/src/main/java/org/apache/doris/qe/VarAttrDef.java:
##########
@@ -0,0 +1,87 @@
+// 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.common.VariableAnnotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Variable attribute definitions for session and global variables.
+ */
+public class VarAttrDef {
+ // variable have this flag means that every session have a copy of this
variable,
+ // and can modify its own variable.
+ public static final int SESSION = 1;
+ // Variables with this flag have only one instance in one process.
+ public static final int GLOBAL = 2;
+ // Variables with this flag only exist in each session.
+ public static final int SESSION_ONLY = 4;
+ // Variables with this flag can only be read.
+ public static final int READ_ONLY = 8;
+ // Variables with this flag can not be seen with `SHOW VARIABLES`
statement.
+ public static final int INVISIBLE = 16;
+
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface VarAttr {
+ // Name in show variables and set statement;
+ String name();
+
+ String[] alias() default {};
+
+ int flag() default 0;
+
+ // TODO(zhaochun): min and max is not used.
+ String minValue() default "0";
+
+ String maxValue() default "0";
+
+ // the function name that check the VarAttr before setting it to
sessionVariable
+ // only support check function: 0 argument and 0 return value, if an
error occurs, throw an exception.
+ // the checker function should be: public void checker(String value),
value is the input string.
+ String checker() default "";
+
+ // could specify the setter method for a variable, not depend on
reflect mechanism
+ String setter() default "";
+
+ // Set to true if the variables need to be forwarded along with
forward statement.
+ boolean needForward() default false;
+
+ // Set to true if this variable is fuzzy
+ boolean fuzzy() default false;
+
+ VariableAnnotation varType() default VariableAnnotation.NONE;
+
+ // description for this config item.
+ // There should be 2 elements in the array.
+ // The first element is the description in Chinese.
+ // The second element is the description in English.
+ String[] description() default {"待补充", "TODO"};
+
+ // Enum options for this config item, if it has.
+ String[] options() default {};
+
+ String convertBoolToLongMethod() default "";
+ // If the variable affects the outcome, set it to true.
+ // If this value is true, it will ignore needForward and enforce
forwarding.
+ boolean affectQueryResultInPlan() default false;
+
+ boolean affectQueryResultInExecution() default false;
Review Comment:
[Nit] Missing trailing newline at end of file.
##########
fe/fe-common/src/main/java/org/apache/doris/qe/GlobalVariable.java:
##########
@@ -92,60 +91,60 @@ public final class GlobalVariable {
public static final String ENABLE_NEW_TYPE_COERCION_BEHAVIOR
= "enable_new_type_coercion_behavior";
- @VariableMgr.VarAttr(name = VARIABLE_VERSION, flag = VariableMgr.INVISIBLE
- | VariableMgr.READ_ONLY | VariableMgr.GLOBAL)
+ @VarAttrDef.VarAttr(name = VARIABLE_VERSION, flag = VarAttrDef.INVISIBLE
+ | VarAttrDef.READ_ONLY | VarAttrDef.GLOBAL)
public static int variableVersion = CURRENT_VARIABLE_VERSION;
- @VariableMgr.VarAttr(name = VERSION_COMMENT, flag = VariableMgr.READ_ONLY)
+ @VarAttrDef.VarAttr(name = VERSION_COMMENT, flag = VarAttrDef.READ_ONLY)
public static String versionComment = Version.DORIS_BUILD_VERSION_PREFIX +
" version "
+ Version.DORIS_BUILD_VERSION + "-" +
Version.DORIS_BUILD_SHORT_HASH
+ (Config.isCloudMode() ? " (Cloud Mode)" : "");
- @VariableMgr.VarAttr(name = VERSION)
+ @VarAttrDef.VarAttr(name = VERSION)
public static String version = DEFAULT_SERVER_VERSION;
// 0: table names are stored as specified and comparisons are case
sensitive.
// 1: table names are stored in lowercase on disk and comparisons are not
case sensitive.
// 2: table names are stored as given but compared in lowercase.
- @VariableMgr.VarAttr(name = LOWER_CASE_TABLE_NAMES, flag =
VariableMgr.READ_ONLY | VariableMgr.GLOBAL)
+ @VarAttrDef.VarAttr(name = LOWER_CASE_TABLE_NAMES, flag =
VarAttrDef.READ_ONLY | VarAttrDef.GLOBAL)
public static int lowerCaseTableNames = 0;
- @VariableMgr.VarAttr(name = LICENSE, flag = VariableMgr.READ_ONLY)
+ @VarAttrDef.VarAttr(name = LICENSE, flag = VarAttrDef.READ_ONLY)
public static String license = "Apache License, Version 2.0";
- @VariableMgr.VarAttr(name = LANGUAGE, flag = VariableMgr.READ_ONLY)
+ @VarAttrDef.VarAttr(name = LANGUAGE, flag = VarAttrDef.READ_ONLY)
public static String language = "/palo/share/english/";
// A string to be executed by the server for each client that connects
- @VariableMgr.VarAttr(name = INIT_CONNECT, flag = VariableMgr.GLOBAL)
+ @VarAttrDef.VarAttr(name = INIT_CONNECT, flag = VarAttrDef.GLOBAL)
public static volatile String initConnect = "";
// A string to be executed by the server for each client that connects
- @VariableMgr.VarAttr(name = SYSTEM_TIME_ZONE, flag = VariableMgr.READ_ONLY)
- public static String systemTimeZone =
TimeUtils.getSystemTimeZone().getID();
+ @VarAttrDef.VarAttr(name = SYSTEM_TIME_ZONE, flag = VarAttrDef.READ_ONLY)
+ public static String systemTimeZone =
java.util.TimeZone.getDefault().getID();
Review Comment:
[Info] Behavioral note: This changes from
`TimeUtils.getSystemTimeZone().getID()` (which normalizes timezone aliases via
`timeZoneAliasMap`, e.g. `CST` -> `Asia/Shanghai`) to raw
`TimeZone.getDefault().getID()` (no alias normalization). Since this is a
read-only display variable the difference is minor, but on systems with aliased
timezone IDs the displayed value may differ from the old behavior.
--
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]