This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 62ea8dc4801 branch-4.0: [fix](encrypt)encrypt key is not case
sensitive #60288 (#61033)
62ea8dc4801 is described below
commit 62ea8dc4801b338cd8f23191c35dc56bafb23934
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Mar 5 10:00:02 2026 +0800
branch-4.0: [fix](encrypt)encrypt key is not case sensitive #60288 (#61033)
Cherry-picked from #60288
Co-authored-by: minghong <[email protected]>
---
.../org/apache/doris/analysis/EncryptKeyName.java | 13 -----------
.../functions/scalar/EncryptKeyRef.java | 2 +-
.../encryption_digest/key_case_sensitive.out | 7 ++++++
.../encryption_digest/key_case_sensitive.groovy | 25 ++++++++++++++++++++++
4 files changed, 33 insertions(+), 14 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
index 437ef201503..e5e79e79380 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
@@ -40,14 +40,6 @@ public class EncryptKeyName {
@SerializedName(value = "keyName")
private String keyName;
- public EncryptKeyName(String db, String keyName) {
- this.db = db;
- this.keyName = keyName.toLowerCase();
- if (db != null) {
- this.db = db.toLowerCase();
- }
- }
-
/**
* EncryptKeyName
* @param parts like [db1,keyName] or [keyName]
@@ -61,11 +53,6 @@ public class EncryptKeyName {
}
}
- public EncryptKeyName(String keyName) {
- this.db = null;
- this.keyName = keyName.toLowerCase();
- }
-
public void analyze() throws AnalysisException {
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/EncryptKeyRef.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/EncryptKeyRef.java
index a8276ea3ef3..21271eff8c6 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/EncryptKeyRef.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/EncryptKeyRef.java
@@ -65,7 +65,7 @@ public class EncryptKeyRef extends ScalarFunction
public String getEncryptKeyName() {
Preconditions.checkArgument(children.get(1) instanceof
StringLikeLiteral);
- return ((StringLikeLiteral) children.get(1)).value;
+ return ((StringLikeLiteral) children.get(1)).value.toLowerCase();
}
/**
diff --git
a/regression-test/data/query_p0/sql_functions/encryption_digest/key_case_sensitive.out
b/regression-test/data/query_p0/sql_functions/encryption_digest/key_case_sensitive.out
new file mode 100644
index 00000000000..593f4664448
--- /dev/null
+++
b/regression-test/data/query_p0/sql_functions/encryption_digest/key_case_sensitive.out
@@ -0,0 +1,7 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !sql_lower --
+B1438FAE21B290AD4C639782F3C2FAA6
+
+-- !sql_upper --
+B1438FAE21B290AD4C639782F3C2FAA6
+
diff --git
a/regression-test/suites/query_p0/sql_functions/encryption_digest/key_case_sensitive.groovy
b/regression-test/suites/query_p0/sql_functions/encryption_digest/key_case_sensitive.groovy
new file mode 100644
index 00000000000..3da37a66a12
--- /dev/null
+++
b/regression-test/suites/query_p0/sql_functions/encryption_digest/key_case_sensitive.groovy
@@ -0,0 +1,25 @@
+// 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.
+
+suite("key_case_sensitive") {
+ // verify that encrypt key is not case sensitive
+ sql "drop encryptkey if exists AbcD123;"
+
+ sql "create encryptkey AbcD123 as 'aabbccdd1234';"
+ qt_sql_lower "SELECT HEX(AES_ENCRYPT('text', KEY abcd123));"
+ qt_sql_upper "SELECT HEX(AES_ENCRYPT('text', KEY ABCD123));"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]