You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/09/16 06:24:08 UTC
[doris] branch branch-1.1-lts updated (633cda85aa -> 065745b1d1)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a change to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
from 633cda85aa [fix](planner) fix orthogonal_bitmap_union_count planner : wrong PREAGGREGATION (#12581)
new 2b69b79fe6 [fix](auditloader plugin): fix bug for AuditLoaderPlugin that stmt appears truncated when stmt contains '\n'. (#12627)
new 25be8f7c5a [Bugfix](string_functions) fix heap-buffer-overflow on find_in_set (#12613)
new 065745b1d1 [Bug](lead) fix wrong child expression of `lead` function (#12587)
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
be/src/exprs/string_functions.cpp | 2 +-
.../org/apache/doris/analysis/AnalyticExpr.java | 5 ++++-
.../java/org/apache/doris/analysis/CastExpr.java | 5 +++--
.../main/java/org/apache/doris/catalog/Type.java | 23 ++++++++++++++++++++++
.../doris/plugin/audit/AuditLoaderPlugin.java | 2 +-
5 files changed, 32 insertions(+), 5 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 02/03: [Bugfix](string_functions) fix heap-buffer-overflow on find_in_set (#12613)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 25be8f7c5a3e36836fd01276b7f443d33f7d0ffc
Author: Zhengguo Yang <ya...@gmail.com>
AuthorDate: Thu Sep 15 08:43:10 2022 +0800
[Bugfix](string_functions) fix heap-buffer-overflow on find_in_set (#12613)
---
be/src/exprs/string_functions.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/be/src/exprs/string_functions.cpp b/be/src/exprs/string_functions.cpp
index 825762ce9d..f2ccb577ae 100644
--- a/be/src/exprs/string_functions.cpp
+++ b/be/src/exprs/string_functions.cpp
@@ -700,7 +700,7 @@ IntVal StringFunctions::find_in_set(FunctionContext* context, const StringVal& s
do {
end = start;
// Position end.
- while (str_set.ptr[end] != ',' && end < str_set.len) {
+ while (end < str_set.len && str_set.ptr[end] != ',') {
++end;
}
StringValue token(reinterpret_cast<char*>(str_set.ptr) + start, end - start);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 03/03: [Bug](lead) fix wrong child expression of `lead` function (#12587)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 065745b1d1ba56b6ab40858b4901fc6f8e8bb6d8
Author: Gabriel <ga...@gmail.com>
AuthorDate: Thu Sep 15 08:44:18 2022 +0800
[Bug](lead) fix wrong child expression of `lead` function (#12587)
---
.../org/apache/doris/analysis/AnalyticExpr.java | 5 ++++-
.../java/org/apache/doris/analysis/CastExpr.java | 5 +++--
.../main/java/org/apache/doris/catalog/Type.java | 23 ++++++++++++++++++++++
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
index a8adc13940..3fd841fff2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
@@ -574,7 +574,10 @@ public class AnalyticExpr extends Expr {
Type type = getFnCall().getChildren().get(2).getType();
try {
- getFnCall().uncheckedCastChild(getFnCall().getChildren().get(0).getType(), 2);
+ if (!Type.matchExactType(getFnCall().getChildren().get(0).getType(),
+ getFnCall().getChildren().get(2).getType())) {
+ getFnCall().uncheckedCastChild(getFnCall().getChildren().get(0).getType(), 2);
+ }
} catch (Exception e) {
LOG.warn("" , e);
throw new AnalysisException("Convert type error in offset fn(default value); old_type="
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
index 261c1cf89a..58062f1d5f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
@@ -239,8 +239,9 @@ public class CastExpr extends Expr {
Type childType = getChild(0).getType();
// this cast may result in loss of precision, but the user requested it
- if (childType.matchesType(type)) {
- noOp = true;
+ noOp = Type.matchExactType(childType, type);
+
+ if (noOp) {
return;
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java
index 01245d3529..9e3d55f2e0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java
@@ -1193,4 +1193,27 @@ public abstract class Type {
return this.getPrimitiveType().getOlapColumnIndexSize();
}
}
+
+ // Whether `type1` matches the exact type of `type2`.
+ public static boolean matchExactType(Type type1, Type type2) {
+ if (type1.matchesType(type2)) {
+ if (PrimitiveType.typeWithPrecision.contains(type2.getPrimitiveType())) {
+ // For types which has precision and scale, we also need to check quality between precisions and scales
+ if ((((ScalarType) type2).decimalPrecision()
+ == ((ScalarType) type1).decimalPrecision()) && (((ScalarType) type2).decimalScale()
+ == ((ScalarType) type1).decimalScale())) {
+ return true;
+ }
+ } else if (type2.isArrayType()) {
+ // For types array, we also need to check contains null for case like
+ // cast(array<not_null(int)> as array<int>)
+ if (((ArrayType) type2).getContainsNull() == ((ArrayType) type1).getContainsNull()) {
+ return true;
+ }
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 01/03: [fix](auditloader plugin): fix bug for AuditLoaderPlugin that stmt appears truncated when stmt contains '\n'. (#12627)
Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.1-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 2b69b79fe64dd03fc8aa4b59cbdab5543f6f6d21
Author: wxy <du...@gmail.com>
AuthorDate: Fri Sep 16 10:28:10 2022 +0800
[fix](auditloader plugin): fix bug for AuditLoaderPlugin that stmt appears truncated when stmt contains '\n'. (#12627)
Co-authored-by: wangxiangyu@360shuke.com <wa...@360shuke.com>
---
.../src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java b/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
index 6d2b7bc14f..ea5c05ee66 100755
--- a/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
+++ b/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
@@ -162,7 +162,7 @@ public class AuditLoaderPlugin extends Plugin implements AuditPlugin {
auditBuffer.append(event.peakMemoryBytes).append("\t");
// trim the query to avoid too long
// use `getBytes().length` to get real byte length
- String stmt = truncateByBytes(event.stmt).replace("\t", " ");
+ String stmt = truncateByBytes(event.stmt).replace("\n", " ").replace("\t", " ");
LOG.debug("receive audit event with stmt: {}", stmt);
auditBuffer.append(stmt).append("\n");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org