You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/06 07:32:25 UTC
[doris] branch branch-1.2-lts updated (0ad9a852dc -> f058a4641b)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a change to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
from 0ad9a852dc [deps](arrow) update arrow download link (#18360) (#18415)
new b4aba703aa [fix](memory) Fix memtable flush mem tracker #18330
new 335b8d1832 [fix](catalog) all properties should be checked when create unpartitioned table (#18149)
new 3fb44bee92 [Fix](orc-reader) Fix the scale of decimal column is incorrect when query orc tables. (#18324)
new 88b2308baf [regression](decimalv3)Add decimal type as filter condition in regression test (#17160)
new e5454d1a93 [test](compaction) add delete test (#18335)
new 066012c3bf [improvement](merge-on-write) remove CHECK if lookup_row_key return unexpected status (#18326)
new aeeb12eb2b [fix](SSL) fix ssl connection buffer overflow (#18359)
new fad86c9e66 [Enhancement](compaction) return error instead of core when ctx not valid (#18363)
new f058a4641b [fix](planner) trying register constnat slotRef to table cause NPE (#18356)
The 9 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/common/daemon.cpp | 3 +-
be/src/olap/memtable.cpp | 2 +-
be/src/olap/tablet.cpp | 9 +-
be/src/olap/task/engine_publish_version_task.cpp | 2 +-
be/src/vec/exec/format/orc/vorc_reader.cpp | 14 ++-
be/src/vec/exec/format/orc/vorc_reader.h | 21 +++--
be/src/vec/olap/vertical_merge_iterator.cpp | 8 ++
.../java/org/apache/doris/analysis/Analyzer.java | 10 +-
.../apache/doris/datasource/InternalCatalog.java | 4 +
.../java/org/apache/doris/mysql/MysqlChannel.java | 10 +-
.../org/apache/doris/catalog/CreateTableTest.java | 5 +
.../org/apache/doris/planner/QueryPlanTest.java | 2 -
.../compaction/test_compacation_with_delete.out | 5 +
...test_decimalv3.out => test_decimalv3_where.out} | 7 +-
.../external_table_emr_p2/hive/test_wide_table.out | 23 +++++
.../agg_on_view.out => join/join_on_view.out} | 0
....groovy => test_compacation_with_delete.groovy} | 48 ++++------
.../suites/decimalv3/test_decimalv3_where.groovy | 10 +-
.../suites/delete_p0/test_delete_sign_mow.sql | 2 +-
.../hive/test_wide_table.groovy | 74 +++++++++++++++
.../suites/mysql_ssl_p0/test_ssl_wild.groovy | 102 +++++++++++++++++++++
.../suites/query_p0/aggregate/agg_on_view.groovy | 12 ++-
.../join/join_on_view.groovy} | 70 +++++++-------
23 files changed, 334 insertions(+), 109 deletions(-)
create mode 100644 regression-test/data/compaction/test_compacation_with_delete.out
copy regression-test/data/decimalv3/{test_decimalv3.out => test_decimalv3_where.out} (63%)
create mode 100644 regression-test/data/external_table_emr_p2/hive/test_wide_table.out
copy regression-test/data/query_p0/{aggregate/agg_on_view.out => join/join_on_view.out} (100%)
copy regression-test/suites/compaction/{test_vertical_compaction_uniq_keys.groovy => test_compacation_with_delete.groovy} (84%)
copy be/src/common/env_config.h.in => regression-test/suites/decimalv3/test_decimalv3_where.groovy (52%)
create mode 100644 regression-test/suites/external_table_emr_p2/hive/test_wide_table.groovy
create mode 100644 regression-test/suites/mysql_ssl_p0/test_ssl_wild.groovy
copy regression-test/suites/{correctness_p0/test_with_false_predicate.groovy => query_p0/join/join_on_view.groovy} (53%)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 02/09: [fix](catalog) all properties should be checked when create unpartitioned table (#18149)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 335b8d1832ee1bb0584f1bb5788f593bfb34d450
Author: xueweizhang <zx...@163.com>
AuthorDate: Tue Apr 4 08:53:45 2023 +0800
[fix](catalog) all properties should be checked when create unpartitioned table (#18149)
all properties should be checked when create unpartitioned table like partitioned table.
Signed-off-by: nextdreamblue <zx...@163.com>
---
.../src/main/java/org/apache/doris/datasource/InternalCatalog.java | 4 ++++
.../src/test/java/org/apache/doris/catalog/CreateTableTest.java | 5 +++++
fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java | 1 -
regression-test/suites/delete_p0/test_delete_sign_mow.sql | 2 +-
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 7bd96078b2..499054815f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -2093,6 +2093,10 @@ public class InternalCatalog implements CatalogIf<Database> {
// create partition
try {
if (partitionInfo.getType() == PartitionType.UNPARTITIONED) {
+ if (storagePolicy.equals("") && properties != null && !properties.isEmpty()) {
+ // here, all properties should be checked
+ throw new DdlException("Unknown properties: " + properties);
+ }
// this is a 1-level partitioned table
// use table name as partition name
DistributionInfo partitionDistributionInfo = distributionDesc.toDistributionInfo(baseSchema);
diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java
index 93c8cd7181..6e38c4dbf1 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java
@@ -243,6 +243,11 @@ public class CreateTableTest {
@Test
public void testAbnormal() throws DdlException, ConfigException {
+ ExceptionChecker.expectThrowsWithMsg(DdlException.class,
+ "Unknown properties: {aa=bb}",
+ () -> createTable("create table test.atbl1\n" + "(k1 int, k2 float)\n" + "duplicate key(k1)\n"
+ + "distributed by hash(k1) buckets 1\n" + "properties('replication_num' = '1','aa'='bb'); "));
+
ExceptionChecker.expectThrowsWithMsg(DdlException.class,
"Floating point type should not be used in distribution column",
() -> createTable("create table test.atbl1\n" + "(k1 int, k2 float)\n" + "duplicate key(k1)\n"
diff --git a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
index f2085315ef..42179fbd5e 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
@@ -2048,7 +2048,6 @@ public class QueryPlanTest extends TestWithFeService {
+ "PROPERTIES (\n"
+ "\"replication_num\" = \"1\",\n"
+ "\"in_memory\" = \"false\",\n"
- + "\"business_key_column_name\" = \"\",\n"
+ "\"storage_medium\" = \"HDD\",\n"
+ "\"storage_format\" = \"V2\"\n"
+ ");\n");
diff --git a/regression-test/suites/delete_p0/test_delete_sign_mow.sql b/regression-test/suites/delete_p0/test_delete_sign_mow.sql
index 7a64c9001d..8f11f82521 100644
--- a/regression-test/suites/delete_p0/test_delete_sign_mow.sql
+++ b/regression-test/suites/delete_p0/test_delete_sign_mow.sql
@@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS delete_sign_test_mow (
UNIQUE KEY(uid)
DISTRIBUTED BY HASH(uid) BUCKETS 3
PROPERTIES (
- "unique_key_merge_on_write" = "true",
+ "enable_unique_key_merge_on_write" = "true",
"replication_num" = "1"
);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 08/09: [Enhancement](compaction) return error instead of core when ctx not valid (#18363)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit fad86c9e661462886828c769a8efc272a1b5573d
Author: yixiutt <10...@users.noreply.github.com>
AuthorDate: Tue Apr 4 12:27:13 2023 +0800
[Enhancement](compaction) return error instead of core when ctx not valid (#18363)
---
be/src/vec/olap/vertical_merge_iterator.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/be/src/vec/olap/vertical_merge_iterator.cpp b/be/src/vec/olap/vertical_merge_iterator.cpp
index cef1b7e8cb..14fb8226f1 100644
--- a/be/src/vec/olap/vertical_merge_iterator.cpp
+++ b/be/src/vec/olap/vertical_merge_iterator.cpp
@@ -517,6 +517,10 @@ Status VerticalMaskMergeIterator::unique_key_next_row(vectorized::IteratorRowRef
auto& ctx = _origin_iter_ctx[order];
RETURN_IF_ERROR(ctx->init(_opts));
DCHECK(ctx->valid());
+ if (!ctx->valid()) {
+ LOG(INFO) << "VerticalMergeIteratorContext not valid";
+ return Status::InternalError("VerticalMergeIteratorContext not valid");
+ }
if (UNLIKELY(ctx->is_first_row()) && !row_source.agg_flag()) {
// first row in block, don't call ctx->advance
@@ -550,6 +554,10 @@ Status VerticalMaskMergeIterator::next_batch(Block* block) {
auto& ctx = _origin_iter_ctx[order];
RETURN_IF_ERROR(ctx->init(_opts));
DCHECK(ctx->valid());
+ if (!ctx->valid()) {
+ LOG(INFO) << "VerticalMergeIteratorContext not valid";
+ return Status::InternalError("VerticalMergeIteratorContext not valid");
+ }
// find max same source count in cur ctx
size_t limit = std::min(ctx->remain_rows(), _block_row_max - rows);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 06/09: [improvement](merge-on-write) remove CHECK if lookup_row_key return unexpected status (#18326)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 066012c3bf3962ded26bf62f9a94f9916237a958
Author: zhannngchen <48...@users.noreply.github.com>
AuthorDate: Tue Apr 4 12:42:07 2023 +0800
[improvement](merge-on-write) remove CHECK if lookup_row_key return unexpected status (#18326)
---
be/src/olap/tablet.cpp | 9 +++++++--
be/src/olap/task/engine_publish_version_task.cpp | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 2a9ec97e18..084ee03f24 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2105,7 +2105,11 @@ Status Tablet::calc_delete_bitmap(RowsetId rowset_id,
if (specified_rowset_ids != nullptr && !specified_rowset_ids->empty()) {
auto st = lookup_row_key(key, specified_rowset_ids, &loc,
dummy_version.first - 1);
- CHECK(st.ok() || st.is<NOT_FOUND>() || st.is<ALREADY_EXIST>());
+ bool expected_st = st.ok() || st.is<NOT_FOUND>() || st.is<ALREADY_EXIST>();
+ DCHECK(expected_st) << "unexpected error status while lookup_row_key:" << st;
+ if (!expected_st) {
+ return st;
+ }
if (st.is<NOT_FOUND>()) {
++row_id;
continue;
@@ -2148,7 +2152,8 @@ Status Tablet::_check_pk_in_pre_segments(
const Slice& key, DeleteBitmapPtr delete_bitmap, RowLocation* loc) {
for (auto it = pre_segments.rbegin(); it != pre_segments.rend(); ++it) {
auto st = (*it)->lookup_row_key(key, loc);
- CHECK(st.ok() || st.is<NOT_FOUND>() || st.is<ALREADY_EXIST>());
+ DCHECK(st.ok() || st.is<NOT_FOUND>() || st.is<ALREADY_EXIST>())
+ << "unexpected error status while lookup_row_key:" << st;
if (st.is<NOT_FOUND>()) {
continue;
} else if (st.ok() && _schema->has_sequence_col() &&
diff --git a/be/src/olap/task/engine_publish_version_task.cpp b/be/src/olap/task/engine_publish_version_task.cpp
index 5d3a65cf3c..8fd438354a 100644
--- a/be/src/olap/task/engine_publish_version_task.cpp
+++ b/be/src/olap/task/engine_publish_version_task.cpp
@@ -148,7 +148,7 @@ Status EnginePublishVersionTask::finish() {
auto submit_st =
StorageEngine::instance()->tablet_publish_txn_thread_pool()->submit_func(
[=]() { tablet_publish_txn_ptr->handle(); });
- CHECK(submit_st.ok());
+ CHECK(submit_st.ok()) << submit_st;
}
}
// wait for all publish txn finished
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 09/09: [fix](planner) trying register constnat slotRef to table cause NPE (#18356)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit f058a4641ba9459e0e539059e03b00997957aa6b
Author: AKIRA <33...@users.noreply.github.com>
AuthorDate: Thu Apr 6 12:50:12 2023 +0900
[fix](planner) trying register constnat slotRef to table cause NPE (#18356)
could reproduced by:
CREATE TABLE t (
name varchar(128)
) ENGINE=OLAP
UNIQUE KEY(name)
DISTRIBUTED BY HASH(name) BUCKETS 1;
insert into t values('abc');
SELECT cd
FROM
(SELECT cast(now() as string) cd FROM t) t1
JOIN
(select cast(now() as string) td from t GROUP BY now()) t2
ON t1.cd = t2.td;
ERROR 1105 (HY000): errCode = 2, detailMessage = Unexpected exception: null
---
.../java/org/apache/doris/analysis/Analyzer.java | 10 ++--
.../org/apache/doris/planner/QueryPlanTest.java | 1 -
.../data/query_p0/join/join_on_view.out | 3 +
.../suites/query_p0/aggregate/agg_on_view.groovy | 12 +++-
.../suites/query_p0/join/join_on_view.groovy | 66 ++++++++++++++++++++++
5 files changed, 84 insertions(+), 8 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index 3a0b762806..c44df2d2bb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -1173,7 +1173,7 @@ public class Analyzer {
registerConstantConjunct(id, conjunct);
}
}
- markConstantConjunct(conjunct, fromHavingClause);
+ markConstantConjunct(conjunct, fromHavingClause, false);
}
}
@@ -1189,7 +1189,7 @@ public class Analyzer {
}
public void registerMigrateFailedConjuncts(InlineViewRef ref, Expr e) throws AnalysisException {
- markConstantConjunct(e, false);
+ markConstantConjunct(e, false, false);
Set<Expr> exprSet = globalState.migrateFailedConjuncts.computeIfAbsent(ref, (k) -> new HashSet<>());
exprSet.add(e);
}
@@ -1802,7 +1802,7 @@ public class Analyzer {
if (rhsRef.getJoinOp().isInnerJoin()) {
globalState.ijClauseByConjunct.put(conjunct.getId(), rhsRef);
}
- markConstantConjunct(conjunct, false);
+ markConstantConjunct(conjunct, false, true);
}
}
@@ -1814,9 +1814,9 @@ public class Analyzer {
* No-op if the conjunct is not constant or is outer joined.
* Throws an AnalysisException if there is an error evaluating `conjunct`
*/
- private void markConstantConjunct(Expr conjunct, boolean fromHavingClause)
+ private void markConstantConjunct(Expr conjunct, boolean fromHavingClause, boolean join)
throws AnalysisException {
- if (!conjunct.isConstant() || isOjConjunct(conjunct)) {
+ if (!conjunct.isConstant() || isOjConjunct(conjunct) || join) {
return;
}
if ((!fromHavingClause && !hasEmptySpjResultSet)
diff --git a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
index 42179fbd5e..8306c6ff14 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
@@ -1538,7 +1538,6 @@ public class QueryPlanTest extends TestWithFeService {
sqls.add("explain select k3, dense_rank() OVER () AS rank FROM baseall where 1 =2;");
sqls.add("explain select rank from (select k3, dense_rank() OVER () AS rank FROM baseall) a where 1 =2;");
sqls.add("explain select * from baseall join bigtable as b where 1 = 2");
- sqls.add("explain select * from baseall join bigtable as b on null = 2");
for (String sql : sqls) {
String explainString = getSQLPlanOrErrorMsg(sql);
diff --git a/regression-test/data/query_p0/join/join_on_view.out b/regression-test/data/query_p0/join/join_on_view.out
new file mode 100644
index 0000000000..9c9c4c6c8a
--- /dev/null
+++ b/regression-test/data/query_p0/join/join_on_view.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !sql --
+
diff --git a/regression-test/suites/query_p0/aggregate/agg_on_view.groovy b/regression-test/suites/query_p0/aggregate/agg_on_view.groovy
index 9f700283e1..ad08521638 100644
--- a/regression-test/suites/query_p0/aggregate/agg_on_view.groovy
+++ b/regression-test/suites/query_p0/aggregate/agg_on_view.groovy
@@ -16,8 +16,12 @@
// under the License.
suite("agg_on_view") {
+
+ sql """
+ drop table if exists agg_on_view_test;
+ """
sql """
- create table test (
+ create table agg_on_view_test (
id int,
user_id int,
name varchar(20)
@@ -34,7 +38,11 @@ suite("agg_on_view") {
from (
select *,
"abc" as tag
- from test limit 10)t
+ from agg_on_view_test limit 10)t
group by user_id,tag
"""
+
+ sql """
+ drop table agg_on_view_test;
+ """
}
\ No newline at end of file
diff --git a/regression-test/suites/query_p0/join/join_on_view.groovy b/regression-test/suites/query_p0/join/join_on_view.groovy
new file mode 100644
index 0000000000..0ac951b9b6
--- /dev/null
+++ b/regression-test/suites/query_p0/join/join_on_view.groovy
@@ -0,0 +1,66 @@
+// 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("join_on_view") {
+ sql """
+ drop table if exists jov_t1;
+ """
+ sql """
+ drop table if exists jov_t2;
+ """
+ sql """
+ CREATE TABLE jov_t1 (
+ id int(11) NOT NULL COMMENT ''
+ ) ENGINE=OLAP
+ UNIQUE KEY(id)
+ COMMENT "OLAP"
+ DISTRIBUTED BY HASH(id) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+ sql """
+ CREATE TABLE jov_t2 (
+ name varchar(128) COMMENT ''
+ ) ENGINE=OLAP
+ UNIQUE KEY(name)
+ COMMENT "OLAP"
+ DISTRIBUTED BY HASH(name) BUCKETS 1
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ qt_sql """
+ SELECT cd
+ FROM
+ (SELECT CURDATE() cd
+ FROM jov_t1) tbl1
+ JOIN
+ (select cast(now() as string) td
+ from jov_t2 b
+ GROUP BY now()) tbl2
+ ON tbl1.cd = tbl2.td;
+ """
+
+ sql """
+ drop table jov_t1;
+ """
+ sql """
+ drop table jov_t2;
+ """
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 07/09: [fix](SSL) fix ssl connection buffer overflow (#18359)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit aeeb12eb2b97fe5c9f9daa7ea1ec3e625cf5bfbc
Author: abmdocrt <Yu...@gmail.com>
AuthorDate: Wed Apr 5 08:42:41 2023 +0800
[fix](SSL) fix ssl connection buffer overflow (#18359)
---
.../java/org/apache/doris/mysql/MysqlChannel.java | 10 +-
.../suites/mysql_ssl_p0/test_ssl_wild.groovy | 102 +++++++++++++++++++++
2 files changed, 106 insertions(+), 6 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
index 9e048a6556..5172b243bc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
@@ -350,7 +350,7 @@ public class MysqlChannel {
}
protected void realNetSend(ByteBuffer buffer) throws IOException {
- encryptData(buffer);
+ buffer = encryptData(buffer);
long bufLen = buffer.remaining();
long writeLen = Channels.writeBlocking(conn.getSinkChannel(), buffer);
if (bufLen != writeLen) {
@@ -361,9 +361,9 @@ public class MysqlChannel {
isSend = true;
}
- protected void encryptData(ByteBuffer dstBuf) throws SSLException {
+ protected ByteBuffer encryptData(ByteBuffer dstBuf) throws SSLException {
if (!isSslMode) {
- return;
+ return dstBuf;
}
encryptNetData.clear();
while (true) {
@@ -373,9 +373,7 @@ public class MysqlChannel {
}
}
encryptNetData.flip();
- dstBuf.clear();
- dstBuf.put(encryptNetData);
- dstBuf.flip();
+ return encryptNetData;
}
public void flush() throws IOException {
diff --git a/regression-test/suites/mysql_ssl_p0/test_ssl_wild.groovy b/regression-test/suites/mysql_ssl_p0/test_ssl_wild.groovy
new file mode 100644
index 0000000000..3e7147698c
--- /dev/null
+++ b/regression-test/suites/mysql_ssl_p0/test_ssl_wild.groovy
@@ -0,0 +1,102 @@
+// 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("test_ssl_wild") {
+ def tbName = "tb_test_ssl_wild"
+ int test_count = 20;
+ sql "DROP TABLE IF EXISTS ${tbName}"
+ // char not null to null
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tbName} (
+ col1 bigint(20) NULL,
+ col2 bigint(20) NULL,
+ col3 text NULL,
+ col4 text NULL,
+ col5 text NULL,
+ col6 text NULL,
+ col7 text NULL,
+ col8 text NULL,
+ col9 text NULL,
+ col10 text NULL,
+ col11 text NULL,
+ col12 text NULL,
+ col13 text NULL,
+ col14 text NULL,
+ col15 text NULL,
+ col16 text NULL,
+ col17 text NULL,
+ col18 text NULL,
+ col19 text NULL,
+ col20 text NULL,
+ col21 text NULL,
+ col22 text NULL,
+ col23 text NULL,
+ col24 int(11) NULL,
+ col25 decimal(22, 2) NULL,
+ col26 decimal(22, 4) NULL,
+ col27 decimal(16, 8) NULL,
+ col28 decimal(16, 8) NULL,
+ col29 decimal(16, 2) NULL,
+ col30 decimal(16, 2) NULL,
+ col31 decimal(16, 2) NULL,
+ col32 decimal(16, 2) NULL,
+ col33 decimal(16, 2) NULL,
+ col34 decimal(16, 2) NULL,
+ col35 decimal(16, 2) NULL,
+ col36 decimal(16, 2) NULL,
+ col37 decimal(16, 2) NULL,
+ col38 decimal(16, 2) NULL,
+ col39 decimal(16, 2) NULL,
+ col40 decimal(16, 2) NULL,
+ col41 decimal(16, 2) NULL,
+ col42 decimal(16, 2) NULL,
+ col43 decimal(16, 2) NULL,
+ col44 decimal(16, 2) NULL,
+ col45 decimal(16, 2) NULL,
+ col46 decimal(16, 2) NULL,
+ col47 int(11) NULL,
+ col48 decimal(16, 2) NULL,
+ col49 decimal(22, 2) NULL,
+ col50 decimal(22, 2) NULL,
+ col51 decimal(22, 2) NULL,
+ col52 decimal(22, 2) NULL,
+ col53 decimal(16, 2) NULL,
+ col54 int(11) NULL,
+ col55 int(11) NULL,
+ col56 text NULL,
+ col57 text NULL,
+ col58 text NULL,
+ col59 text NULL,
+ col60 text NULL,
+ col61 decimal(22, 6) NULL,
+ col62 text NULL,
+ col63 text NULL,
+ col64 text NULL,
+ col65 text NULL,
+ col66 int(11) NULL
+ ) ENGINE=OLAP
+ DISTRIBUTED BY HASH(col1) BUCKETS 10
+ properties("replication_num" = "1");
+ """
+ sql """insert into ${tbName}(col1) values(1) """
+ while (test_count-- > 1) {
+ StringBuilder insertCommand = new StringBuilder();
+ insertCommand.append("INSERT INTO ${tbName} select * from ${tbName}");
+ sql insertCommand.toString()
+ }
+ sql """select * from ${tbName}"""
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 05/09: [test](compaction) add delete test (#18335)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit e5454d1a938d24eeb0670889b2472d0ec9d8ad58
Author: yixiutt <10...@users.noreply.github.com>
AuthorDate: Tue Apr 4 12:28:19 2023 +0800
[test](compaction) add delete test (#18335)
---
.../compaction/test_compacation_with_delete.out | 5 +
.../compaction/test_compacation_with_delete.groovy | 239 +++++++++++++++++++++
2 files changed, 244 insertions(+)
diff --git a/regression-test/data/compaction/test_compacation_with_delete.out b/regression-test/data/compaction/test_compacation_with_delete.out
new file mode 100644
index 0000000000..638d7fbce2
--- /dev/null
+++ b/regression-test/data/compaction/test_compacation_with_delete.out
@@ -0,0 +1,5 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !select_default3 --
+2 2017-10-01 2017-10-01 2017-10-01T11:11:11.110 2017-10-01T11:11:11.110111 Beijing 10 1 2020-01-02T00:00 2020-01-02T00:00 2017-10-01T11:11:11.150 2017-10-01T11:11:11.130111 2020-01-02T00:00 2 31 21
+4 2017-10-01 2017-10-01 2017-10-01T11:11:11.110 2017-10-01T11:11:11.110111 Beijing 10 1 2020-01-03T00:00 2020-01-03T00:00 2017-10-01T11:11:11.100 2017-10-01T11:11:11.140111 2020-01-03T00:00 4 32 22
+
diff --git a/regression-test/suites/compaction/test_compacation_with_delete.groovy b/regression-test/suites/compaction/test_compacation_with_delete.groovy
new file mode 100644
index 0000000000..96943e1c0d
--- /dev/null
+++ b/regression-test/suites/compaction/test_compacation_with_delete.groovy
@@ -0,0 +1,239 @@
+// 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.
+
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+suite("test_compaction_with_delete") {
+ def tableName = "test_compaction_with_delete"
+
+ def set_be_config = { ->
+ String[][] backends = sql """ show backends; """
+ assertTrue(backends.size() > 0)
+ for (String[] backend in backends) {
+ StringBuilder setConfigCommand = new StringBuilder();
+ setConfigCommand.append("curl -X POST http://")
+ setConfigCommand.append(backend[2])
+ setConfigCommand.append(":")
+ setConfigCommand.append(backend[5])
+ setConfigCommand.append("/api/update_config?")
+ String command1 = setConfigCommand.toString() + "enable_vertical_compaction=true"
+ logger.info(command1)
+ def process1 = command1.execute()
+ int code = process1.waitFor()
+ assertEquals(code, 0)
+ }
+ }
+ def reset_be_config = { ->
+ String[][] backends = sql """ show backends; """
+ assertTrue(backends.size() > 0)
+ for (String[] backend in backends) {
+ StringBuilder setConfigCommand = new StringBuilder();
+ setConfigCommand.append("curl -X POST http://")
+ setConfigCommand.append(backend[2])
+ setConfigCommand.append(":")
+ setConfigCommand.append(backend[5])
+ setConfigCommand.append("/api/update_config?")
+ String command1 = setConfigCommand.toString() + "enable_vertical_compaction=false"
+ logger.info(command1)
+ def process1 = command1.execute()
+ int code = process1.waitFor()
+ assertEquals(code, 0)
+ }
+ }
+
+ try {
+ //BackendId,Cluster,IP,HeartbeatPort,BePort,HttpPort,BrpcPort,LastStartTime,LastHeartbeat,Alive,SystemDecommissioned,ClusterDecommissioned,TabletNum,DataUsedCapacity,AvailCapacity,TotalCapacity,UsedPct,MaxDiskUsedPct,Tag,ErrMsg,Version,Status
+ String[][] backends = sql """ show backends; """
+ assertTrue(backends.size() > 0)
+ String backend_id;
+ def backendId_to_backendIP = [:]
+ def backendId_to_backendHttpPort = [:]
+ for (String[] backend in backends) {
+ backendId_to_backendIP.put(backend[0], backend[2])
+ backendId_to_backendHttpPort.put(backend[0], backend[5])
+ }
+
+ backend_id = backendId_to_backendIP.keySet()[0]
+ StringBuilder showConfigCommand = new StringBuilder();
+ showConfigCommand.append("curl -X GET http://")
+ showConfigCommand.append(backendId_to_backendIP.get(backend_id))
+ showConfigCommand.append(":")
+ showConfigCommand.append(backendId_to_backendHttpPort.get(backend_id))
+ showConfigCommand.append("/api/show_config")
+ logger.info(showConfigCommand.toString())
+ def process = showConfigCommand.toString().execute()
+ int code = process.waitFor()
+ String err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
+ String out = process.getText()
+ logger.info("Show config: code=" + code + ", out=" + out + ", err=" + err)
+ assertEquals(code, 0)
+ def configList = parseJson(out.trim())
+ assert configList instanceof List
+
+ boolean disableAutoCompaction = true
+ for (Object ele in (List) configList) {
+ assert ele instanceof List<String>
+ if (((List<String>) ele)[0] == "disable_auto_compaction") {
+ disableAutoCompaction = Boolean.parseBoolean(((List<String>) ele)[2])
+ }
+ }
+ set_be_config.call()
+
+ sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """
+ CREATE TABLE ${tableName} (
+ `user_id` LARGEINT NOT NULL COMMENT "用户id",
+ `date` DATE NOT NULL COMMENT "数据灌入日期时间",
+ `datev2` DATEV2 NOT NULL COMMENT "数据灌入日期时间",
+ `datetimev2_1` DATETIMEV2(3) NOT NULL COMMENT "数据灌入日期时间",
+ `datetimev2_2` DATETIMEV2(6) NOT NULL COMMENT "数据灌入日期时间",
+ `city` VARCHAR(20) COMMENT "用户所在城市",
+ `age` SMALLINT COMMENT "用户年龄",
+ `sex` TINYINT COMMENT "用户性别",
+ `last_visit_date` DATETIME DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次访问时间",
+ `last_update_date` DATETIME DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次更新时间",
+ `datetime_val1` DATETIMEV2(3) DEFAULT "1970-01-01 00:00:00.111" COMMENT "用户最后一次访问时间",
+ `datetime_val2` DATETIME(6) DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次更新时间",
+ `last_visit_date_not_null` DATETIME NOT NULL DEFAULT "1970-01-01 00:00:00" COMMENT "用户最后一次访问时间",
+ `cost` VARCHAR(20) COMMENT "用户总消费",
+ `max_dwell_time` INT DEFAULT "0" COMMENT "用户最大停留时间",
+ `min_dwell_time` INT DEFAULT "99999" COMMENT "用户最小停留时间")
+ DUPLICATE KEY(`user_id`, `date`, `datev2`, `datetimev2_1`, `datetimev2_2`, `city`, `age`, `sex`) DISTRIBUTED BY HASH(`user_id`)
+ BUCKETS 1 PROPERTIES ( "replication_num" = "1" );
+ """
+
+ sql """ INSERT INTO ${tableName} VALUES
+ (1, '2017-10-01', '2017-10-01', '2017-10-01 11:11:11.110000', '2017-10-01 11:11:11.110111', 'Beijing', 10, 1, '2020-01-01', '2020-01-01', '2017-10-01 11:11:11.170000', '2017-10-01 11:11:11.110111', '2020-01-01', '1', 30, 20)
+ """
+
+ sql """
+ DELETE from ${tableName} where cost = '1'
+ """
+
+ sql """ INSERT INTO ${tableName} VALUES
+ (2, '2017-10-01', '2017-10-01', '2017-10-01 11:11:11.110000', '2017-10-01 11:11:11.110111', 'Beijing', 10, 1, '2020-01-02', '2020-01-02', '2017-10-01 11:11:11.150000', '2017-10-01 11:11:11.130111', '2020-01-02', '2', 31, 21)
+ """
+
+ sql """
+ DELETE from ${tableName} where cost = '100'
+ """
+
+ sql """ INSERT INTO ${tableName} VALUES
+ (3, '2017-10-01', '2017-10-01', '2017-10-01 11:11:11.110000', '2017-10-01 11:11:11.110111', 'Beijing', 10, 1, '2020-01-03', '2020-01-03', '2017-10-01 11:11:11.140000', '2017-10-01 11:11:11.120111', '2020-01-03', '3', 32, 20)
+ """
+
+ sql """
+ DELETE from ${tableName} where cost = '3'
+ """
+
+ sql """ INSERT INTO ${tableName} VALUES
+ (4, '2017-10-01', '2017-10-01', '2017-10-01 11:11:11.110000', '2017-10-01 11:11:11.110111', 'Beijing', 10, 1, '2020-01-03', '2020-01-03', '2017-10-01 11:11:11.100000', '2017-10-01 11:11:11.140111', '2020-01-03', '4', 32, 22)
+ """
+
+ sql """
+ DELETE from ${tableName} where cost = '5'
+ """
+ //TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,PathHash,MetaUrl,CompactionStatus
+ String[][] tablets = sql """ show tablets from ${tableName}; """
+
+ // trigger compactions for all tablets in ${tableName}
+ for (String[] tablet in tablets) {
+ String tablet_id = tablet[0]
+ backend_id = tablet[2]
+ StringBuilder sb = new StringBuilder();
+ sb.append("curl -X POST http://")
+ sb.append(backendId_to_backendIP.get(backend_id))
+ sb.append(":")
+ sb.append(backendId_to_backendHttpPort.get(backend_id))
+ sb.append("/api/compaction/run?tablet_id=")
+ sb.append(tablet_id)
+ sb.append("&compact_type=cumulative")
+
+ String command = sb.toString()
+ process = command.execute()
+ code = process.waitFor()
+ err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
+ out = process.getText()
+ logger.info("Run compaction: code=" + code + ", out=" + out + ", err=" + err)
+ assertEquals(code, 0)
+ def compactJson = parseJson(out.trim())
+ if (compactJson.status.toLowerCase() == "fail") {
+ assertEquals(disableAutoCompaction, false)
+ logger.info("Compaction was done automatically!")
+ }
+ if (disableAutoCompaction) {
+ assertEquals("success", compactJson.status.toLowerCase())
+ }
+ }
+
+ // wait for all compactions done
+ for (String[] tablet in tablets) {
+ boolean running = true
+ do {
+ Thread.sleep(1000)
+ String tablet_id = tablet[0]
+ backend_id = tablet[2]
+ StringBuilder sb = new StringBuilder();
+ sb.append("curl -X GET http://")
+ sb.append(backendId_to_backendIP.get(backend_id))
+ sb.append(":")
+ sb.append(backendId_to_backendHttpPort.get(backend_id))
+ sb.append("/api/compaction/run_status?tablet_id=")
+ sb.append(tablet_id)
+
+ String command = sb.toString()
+ logger.info(command)
+ process = command.execute()
+ code = process.waitFor()
+ err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
+ out = process.getText()
+ logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
+ assertEquals(code, 0)
+ def compactionStatus = parseJson(out.trim())
+ assertEquals("success", compactionStatus.status.toLowerCase())
+ running = compactionStatus.run_status
+ } while (running)
+ }
+
+ int rowCount = 0
+ for (String[] tablet in tablets) {
+ String tablet_id = tablet[0]
+ StringBuilder sb = new StringBuilder();
+ def compactionStatusUrlIndex = 17
+ sb.append("curl -X GET ")
+ sb.append(tablet[compactionStatusUrlIndex])
+ String command = sb.toString()
+ // wait for cleaning stale_rowsets
+ process = command.execute()
+ code = process.waitFor()
+ err = IOGroovyMethods.getText(new BufferedReader(new InputStreamReader(process.getErrorStream())));
+ out = process.getText()
+ logger.info("Show tablets status: code=" + code + ", out=" + out + ", err=" + err)
+ assertEquals(code, 0)
+ def tabletJson = parseJson(out.trim())
+ assert tabletJson.rowsets instanceof List
+ for (String rowset in (List<String>) tabletJson.rowsets) {
+ rowCount += Integer.parseInt(rowset.split(" ")[1])
+ }
+ }
+ assert (rowCount <= 8)
+ qt_select_default3 """ SELECT * FROM ${tableName} t ORDER BY user_id,date,city,age,sex,last_visit_date,last_update_date,last_visit_date_not_null,cost,max_dwell_time,min_dwell_time; """
+ } finally {
+ try_sql("DROP TABLE IF EXISTS ${tableName}")
+ reset_be_config.call()
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 01/09: [fix](memory) Fix memtable flush mem tracker #18330
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit b4aba703aa260e95c6dd36937363f069a5cc45e5
Author: Xinyi Zou <zo...@gmail.com>
AuthorDate: Mon Apr 3 20:37:14 2023 +0800
[fix](memory) Fix memtable flush mem tracker #18330
---
be/src/common/daemon.cpp | 3 ++-
be/src/olap/memtable.cpp | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/be/src/common/daemon.cpp b/be/src/common/daemon.cpp
index 322b19b159..176ab1dc64 100644
--- a/be/src/common/daemon.cpp
+++ b/be/src/common/daemon.cpp
@@ -230,8 +230,9 @@ void Daemon::memory_maintenance_thread() {
DorisMetrics::instance()->system_metrics()->update_allocator_metrics();
}
#endif
+ LOG(INFO) << MemTrackerLimiter::
+ process_mem_log_str(); // print mem log when memory state by 100M
if (doris::config::memory_debug) {
- LOG(INFO) << MemTrackerLimiter::process_mem_log_str();
LOG_EVERY_N(INFO, 10)
<< doris::MemTrackerLimiter::log_process_usage_str("memory debug", false);
}
diff --git a/be/src/olap/memtable.cpp b/be/src/olap/memtable.cpp
index 4f1fc2833b..226f063988 100644
--- a/be/src/olap/memtable.cpp
+++ b/be/src/olap/memtable.cpp
@@ -448,7 +448,6 @@ Status MemTable::_generate_delete_bitmap(int64_t atomic_num_segments_before_flus
}
Status MemTable::flush() {
- SCOPED_CONSUME_MEM_TRACKER(_flush_mem_tracker);
VLOG_CRITICAL << "begin to flush memtable for tablet: " << tablet_id()
<< ", memsize: " << memory_usage() << ", rows: " << _rows;
int64_t duration_ns = 0;
@@ -470,6 +469,7 @@ Status MemTable::flush() {
}
Status MemTable::_do_flush(int64_t& duration_ns) {
+ SCOPED_CONSUME_MEM_TRACKER(_flush_mem_tracker);
SCOPED_RAW_TIMER(&duration_ns);
if (_skip_list) {
Status st = _rowset_writer->flush_single_memtable(this, &_flush_size);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 03/09: [Fix](orc-reader) Fix the scale of decimal column is incorrect when query orc tables. (#18324)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 3fb44bee921234d11b1562284a3c23347fc27988
Author: Qi Chen <ka...@gmail.com>
AuthorDate: Tue Apr 4 08:50:47 2023 +0800
[Fix](orc-reader) Fix the scale of decimal column is incorrect when query orc tables. (#18324)
The scale of decimal column is incorrect when query orc tables.
---
be/src/vec/exec/format/orc/vorc_reader.cpp | 14 ++--
be/src/vec/exec/format/orc/vorc_reader.h | 21 ++++--
.../external_table_emr_p2/hive/test_wide_table.out | 23 +++++++
.../hive/test_wide_table.groovy | 74 ++++++++++++++++++++++
4 files changed, 117 insertions(+), 15 deletions(-)
diff --git a/be/src/vec/exec/format/orc/vorc_reader.cpp b/be/src/vec/exec/format/orc/vorc_reader.cpp
index 0840155203..a6b2ef9f7b 100644
--- a/be/src/vec/exec/format/orc/vorc_reader.cpp
+++ b/be/src/vec/exec/format/orc/vorc_reader.cpp
@@ -709,17 +709,13 @@ Status OrcReader::_orc_column_to_doris_column(const std::string& col_name,
FOR_FLAT_ORC_COLUMNS(DISPATCH)
#undef DISPATCH
case TypeIndex::Decimal32:
- return _decode_decimal_column<Int32>(col_name, data_column, data_type,
- _decimal_scale_params, cvb, num_values);
+ return _decode_decimal_column<Int32>(col_name, data_column, data_type, cvb, num_values);
case TypeIndex::Decimal64:
- return _decode_decimal_column<Int64>(col_name, data_column, data_type,
- _decimal_scale_params, cvb, num_values);
+ return _decode_decimal_column<Int64>(col_name, data_column, data_type, cvb, num_values);
case TypeIndex::Decimal128:
- return _decode_decimal_column<Int128>(col_name, data_column, data_type,
- _decimal_scale_params, cvb, num_values);
+ return _decode_decimal_column<Int128>(col_name, data_column, data_type, cvb, num_values);
case TypeIndex::Decimal128I:
- return _decode_decimal_column<Int128>(col_name, data_column, data_type,
- _decimal_scale_params, cvb, num_values);
+ return _decode_decimal_column<Int128>(col_name, data_column, data_type, cvb, num_values);
case TypeIndex::Date:
return _decode_time_column<VecDateTimeValue, Int64, orc::LongVectorBatch>(
col_name, data_column, cvb, num_values);
@@ -769,6 +765,8 @@ Status OrcReader::get_next_block(Block* block, size_t* read_rows, bool* eof) {
SCOPED_RAW_TIMER(&_statistics.column_read_time);
{
SCOPED_RAW_TIMER(&_statistics.get_batch_time);
+ // reset decimal_scale_params_index
+ _decimal_scale_params_index = 0;
if (!_row_reader->next(*_batch)) {
*eof = true;
*read_rows = 0;
diff --git a/be/src/vec/exec/format/orc/vorc_reader.h b/be/src/vec/exec/format/orc/vorc_reader.h
index 53f4a91880..d4a65925b9 100644
--- a/be/src/vec/exec/format/orc/vorc_reader.h
+++ b/be/src/vec/exec/format/orc/vorc_reader.h
@@ -170,13 +170,19 @@ private:
Status _decode_explicit_decimal_column(const std::string& col_name,
const MutableColumnPtr& data_column,
const DataTypePtr& data_type,
- DecimalScaleParams& scale_params,
orc::ColumnVectorBatch* cvb, size_t num_values) {
OrcColumnType* data = dynamic_cast<OrcColumnType*>(cvb);
if (data == nullptr) {
return Status::InternalError("Wrong data type for colum '{}'", col_name);
}
- _init_decimal_converter<DecimalPrimitiveType>(data_type, scale_params, data->scale);
+ if (_decimal_scale_params_index >= _decimal_scale_params.size()) {
+ DecimalScaleParams temp_scale_params;
+ _init_decimal_converter<DecimalPrimitiveType>(data_type, temp_scale_params,
+ data->scale);
+ _decimal_scale_params.emplace_back(std::move(temp_scale_params));
+ }
+ DecimalScaleParams& scale_params = _decimal_scale_params[_decimal_scale_params_index];
+ ++_decimal_scale_params_index;
auto* cvb_data = data->values.data();
auto& column_data =
@@ -206,16 +212,16 @@ private:
template <typename DecimalPrimitiveType>
Status _decode_decimal_column(const std::string& col_name, const MutableColumnPtr& data_column,
- const DataTypePtr& data_type, DecimalScaleParams& scale_params,
- orc::ColumnVectorBatch* cvb, size_t num_values) {
+ const DataTypePtr& data_type, orc::ColumnVectorBatch* cvb,
+ size_t num_values) {
SCOPED_RAW_TIMER(&_statistics.decode_value_time);
if (dynamic_cast<orc::Decimal64VectorBatch*>(cvb) != nullptr) {
return _decode_explicit_decimal_column<DecimalPrimitiveType, orc::Decimal64VectorBatch>(
- col_name, data_column, data_type, scale_params, cvb, num_values);
+ col_name, data_column, data_type, cvb, num_values);
} else {
return _decode_explicit_decimal_column<DecimalPrimitiveType,
orc::Decimal128VectorBatch>(
- col_name, data_column, data_type, scale_params, cvb, num_values);
+ col_name, data_column, data_type, cvb, num_values);
}
}
@@ -293,7 +299,8 @@ private:
orc::RowReaderOptions _row_reader_options;
// only for decimal
- DecimalScaleParams _decimal_scale_params;
+ std::vector<DecimalScaleParams> _decimal_scale_params;
+ size_t _decimal_scale_params_index;
};
} // namespace doris::vectorized
diff --git a/regression-test/data/external_table_emr_p2/hive/test_wide_table.out b/regression-test/data/external_table_emr_p2/hive/test_wide_table.out
new file mode 100644
index 0000000000..143aeb9bf5
--- /dev/null
+++ b/regression-test/data/external_table_emr_p2/hive/test_wide_table.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !01 --
+6117920261 28156890937818.64 11058113 84788841307158.93 9988065.83660 8116313253956313.527443
+
+-- !02 --
+6117920261 28156890937818.64 11058113 84788841307158.93 9988065.83660 8116313253956313.527443
+
+-- !03 --
+
+-- !04 --
+
+-- !05 --
+6117920261 28156890937818.64 11058113 84788841307158.93 9988065.83660 8116313253956313.527443
+
+-- !06 --
+6117920261 28156890937818.64 11058113 84788841307158.93 9988065.83660 8116313253956313.527443
+
+-- !07 --
+6117920261 28156890937818.64 11058113 84788841307158.93 9988065.83660 8116313253956313.527443
+
+-- !08 --
+9999999541515682.000000000 99999218685068.860000000 99999869.000000000 221095586.110000000 27.542540000 61077635638.763621000
+
diff --git a/regression-test/suites/external_table_emr_p2/hive/test_wide_table.groovy b/regression-test/suites/external_table_emr_p2/hive/test_wide_table.groovy
new file mode 100644
index 0000000000..f7ba390c1f
--- /dev/null
+++ b/regression-test/suites/external_table_emr_p2/hive/test_wide_table.groovy
@@ -0,0 +1,74 @@
+// 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("test_wide_table", "p2") {
+
+ def formats = ["_orc"]
+ def decimal_test1 = """select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1;"""
+ def decimal_test2 = """select * from
+ (select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1) as T where col100 = 9988065.8366;
+ """
+ def decimal_test3 = """select * from
+ (select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1) as T where col100 = 9988065.8367;
+ """
+ def decimal_test4 = """select * from
+ (select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1) as T where col100 = 9988065.836;
+ """
+ def decimal_test5 = """select * from
+ (select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1) as T where col100 = 9988065.836600;
+ """
+ def decimal_test6 = """select * from
+ (select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1) as T where col100 > 9988065.83653;
+ """
+ def decimal_test7 = """select * from
+ (select col1, col70, col71, col81, col100, col534 from wide_table1SUFFIX where col1 is not null order by col1 limit 1) as T where col100 < 9988065.83673;
+ """
+ def decimal_test8 = """select max(col1), max(col70), max(col71), min(col81), min(col100), min(col534) from wide_table1SUFFIX;"""
+
+ String enabled = context.config.otherConfigs.get("enableExternalHiveTest")
+ if (enabled != null && enabled.equalsIgnoreCase("true")) {
+ String extHiveHmsHost = context.config.otherConfigs.get("extHiveHmsHost")
+ String extHiveHmsPort = context.config.otherConfigs.get("extHiveHmsPort")
+ String catalog_name = "external_wide_table"
+
+ sql """drop catalog if exists ${catalog_name};"""
+ sql """
+ create catalog if not exists ${catalog_name} properties (
+ 'type'='hms',
+ 'hive.metastore.uris' = 'thrift://${extHiveHmsHost}:${extHiveHmsPort}'
+ );
+ """
+ logger.info("catalog " + catalog_name + " created")
+ sql """switch ${catalog_name};"""
+ logger.info("switched to catalog " + catalog_name)
+ sql """use wide_tables;"""
+ logger.info("use wide_tables")
+
+ for (String format in formats) {
+ logger.info("Process format " + format)
+ qt_01 decimal_test1.replace("SUFFIX", format)
+ qt_02 decimal_test2.replace("SUFFIX", format)
+ qt_03 decimal_test3.replace("SUFFIX", format)
+ qt_04 decimal_test4.replace("SUFFIX", format)
+ qt_05 decimal_test5.replace("SUFFIX", format)
+ qt_06 decimal_test6.replace("SUFFIX", format)
+ qt_07 decimal_test7.replace("SUFFIX", format)
+ qt_08 decimal_test8.replace("SUFFIX", format)
+ }
+ }
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[doris] 04/09: [regression](decimalv3)Add decimal type as filter condition in regression test (#17160)
Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 88b2308baf4e242c34b959045a906a36fddcc355
Author: caoliang-web <71...@users.noreply.github.com>
AuthorDate: Mon Apr 3 14:20:09 2023 +0800
[regression](decimalv3)Add decimal type as filter condition in regression test (#17160)
Add decimal type as filter condition in regression test
---
.../data/decimalv3/test_decimalv3_where.out | 6 +++++
.../suites/decimalv3/test_decimalv3_where.groovy | 26 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/regression-test/data/decimalv3/test_decimalv3_where.out b/regression-test/data/decimalv3/test_decimalv3_where.out
new file mode 100644
index 0000000000..04ffc21d83
--- /dev/null
+++ b/regression-test/data/decimalv3/test_decimalv3_where.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you want to edit this
+-- !decimalv3 --
+3 flink 9 20
+2 spark 10 95
+1 doris 20 324
+
diff --git a/regression-test/suites/decimalv3/test_decimalv3_where.groovy b/regression-test/suites/decimalv3/test_decimalv3_where.groovy
new file mode 100644
index 0000000000..287a77cbd1
--- /dev/null
+++ b/regression-test/suites/decimalv3/test_decimalv3_where.groovy
@@ -0,0 +1,26 @@
+// 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("test_decimalv3_where") {
+
+
+ def tableName = "test_decimalv3_demo"
+ sql """drop table if exists ${tableName}"""
+ sql """CREATE TABLE ${tableName} ( `id` varchar(11) NULL COMMENT '唯一标识', `name` varchar(10) NULL COMMENT '采集时间', `age` int(11) NULL, `dr` decimalv3(10, 0) ) ENGINE=OLAP UNIQUE KEY(`id`) COMMENT 'test' DISTRIBUTED BY HASH(`id`) BUCKETS 10 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2", "light_schema_change" = "true", "disable_auto_compaction" = "false" );"""
+ sql """insert into ${tableName} values (1,'doris',20,324.10),(2,'spark',10,95.5),(3,'flink',9,20)"""
+ qt_decimalv3 "select * from ${tableName} where dr != 1 order by age;"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org