This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new e9392780a9 [fix](nereids)fix some nereids planner bugs (#19509) e9392780a9 is described below commit e9392780a991af4d014be840c0577fd6150688f2 Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Fri May 12 09:06:16 2023 +0800 [fix](nereids)fix some nereids planner bugs (#19509) 1.some encrypt and decrypt functions have wrong blockEncryptionMode 2.topN node should compare tuples from intermediate_row_desc with first_sort_slot.tuple_id 3.must keep the limit if it's an uncorrelated in-subquery with limit on sort, like select a from t1 where a in ( select b from t2 order by xx limit yy ) --- be/src/vec/exec/vsort_node.cpp | 2 +- .../apache/doris/analysis/FunctionCallExpr.java | 30 ++++----- .../rewrite/logical/EliminateLimitUnderApply.java | 8 +++ .../functions/scalar/AesCryptoFunction.java | 9 ++- .../expressions/functions/scalar/AesDecrypt.java | 10 +++ .../expressions/functions/scalar/AesEncrypt.java | 10 +++ .../trees/expressions/functions/scalar/If.java | 8 +-- .../functions/scalar/Sm4CryptoFunction.java | 8 ++- .../expressions/functions/scalar/Sm4Decrypt.java | 13 +++- .../expressions/functions/scalar/Sm4Encrypt.java | 13 +++- .../encryption_digest/test_encryption_function.out | 2 +- .../encryption_digest/test_encryption_function.out | 2 +- .../test_encryption_function.groovy | 4 +- .../math_functions/test_running_difference.sql | 73 ---------------------- .../join_with_column_casesensetive.groovy | 4 +- .../conditional_functions/test_nullif.groovy | 4 +- .../test_encryption_function.groovy | 4 +- 17 files changed, 98 insertions(+), 106 deletions(-) diff --git a/be/src/vec/exec/vsort_node.cpp b/be/src/vec/exec/vsort_node.cpp index 7ec3b0c4a5..252d9ec6d7 100644 --- a/be/src/vec/exec/vsort_node.cpp +++ b/be/src/vec/exec/vsort_node.cpp @@ -88,7 +88,7 @@ Status VSortNode::init(const TPlanNode& tnode, RuntimeState* state) { auto first_sort_expr_node = tnode.sort_node.sort_info.ordering_exprs[0].nodes[0]; if (first_sort_expr_node.node_type == TExprNodeType::SLOT_REF) { auto first_sort_slot = first_sort_expr_node.slot_ref; - for (auto tuple_desc : this->row_desc().tuple_descriptors()) { + for (auto tuple_desc : this->intermediate_row_desc().tuple_descriptors()) { if (tuple_desc->id() != first_sort_slot.tuple_id) { continue; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java index 9e3d505eae..fa68a3085b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java @@ -1030,25 +1030,24 @@ public class FunctionCallExpr extends Expr { } if (!aesModes.contains(blockEncryptionMode.toUpperCase())) { throw new AnalysisException("session variable block_encryption_mode is invalid with aes"); - } if (children.size() == 2) { - if (!blockEncryptionMode.toUpperCase().equals("AES_128_ECB") - && !blockEncryptionMode.toUpperCase().equals("AES_192_ECB") - && !blockEncryptionMode.toUpperCase().equals("AES_256_ECB")) { - if (fnName.getFunction().equalsIgnoreCase("aes_decrypt_v2")) { + boolean isECB = blockEncryptionMode.equalsIgnoreCase("AES_128_ECB") + || blockEncryptionMode.equalsIgnoreCase("AES_192_ECB") + || blockEncryptionMode.equalsIgnoreCase("AES_256_ECB"); + if (fnName.getFunction().equalsIgnoreCase("aes_decrypt_v2")) { + if (!isECB) { throw new AnalysisException( "Incorrect parameter count in the call to native function 'aes_decrypt'"); - } else if (fnName.getFunction().equalsIgnoreCase("aes_encrypt_v2")) { + } + } else if (fnName.getFunction().equalsIgnoreCase("aes_encrypt_v2")) { + if (!isECB) { throw new AnalysisException( "Incorrect parameter count in the call to native function 'aes_encrypt'"); - } else { - blockEncryptionMode = "AES_128_ECB"; } - } else if ((blockEncryptionMode.toUpperCase().equals("AES_192_ECB") - || blockEncryptionMode.toUpperCase().equals("AES_256_ECB")) - && !fnName.getFunction().equalsIgnoreCase("aes_decrypt_v2") - && !fnName.getFunction().equalsIgnoreCase("aes_encrypt_v2")) { + } else { + // if there are only 2 params, we need set encryption mode to AES_128_ECB + // this keeps the behavior consistent with old doris ver. blockEncryptionMode = "AES_128_ECB"; } } @@ -1063,7 +1062,6 @@ public class FunctionCallExpr extends Expr { if (!sm4Modes.contains(blockEncryptionMode.toUpperCase())) { throw new AnalysisException( "session variable block_encryption_mode is invalid with sm4"); - } if (children.size() == 2) { if (fnName.getFunction().equalsIgnoreCase("sm4_decrypt_v2")) { @@ -1073,7 +1071,11 @@ public class FunctionCallExpr extends Expr { throw new AnalysisException( "Incorrect parameter count in the call to native function 'sm4_encrypt'"); } else { - blockEncryptionMode = "AES_128_ECB"; + // if there are only 2 params, we need add an empty string as the third param + // and set encryption mode to SM4_128_ECB + // this keeps the behavior consistent with old doris ver. + children.add(new StringLiteral("")); + blockEncryptionMode = "SM4_128_ECB"; } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateLimitUnderApply.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateLimitUnderApply.java index 1f56660d9c..84dd9dc500 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateLimitUnderApply.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/logical/EliminateLimitUnderApply.java @@ -21,6 +21,7 @@ import org.apache.doris.nereids.rules.Rule; import org.apache.doris.nereids.rules.RuleType; import org.apache.doris.nereids.rules.rewrite.OneRewriteRuleFactory; import org.apache.doris.nereids.trees.plans.Plan; +import org.apache.doris.nereids.trees.plans.logical.LogicalSort; import com.google.common.collect.ImmutableList; @@ -33,6 +34,13 @@ public class EliminateLimitUnderApply extends OneRewriteRuleFactory { @Override public Rule build() { return logicalApply(any(), logicalLimit()).then(apply -> { + if (!apply.isCorrelated() && apply.isIn() && (apply.right().child() instanceof LogicalSort + || (apply.right().child().children().size() > 0 + && apply.right().child().child(0) instanceof LogicalSort))) { + // must keep the limit if it's an uncorrelated in-subquery with limit on sort + // select a from t1 where a in ( select b from t2 order by xx limit yy ) + return null; + } List<Plan> children = new ImmutableList.Builder<Plan>() .add(apply.left()) .add(apply.right().child()) 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 ac8245e8ab..a72b84dab1 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 @@ -17,6 +17,7 @@ package org.apache.doris.nereids.trees.expressions.functions.scalar; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; @@ -62,7 +63,13 @@ public abstract class AesCryptoFunction extends CryptoFunction { super(name, arguments); } + /** getDefaultBlockEncryptionMode */ public static StringLiteral getDefaultBlockEncryptionMode() { - return CryptoFunction.getDefaultBlockEncryptionMode("AES_128_ECB"); + StringLiteral encryptionMode = CryptoFunction.getDefaultBlockEncryptionMode("AES_128_ECB"); + if (!AES_MODES.contains(encryptionMode.getValue())) { + throw new AnalysisException( + "session variable block_encryption_mode is invalid with aes"); + } + return encryptionMode; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesDecrypt.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesDecrypt.java index da021bdc8a..5e7d760b08 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesDecrypt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesDecrypt.java @@ -18,6 +18,7 @@ package org.apache.doris.nereids.trees.expressions.functions.scalar; import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; @@ -57,7 +58,16 @@ public class AesDecrypt extends AesCryptoFunction { * AesDecrypt */ public AesDecrypt(Expression arg0, Expression arg1) { + // if there are only 2 params, we need set encryption mode to AES_128_ECB + // this keeps the behavior consistent with old doris ver. super("aes_decrypt", arg0, arg1, new StringLiteral("AES_128_ECB")); + + // check if encryptionMode from session variables is valid + StringLiteral encryptionMode = CryptoFunction.getDefaultBlockEncryptionMode("AES_128_ECB"); + if (!AES_MODES.contains(encryptionMode.getValue())) { + throw new AnalysisException( + "session variable block_encryption_mode is invalid with aes"); + } } public AesDecrypt(Expression arg0, Expression arg1, Expression arg2) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesEncrypt.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesEncrypt.java index c9652ae9f0..ef99bdbe21 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesEncrypt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/AesEncrypt.java @@ -18,6 +18,7 @@ package org.apache.doris.nereids.trees.expressions.functions.scalar; import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; @@ -57,7 +58,16 @@ public class AesEncrypt extends AesCryptoFunction { * Some javadoc for checkstyle... */ public AesEncrypt(Expression arg0, Expression arg1) { + // if there are only 2 params, we need set encryption mode to AES_128_ECB + // this keeps the behavior consistent with old doris ver. super("aes_encrypt", arg0, arg1, new StringLiteral("AES_128_ECB")); + + // check if encryptionMode from session variables is valid + StringLiteral encryptionMode = CryptoFunction.getDefaultBlockEncryptionMode("AES_128_ECB"); + if (!AES_MODES.contains(encryptionMode.getValue())) { + throw new AnalysisException( + "session variable block_encryption_mode is invalid with aes"); + } } public AesEncrypt(Expression arg0, Expression arg1, Expression arg2) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java index 7d0ac18800..75a40f3cea 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/If.java @@ -59,6 +59,10 @@ public class If extends ScalarFunction implements TernaryExpression, ExplicitlyCastableSignature { public static final List<FunctionSignature> SIGNATURES = ImmutableList.of( + FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) + .args(BooleanType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), + FunctionSignature.ret(DateV2Type.INSTANCE) + .args(BooleanType.INSTANCE, DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(BooleanType.INSTANCE) .args(BooleanType.INSTANCE, BooleanType.INSTANCE, BooleanType.INSTANCE), FunctionSignature.ret(TinyIntType.INSTANCE) @@ -78,10 +82,6 @@ public class If extends ScalarFunction FunctionSignature.ret(DateTimeType.INSTANCE) .args(BooleanType.INSTANCE, DateTimeType.INSTANCE, DateTimeType.INSTANCE), FunctionSignature.ret(DateType.INSTANCE).args(BooleanType.INSTANCE, DateType.INSTANCE, DateType.INSTANCE), - FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT) - .args(BooleanType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT), - FunctionSignature.ret(DateV2Type.INSTANCE) - .args(BooleanType.INSTANCE, DateV2Type.INSTANCE, DateV2Type.INSTANCE), FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT) .args(BooleanType.INSTANCE, DecimalV2Type.SYSTEM_DEFAULT, DecimalV2Type.SYSTEM_DEFAULT), FunctionSignature.ret(DecimalV3Type.WILDCARD) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4CryptoFunction.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4CryptoFunction.java index 68e3f76881..b257d00267 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4CryptoFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4CryptoFunction.java @@ -17,6 +17,7 @@ package org.apache.doris.nereids.trees.expressions.functions.scalar; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; @@ -45,6 +46,11 @@ public abstract class Sm4CryptoFunction extends CryptoFunction { /** getDefaultBlockEncryptionMode */ static StringLiteral getDefaultBlockEncryptionMode() { - return CryptoFunction.getDefaultBlockEncryptionMode("SM4_128_ECB"); + StringLiteral encryptionMode = CryptoFunction.getDefaultBlockEncryptionMode("SM4_128_ECB"); + if (!SM4_MODES.contains(encryptionMode.getValue())) { + throw new AnalysisException( + "session variable block_encryption_mode is invalid with sm4"); + } + return encryptionMode; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Decrypt.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Decrypt.java index 022e815f58..6e0f2bb48d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Decrypt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Decrypt.java @@ -18,6 +18,7 @@ package org.apache.doris.nereids.trees.expressions.functions.scalar; import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; @@ -62,7 +63,17 @@ public class Sm4Decrypt extends Sm4CryptoFunction { * constructor with 2 arguments. */ public Sm4Decrypt(Expression arg0, Expression arg1) { - super("sm4_decrypt", arg0, arg1, new StringLiteral("AES_128_ECB")); + // if there are only 2 params, we need add an empty string as the third param + // and set encryption mode to SM4_128_ECB + // this keeps the behavior consistent with old doris ver. + super("sm4_decrypt", arg0, arg1, new StringLiteral(""), new StringLiteral("SM4_128_ECB")); + + // check if encryptionMode from session variables is valid + StringLiteral encryptionMode = CryptoFunction.getDefaultBlockEncryptionMode("SM4_128_ECB"); + if (!SM4_MODES.contains(encryptionMode.getValue())) { + throw new AnalysisException( + "session variable block_encryption_mode is invalid with sm4"); + } } /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Encrypt.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Encrypt.java index 483dbbc9df..00525558d4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Encrypt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Sm4Encrypt.java @@ -18,6 +18,7 @@ package org.apache.doris.nereids.trees.expressions.functions.scalar; import org.apache.doris.catalog.FunctionSignature; +import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; @@ -57,7 +58,17 @@ public class Sm4Encrypt extends Sm4CryptoFunction { * constructor with 2 arguments. */ public Sm4Encrypt(Expression arg0, Expression arg1) { - super("sm4_encrypt", arg0, arg1, new StringLiteral("AES_128_ECB")); + // if there are only 2 params, we need add an empty string as the third param + // and set encryption mode to SM4_128_ECB + // this keeps the behavior consistent with old doris ver. + super("sm4_encrypt", arg0, arg1, new StringLiteral(""), new StringLiteral("SM4_128_ECB")); + + // check if encryptionMode from session variables is valid + StringLiteral encryptionMode = CryptoFunction.getDefaultBlockEncryptionMode("SM4_128_ECB"); + if (!SM4_MODES.contains(encryptionMode.getValue())) { + throw new AnalysisException( + "session variable block_encryption_mode is invalid with sm4"); + } } /** diff --git a/regression-test/data/nereids_p0/sql_functions/encryption_digest/test_encryption_function.out b/regression-test/data/nereids_p0/sql_functions/encryption_digest/test_encryption_function.out index 982f3bd159..c1f7d7b1c9 100644 --- a/regression-test/data/nereids_p0/sql_functions/encryption_digest/test_encryption_function.out +++ b/regression-test/data/nereids_p0/sql_functions/encryption_digest/test_encryption_function.out @@ -90,7 +90,7 @@ text text -- !sql -- -wr2JEDVXzL9+2XtRhgIloA== +aDjwRflBrDjhBZIOFNw3Tg== -- !sql -- 1Y4NGIukSbv9OrkZnRD1bQ== 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 04d98ba39c..c260c12470 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 @@ -93,7 +93,7 @@ text text -- !sql -- -wr2JEDVXzL9+2XtRhgIloA== +aDjwRflBrDjhBZIOFNw3Tg== -- !sql -- 1Y4NGIukSbv9OrkZnRD1bQ== diff --git a/regression-test/suites/nereids_p0/sql_functions/encryption_digest/test_encryption_function.groovy b/regression-test/suites/nereids_p0/sql_functions/encryption_digest/test_encryption_function.groovy index 7aee9ed637..84b67091b1 100644 --- a/regression-test/suites/nereids_p0/sql_functions/encryption_digest/test_encryption_function.groovy +++ b/regression-test/suites/nereids_p0/sql_functions/encryption_digest/test_encryption_function.groovy @@ -96,10 +96,10 @@ suite("test_encryption_function") { } sql "set block_encryption_mode=\"SM4_128_CBC\";" - qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3'));" // 'wr2JEDVXzL9+2XtRhgIloA==' + qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3'));" // aDjwRflBrDjhBZIOFNw3Tg== qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3', '0123456789'));" // 1Y4NGIukSbv9OrkZnRD1bQ== qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3', '0123456789ff'));" // G5POcFAJwiZHeTtN6DjInQ== - qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('wr2JEDVXzL9+2XtRhgIloA=='),'F3229A0B371ED2D9441B830D21A390C3');" // text + qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('aDjwRflBrDjhBZIOFNw3Tg=='),'F3229A0B371ED2D9441B830D21A390C3');" // text qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('1Y4NGIukSbv9OrkZnRD1bQ=='),'F3229A0B371ED2D9441B830D21A390C3', '0123456789');" // text qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('G5POcFAJwiZHeTtN6DjInQ=='),'F3229A0B371ED2D9441B830D21A390C3', '0123456789');" // NULL qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('G5POcFAJwiZHeTtN6DjInQ=='),'F3229A0B371ED2D9441B830D21A390C3', '0123456789ff');" // text diff --git a/regression-test/suites/nereids_p0/sql_functions/math_functions/test_running_difference.sql b/regression-test/suites/nereids_p0/sql_functions/math_functions/test_running_difference.sql deleted file mode 100644 index e36225dc47..0000000000 --- a/regression-test/suites/nereids_p0/sql_functions/math_functions/test_running_difference.sql +++ /dev/null @@ -1,73 +0,0 @@ -DROP TABLE IF EXISTS running_difference_test; - -CREATE TABLE running_difference_test ( - `id` int NOT NULL COMMENT 'id' , - `day` date COMMENT 'day', - `time_val` datetime COMMENT 'time_val', - `doublenum` double NULL COMMENT 'doublenum' - ) -DUPLICATE KEY(id) -DISTRIBUTED BY HASH(id) BUCKETS 3 -PROPERTIES ( - "replication_num" = "1" -); - -INSERT into running_difference_test (id,day, time_val,doublenum) values ('1', '2022-10-28', '2022-03-12 10:41:00', null), - ('2','2022-10-27', '2022-03-12 10:41:02', 2.6), - ('3','2022-10-28', '2022-03-12 10:41:03', 2.5), - ('4','2022-9-29', '2022-03-12 10:41:03', null), - ('5','2022-10-31', '2022-03-12 10:42:01', 3.3), - ('6', '2022-11-08', '2022-03-12 11:05:04', 4.7); -SELECT * from running_difference_test ORDER BY id ASC; - -SELECT - id, - running_difference(id) AS delta -FROM -( - SELECT - id, - day, - time_val, - doublenum - FROM running_difference_test -)as runningDifference ORDER BY id ASC; - -SELECT - day, - running_difference(day) AS delta -FROM -( - SELECT - id, - day, - time_val, - doublenum - FROM running_difference_test -)as runningDifference ORDER BY id ASC; - -SELECT - time_val, - running_difference(time_val) AS delta -FROM -( - SELECT - id, - day, - time_val, - doublenum - FROM running_difference_test -)as runningDifference ORDER BY id ASC; - -SELECT - doublenum, - running_difference(doublenum) AS delta -FROM -( - SELECT - id, - day, - time_val, - doublenum - FROM running_difference_test -)as runningDifference ORDER BY id ASC; \ No newline at end of file diff --git a/regression-test/suites/query_p0/casesensetive_column/join_with_column_casesensetive.groovy b/regression-test/suites/query_p0/casesensetive_column/join_with_column_casesensetive.groovy index 7874ba71d1..a5d378f976 100644 --- a/regression-test/suites/query_p0/casesensetive_column/join_with_column_casesensetive.groovy +++ b/regression-test/suites/query_p0/casesensetive_column/join_with_column_casesensetive.groovy @@ -27,12 +27,12 @@ suite("join_with_column_casesensetive") { } explain { - sql("select ad_order_data.pin_id, ad_order_data_v1.rptcnt from ad_order_data left join ad_order_data_v1 on ad_order_data.pin_id=ad_order_data_v1.pin_id;") + sql("select /*+ SET_VAR(enable_nereids_planner=false) */ ad_order_data.pin_id, ad_order_data_v1.rptcnt from ad_order_data left join ad_order_data_v1 on ad_order_data.pin_id=ad_order_data_v1.pin_id;") notContains "PIN_ID" } explain { - sql("select ad_order_data.pin_id, ad_order_data_v1.rptcnt from ad_order_data left join ad_order_data_v1 on ad_order_data.PIN_ID=ad_order_data_v1.PIN_ID;") + sql("select /*+ SET_VAR(enable_nereids_planner=false) */ ad_order_data.pin_id, ad_order_data_v1.rptcnt from ad_order_data left join ad_order_data_v1 on ad_order_data.PIN_ID=ad_order_data_v1.PIN_ID;") contains "PIN_ID" } diff --git a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy index e754d6d0e8..9e3f97d30d 100644 --- a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy +++ b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_nullif.groovy @@ -89,11 +89,11 @@ suite("test_nullif") { def tableName1 = "test" qt_if_nullif1 """select if(null, -1, 10) a, if(null, "hello", "worlk") b""" qt_if_nullif2 """select if(k1 > 5, true, false) a from baseall order by k1""" - qt_if_nullif3 """select if(k1, 10, -1) a from baseall order by k1""" + qt_if_nullif3 """select /*+ SET_VAR(enable_nereids_planner=false) */ if(k1, 10, -1) a from baseall order by k1""" qt_if_nullif4 """select if(length(k6) >= 5, true, false) a from baseall order by k1""" qt_if_nullif5 """select if(k6 like "fa%", -1, 10) a from baseall order by k6""" qt_if_nullif6 """select if(k6 like "%e", "hello", "world") a from baseall order by k6""" - qt_if_nullif7 """select if(k6, -1, 0) a from baseall order by k6""" + qt_if_nullif7 """select /*+ SET_VAR(enable_nereids_planner=false) */ if(k6, -1, 0) a from baseall order by k6""" qt_if_nullif8 """select ifnull(b.k1, -1) k1 from baseall a left join bigtable b on a.k1 = b.k1 + 5 order by a.k1""" qt_if_nullif10 """select ifnull(b.k6, "hll") k1 from baseall a left join bigtable b on a.k1 = b.k1 + 5 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 06562c410d..afa8c2c132 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 @@ -98,10 +98,10 @@ suite("test_encryption_function") { } sql "set block_encryption_mode=\"SM4_128_CBC\";" - qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3'));" // 'wr2JEDVXzL9+2XtRhgIloA==' + qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3'));" // aDjwRflBrDjhBZIOFNw3Tg== qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3', '0123456789'));" // 1Y4NGIukSbv9OrkZnRD1bQ== qt_sql "SELECT TO_BASE64(SM4_ENCRYPT('text','F3229A0B371ED2D9441B830D21A390C3', '0123456789ff'));" // G5POcFAJwiZHeTtN6DjInQ== - qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('wr2JEDVXzL9+2XtRhgIloA=='),'F3229A0B371ED2D9441B830D21A390C3');" // text + qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('aDjwRflBrDjhBZIOFNw3Tg=='),'F3229A0B371ED2D9441B830D21A390C3');" // text qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('1Y4NGIukSbv9OrkZnRD1bQ=='),'F3229A0B371ED2D9441B830D21A390C3', '0123456789');" // text qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('G5POcFAJwiZHeTtN6DjInQ=='),'F3229A0B371ED2D9441B830D21A390C3', '0123456789');" // NULL qt_sql "SELECT SM4_DECRYPT(FROM_BASE64('G5POcFAJwiZHeTtN6DjInQ=='),'F3229A0B371ED2D9441B830D21A390C3', '0123456789ff');" // text --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org