Skip to content

Commit e484cc8

Browse files
authored
fix: hilbert recluster get parser error (#18904)
fix hilbert recluster get parser error
1 parent 09c3a18 commit e484cc8

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed

src/query/service/src/interpreters/interpreter_table_recluster.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ impl ReclusterTableInterpreter {
632632
"range_bound(1000, {sample_size})({cluster_key_str})"
633633
));
634634

635-
hilbert_keys.push(format!("{table}.{cluster_key_str}, []"));
635+
hilbert_keys.push(format!("{cluster_key_str}, []"));
636636
}
637637
let hilbert_keys_str = hilbert_keys.join(", ");
638638

tests/sqllogictests/suites/ee/07_hilbert_clustering/07_0000_recluster_final.test

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ select count() from fuse_snapshot('test_hilbert','t');
4141
----
4242
4
4343

44-
query T
44+
query TTT
4545
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t');
4646
----
4747
(a, b) hilbert {"partial_block_count":0,"partial_segment_count":0,"stable_block_count":0,"stable_segment_count":0,"total_block_count":4,"total_segment_count":4,"unclustered_block_count":4,"unclustered_segment_count":4}
@@ -69,7 +69,7 @@ insert into t values(9, 9);
6969
statement ok
7070
alter table t recluster final;
7171

72-
query T
72+
query TTT
7373
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t');
7474
----
7575
(a, b) hilbert {"partial_block_count":1,"partial_segment_count":1,"stable_block_count":4,"stable_segment_count":2,"total_block_count":5,"total_segment_count":3,"unclustered_block_count":0,"unclustered_segment_count":0}
@@ -89,15 +89,15 @@ select block_count,row_count from fuse_segment('test_hilbert','t');
8989
statement ok
9090
alter table t cluster by hilbert(b, a);
9191

92-
query T
92+
query TTT
9393
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t');
9494
----
9595
(b, a) hilbert {"partial_block_count":0,"partial_segment_count":0,"stable_block_count":0,"stable_segment_count":0,"total_block_count":5,"total_segment_count":3,"unclustered_block_count":5,"unclustered_segment_count":3}
9696

9797
statement ok
9898
alter table t recluster final;
9999

100-
query T
100+
query TTT
101101
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t');
102102
----
103103
(b, a) hilbert {"partial_block_count":0,"partial_segment_count":0,"stable_block_count":5,"stable_segment_count":2,"total_block_count":5,"total_segment_count":2,"unclustered_block_count":0,"unclustered_segment_count":0}
@@ -106,7 +106,7 @@ select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t');
106106
# force eval as linear clustering by specify columns #
107107
########################################################
108108

109-
query T
109+
query TTT
110110
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t', 'a,b');
111111
----
112112
(a, b) linear {"average_depth":1.4,"average_overlaps":0.4,"block_depth_histogram":{"00001":3,"00002":2},"constant_block_count":0,"total_block_count":5}
@@ -122,7 +122,7 @@ statement ok
122122
create or replace table t_linear(a int, b int) cluster by (a, b) row_per_block=2 block_per_segment=2;
123123

124124
# no
125-
query T
125+
query TTT
126126
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t_linear');
127127
----
128128
(a, b) linear {"average_depth":0.0,"average_overlaps":0.0,"block_depth_histogram":{},"constant_block_count":0,"total_block_count":0}
@@ -145,7 +145,7 @@ set enable_parallel_multi_merge_sort = 0;
145145
statement ok
146146
alter table t_linear recluster final;
147147

148-
query T
148+
query TTT
149149
select * EXCLUDE(timestamp) from clustering_information('test_hilbert','t_linear');
150150
----
151151
(a, b) linear {"average_depth":1.0,"average_overlaps":0.0,"block_depth_histogram":{"00001":4},"constant_block_count":0,"total_block_count":4}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## Copyright 2023 Databend Cloud
2+
##
3+
## Licensed under the Elastic License, Version 2.0 (the "License");
4+
## you may not use this file except in compliance with the License.
5+
## You may obtain a copy of the License at
6+
##
7+
## https://www.elastic.co/licensing/elastic-license
8+
##
9+
## Unless required by applicable law or agreed to in writing, software
10+
## distributed under the License is distributed on an "AS IS" BASIS,
11+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
## See the License for the specific language governing permissions and
13+
## limitations under the License.
14+
15+
statement ok
16+
CREATE OR REPLACE DATABASE test_hilbert_2;
17+
18+
statement ok
19+
use test_hilbert_2
20+
21+
statement ok
22+
create or replace table t(a string, b int) cluster by hilbert(substring(a, 1, 5), b) row_per_block=2 block_size_threshold = 18;
23+
24+
statement ok
25+
insert into t values('b', 2), ('c', 4);
26+
27+
statement ok
28+
insert into t values('a', 3),('d', 1);
29+
30+
statement ok
31+
alter table t recluster final;
32+
33+
query TTT
34+
select cluster_key, type, info from clustering_information('test_hilbert_2','t');
35+
----
36+
(SUBSTRING(a FROM 1 FOR 5), b) hilbert {"partial_block_count":2,"partial_segment_count":1,"stable_block_count":0,"stable_segment_count":0,"total_block_count":2,"total_segment_count":1,"unclustered_block_count":0,"unclustered_segment_count":0}
37+
38+
statement ok
39+
drop table t all;
40+
41+
statement ok
42+
drop database test_hilbert_2;

0 commit comments

Comments
 (0)