Skip to content

Commit c1c45e2

Browse files
authored
fix: add Decimal64 support for HLL cardinality calculation (#18276)
* fix: handle decimal 64 in `scalar_update_hll_cardinality` * add logic test
1 parent f6d40bc commit c1c45e2

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/query/storages/fuse/src/io/write/stream/column_statistics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ fn scalar_update_hll_cardinality(scalar: &ScalarRef, ty: &DataType, hll: &mut Co
237237
}
238238
DataType::Decimal(_) => {
239239
match scalar {
240+
ScalarRef::Decimal(DecimalScalar::Decimal64(v, _)) => hll.add_object(&v),
240241
ScalarRef::Decimal(DecimalScalar::Decimal128(v, _)) => hll.add_object(&v),
241242
ScalarRef::Decimal(DecimalScalar::Decimal256(v, _)) => hll.add_object(&v),
242243
_ => unreachable!(),
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
statement ok
2+
create or replace database test_insert_unreachable_code;
3+
4+
statement ok
5+
use test_insert_unreachable_code;
6+
7+
8+
statement ok
9+
CREATE OR REPLACE TABLE product_test (
10+
id INT,
11+
name VARCHAR(50),
12+
category VARCHAR(30),
13+
price DECIMAL(8,2),
14+
stock INT
15+
);
16+
17+
statement ok
18+
set enable_block_stream_write = 1;
19+
20+
statement ok
21+
INSERT INTO product_test (id, name, category, price, stock)
22+
VALUES(6, 'Keyboard', 'Electronics', 79.99, 25),
23+
(7, 'Table', 'Furniture', 399.99, 3);
24+
25+
26+
query TTTT
27+
select * from product_test order by id;
28+
----
29+
6 Keyboard Electronics 79.99 25
30+
7 Table Furniture 399.99 3
31+
32+

0 commit comments

Comments
 (0)