This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 364e2a096a9 [fix](crc32c) fix bug of crc32c (#60322)
364e2a096a9 is described below
commit 364e2a096a9895c9d66fad0418a578642a0ec839
Author: TengJianPing <[email protected]>
AuthorDate: Thu Jan 29 10:17:41 2026 +0800
[fix](crc32c) fix bug of crc32c (#60322)
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
be/src/vec/columns/column_decimal.cpp | 5 +-
be/src/vec/columns/column_nullable.cpp | 3 +-
be/src/vec/columns/column_vector.cpp | 5 +-
.../data/datatype_p0/complex_types/test_array.out | 23 ++++
.../datatype_p0/complex_types/test_array.groovy | 117 +++++++++++++++++++++
.../nereids_function_p0/gen_function/unnest.groovy | 3 +-
6 files changed, 146 insertions(+), 10 deletions(-)
diff --git a/be/src/vec/columns/column_decimal.cpp
b/be/src/vec/columns/column_decimal.cpp
index 8af5616bf69..94afcc6aa38 100644
--- a/be/src/vec/columns/column_decimal.cpp
+++ b/be/src/vec/columns/column_decimal.cpp
@@ -239,15 +239,14 @@ void ColumnDecimal<T>::update_crc32c_batch(uint32_t*
__restrict hashes,
template <PrimitiveType T>
void ColumnDecimal<T>::update_crc32c_single(size_t start, size_t end,
uint32_t& hash,
const uint8_t* __restrict
null_map) const {
- auto s = size();
if (null_map) {
- for (size_t i = 0; i < s; ++i) {
+ for (size_t i = start; i < end; ++i) {
if (null_map[i] == 0) {
hash = HashUtil::crc32c_fixed(data[i], hash);
}
}
} else {
- for (size_t i = 0; i < s; ++i) {
+ for (size_t i = start; i < end; ++i) {
hash = HashUtil::crc32c_fixed(data[i], hash);
}
}
diff --git a/be/src/vec/columns/column_nullable.cpp
b/be/src/vec/columns/column_nullable.cpp
index 31cd1464d51..06ebeb53c9e 100644
--- a/be/src/vec/columns/column_nullable.cpp
+++ b/be/src/vec/columns/column_nullable.cpp
@@ -140,8 +140,7 @@ void ColumnNullable::update_crc32c_single(size_t start,
size_t end, uint32_t& ha
const auto* __restrict real_null_data =
assert_cast<const
ColumnUInt8&>(get_null_map_column()).get_data().data();
constexpr int NULL_VALUE = 0;
- auto s = size();
- for (int i = 0; i < s; ++i) {
+ for (size_t i = start; i < end; ++i) {
if (real_null_data[i] != 0) {
hash = HashUtil::crc32c_fixed(NULL_VALUE, hash);
}
diff --git a/be/src/vec/columns/column_vector.cpp
b/be/src/vec/columns/column_vector.cpp
index 3eb316093d1..21d7889e825 100644
--- a/be/src/vec/columns/column_vector.cpp
+++ b/be/src/vec/columns/column_vector.cpp
@@ -268,15 +268,14 @@ void ColumnVector<T>::update_crc32c_batch(uint32_t*
__restrict hashes,
template <PrimitiveType T>
void ColumnVector<T>::update_crc32c_single(size_t start, size_t end, uint32_t&
hash,
const uint8_t* __restrict null_map)
const {
- auto s = size();
if (null_map) {
- for (size_t i = 0; i < s; ++i) {
+ for (size_t i = start; i < end; ++i) {
if (null_map[i] == 0) {
hash = _crc32c_hash(hash, i);
}
}
} else {
- for (size_t i = 0; i < s; ++i) {
+ for (size_t i = start; i < end; ++i) {
hash = _crc32c_hash(hash, i);
}
}
diff --git a/regression-test/data/datatype_p0/complex_types/test_array.out
b/regression-test/data/datatype_p0/complex_types/test_array.out
new file mode 100644
index 00000000000..16958938501
--- /dev/null
+++ b/regression-test/data/datatype_p0/complex_types/test_array.out
@@ -0,0 +1,23 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !window_function_partition_by_array_int --
+Badminton Racket [3] 3 3
+Basketball [1, 3] 1 4
+Basketball [1, 3] 3 4
+Laptop [1, 2, 3] 1 6
+Laptop [1, 2, 3] 2 6
+Laptop [1, 2, 3] 3 6
+Mechanical Keyboard [1, 2] 1 3
+Mechanical Keyboard [1, 2] 2 3
+Shirt [4] 4 4
+
+-- !window_function_partition_by_array_decimal --
+Badminton Racket [3.00] 3 3
+Basketball [1.00, 3.00] 1 4
+Basketball [1.00, 3.00] 3 4
+Laptop [1.00, 2.00, 3.00] 1 6
+Laptop [1.00, 2.00, 3.00] 2 6
+Laptop [1.00, 2.00, 3.00] 3 6
+Mechanical Keyboard [1.00, 2.00] 1 3
+Mechanical Keyboard [1.00, 2.00] 2 3
+Shirt [4.00] 4 4
+
diff --git a/regression-test/suites/datatype_p0/complex_types/test_array.groovy
b/regression-test/suites/datatype_p0/complex_types/test_array.groovy
new file mode 100644
index 00000000000..d94d0e06583
--- /dev/null
+++ b/regression-test/suites/datatype_p0/complex_types/test_array.groovy
@@ -0,0 +1,117 @@
+// 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_array") {
+ multi_sql """
+ set batch_size=3;
+ set enable_local_shuffle=false;
+ set parallel_pipeline_task_num = 2;
+ set enable_new_shuffle_hash_method=true;
+ """
+
+ sql "DROP TABLE IF EXISTS `test_array_int_table`"
+ multi_sql """
+ CREATE TABLE test_array_int_table(
+ id INT,
+ name VARCHAR(50),
+ tags ARRAY<VARCHAR(50)>,
+ price DECIMAL(10,2),
+ category_ids ARRAY<INT>,
+ cid INT
+ )
+ DUPLICATE KEY(id)
+ DISTRIBUTED BY HASH(id) BUCKETS 2
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+
+ INSERT INTO test_array_int_table VALUES
+ (1, 'Laptop', ['Electronics', 'Office', 'High-End', 'Laptop'],
5999.99, [1, 2, 3], 1),
+ (2, 'Mechanical Keyboard', ['Electronics', 'Accessories'], 399.99, [1,
2], 1),
+ (3, 'Basketball', ['Sports', 'Outdoor'], 199.99, [1,3], 1),
+ (4, 'Badminton Racket', ['Sports', 'Equipment'], 299.99, [3], 3),
+ (5, 'Shirt', ['Clothing', 'Office', 'Shirt'], 259.00, [4], 4);
+
+ INSERT INTO test_array_int_table VALUES
+ (1, 'Laptop', ['Electronics', 'Office', 'High-End', 'Laptop'],
5999.99, [1, 2, 3], 2),
+ (2, 'Mechanical Keyboard', ['Electronics', 'Accessories'], 399.99,
[1, 2], 2),
+ (3, 'Basketball', ['Sports', 'Outdoor'], 199.99, [1,3], 3);
+
+ INSERT INTO test_array_int_table VALUES
+ (1, 'Laptop', ['Electronics', 'Office', 'High-End', 'Laptop'],
5999.99, [1, 2, 3], 3);
+ """
+
+ qt_window_function_partition_by_array_int """
+ select
+ name,
+ category_ids,
+ cid,
+ sum(cid) over(partition by category_ids)
+ from
+ test_array_int_table
+ group by
+ name, category_ids, cid
+ order by
+ name, category_ids, cid;
+ """
+ // test decimal
+ sql "DROP TABLE IF EXISTS `test_array_decimal_table`"
+ multi_sql """
+ CREATE TABLE test_array_decimal_table(
+ id INT,
+ name VARCHAR(50),
+ tags ARRAY<VARCHAR(50)>,
+ price DECIMAL(10,2),
+ category_ids ARRAY<decimalv3(10,2)>,
+ cid INT
+ )
+ DUPLICATE KEY(id)
+ DISTRIBUTED BY HASH(id) BUCKETS 2
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+
+ INSERT INTO test_array_decimal_table VALUES
+ (1, 'Laptop', ['Electronics', 'Office', 'High-End', 'Laptop'],
5999.99, [1, 2, 3], 1),
+ (2, 'Mechanical Keyboard', ['Electronics', 'Accessories'], 399.99, [1,
2], 1),
+ (3, 'Basketball', ['Sports', 'Outdoor'], 199.99, [1,3], 1),
+ (4, 'Badminton Racket', ['Sports', 'Equipment'], 299.99, [3], 3),
+ (5, 'Shirt', ['Clothing', 'Office', 'Shirt'], 259.00, [4], 4);
+
+ INSERT INTO test_array_decimal_table VALUES
+ (1, 'Laptop', ['Electronics', 'Office', 'High-End', 'Laptop'],
5999.99, [1, 2, 3], 2),
+ (2, 'Mechanical Keyboard', ['Electronics', 'Accessories'], 399.99,
[1, 2], 2),
+ (3, 'Basketball', ['Sports', 'Outdoor'], 199.99, [1,3], 3);
+
+ INSERT INTO test_array_decimal_table VALUES
+ (1, 'Laptop', ['Electronics', 'Office', 'High-End', 'Laptop'],
5999.99, [1, 2, 3], 3);
+ """
+
+ qt_window_function_partition_by_array_decimal """
+ select
+ name,
+ category_ids,
+ cid,
+ sum(cid) over(partition by category_ids)
+ from
+ test_array_decimal_table
+ group by
+ name, category_ids, cid
+ order by
+ name, category_ids, cid;
+ """
+}
diff --git
a/regression-test/suites/nereids_function_p0/gen_function/unnest.groovy
b/regression-test/suites/nereids_function_p0/gen_function/unnest.groovy
index 814776db67c..9e0ffcbc6e7 100644
--- a/regression-test/suites/nereids_function_p0/gen_function/unnest.groovy
+++ b/regression-test/suites/nereids_function_p0/gen_function/unnest.groovy
@@ -340,7 +340,6 @@ suite("nereids_unnest_fn") {
name, tags, unnest(tags);
'''
- /* this case is unnstable, still under investigation, enable it after root
cause fixed
order_qt_sql_sum_window '''
select
name,
@@ -354,7 +353,7 @@ suite("nereids_unnest_fn") {
order by
name, category_ids, unnest(category_ids);
'''
- */
+
order_qt_sql_sum_window2 '''
select
name,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]