Skip to content

Commit b235140

Browse files
authored
fix(query): SET_VAR hint write into the shared query_settings (#19663)
1 parent 703023b commit b235140

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/query/sql/src/planner/binder/binder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ impl Binder {
948948
}
949949

950950
self.ctx
951-
.get_settings()
951+
.get_shared_settings()
952952
.set_batch_settings(&hint_settings, true)
953953
}
954954

tests/sqllogictests/suites/http_handler/session/set.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,15 @@ query ??
165165
select value=default, level from system.settings where name='max_threads';
166166
----
167167
1 DEFAULT
168+
169+
## Test SET_VAR hint should behave the same as SETTINGS clause
170+
171+
query TT
172+
select /*+SET_VAR(max_threads=100) */ value, level from system.settings where name='max_threads';
173+
----
174+
100 SESSION
175+
176+
query ??
177+
select value=default, level from system.settings where name='max_threads';
178+
----
179+
1 DEFAULT

tests/suites/0_stateless/05_hints/05_0001_set_var.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ storage_read_buffer_size 1048576
1818
3
1919
2
2020
4
21-
America/Toronto
21+
Asia/Shanghai
2222
America/Toronto
2323
1
2424
2022-02-02 03:00:00.000000
25-
2022-02-02 03:00:00.000000
25+
2022-02-01 14:00:00.000000
2626
1 13
2727
Asia/Shanghai

tests/suites/1_stateful/00_stage/00_0017_copy_into_parquet.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
1
44
2
55
1
6-
1
6+
4
77
4
88
>>>> remove @s1;
99
>>>> select count() from @s1 where a >= 0 and b <= 1000;

tests/suites/1_stateful/00_stage/00_0017_copy_into_parquet.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ run_copy_count "copy /*+ set_var(max_threads=1) */ into @s1/ from (select * from
2828
# one file
2929
run_copy_count "copy /*+ set_var(max_threads=1) */ into @s1/ from (select * from numbers(${HEAVY_ROW_COUNT})) max_file_size=${SMALL_FILE_SIZE} detailed_output=true;"
3030

31-
# one files, limit threads by memory
31+
# four files, limit threads by memory
3232
run_copy_count "copy /*+ set_var(max_threads=4) set_var(max_memory_usage=${MEMORY_LIMIT}) */ into @s1/ from (select * from numbers(${HEAVY_ROW_COUNT})) max_file_size=${SMALL_FILE_SIZE} detailed_output=true;"
3333

3434
# two files, limit threads by memory
35-
# copy /*+ set_var(max_threads=4) set_var(max_memory_usage=256000000) */ not working in cluster mode
36-
run_copy_count "set max_threads=4; set max_memory_usage=${MEMORY_LIMIT_HEAVY}; copy /*+ set_var(max_threads=4) set_var(max_memory_usage=${MEMORY_LIMIT_HEAVY}) */ into @s1/ from (select * from numbers(${HEAVY_ROW_COUNT})) max_file_size=${SMALL_FILE_SIZE} detailed_output=true;"
35+
run_copy_count "copy /*+ set_var(max_threads=4) set_var(max_memory_usage=${MEMORY_LIMIT_HEAVY}) */ into @s1/ from (select * from numbers(${HEAVY_ROW_COUNT})) max_file_size=${SMALL_FILE_SIZE} detailed_output=true;"
3736

3837
stmt "remove @s1;"
3938

0 commit comments

Comments
 (0)