File tree Expand file tree Collapse file tree 3 files changed +35
-6
lines changed
tests/sqllogictests/suites/base/06_show Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -610,14 +610,23 @@ impl DefaultSettings {
610
610
Ok ( Self :: instance ( ) ?. settings . contains_key ( key) )
611
611
}
612
612
613
- pub fn convert_value ( k : String , v : String ) -> Result < ( String , Option < UserSettingValue > ) > {
613
+ pub fn convert_value ( k : String , mut v : String ) -> Result < ( String , Option < UserSettingValue > ) > {
614
614
let default_settings = DefaultSettings :: instance ( ) ?;
615
615
616
616
match default_settings. settings . get ( & k) {
617
617
None => Ok ( ( k, None ) ) ,
618
618
Some ( setting_value) => {
619
619
if let Some ( possible_values) = & setting_value. possible_values {
620
- if !possible_values. iter ( ) . any ( |x| x. eq_ignore_ascii_case ( & v) ) {
620
+ let mut checked_value = false ;
621
+
622
+ for possible_value in possible_values {
623
+ if possible_value. eq_ignore_ascii_case ( & v) {
624
+ checked_value = true ;
625
+ v = possible_value. to_string ( ) ;
626
+ }
627
+ }
628
+
629
+ if !checked_value {
621
630
return Err ( ErrorCode :: WrongValueForVariable ( format ! (
622
631
"Invalid setting value: {:?} for variable {:?}, possible values: {:?}" ,
623
632
v, k, possible_values
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ impl Settings {
258
258
}
259
259
260
260
pub fn get_sql_dialect ( & self ) -> Result < Dialect > {
261
- match self . try_get_string ( "sql_dialect" ) ?. as_str ( ) {
261
+ match self . try_get_string ( "sql_dialect" ) ?. to_lowercase ( ) . as_str ( ) {
262
262
"hive" => Ok ( Dialect :: Hive ) ,
263
263
"mysql" => Ok ( Dialect :: MySQL ) ,
264
264
"experimental" => Ok ( Dialect :: Experimental ) ,
@@ -267,7 +267,7 @@ impl Settings {
267
267
}
268
268
269
269
pub fn get_collation ( & self ) -> Result < & str > {
270
- match self . try_get_string ( "collation" ) ?. as_str ( ) {
270
+ match self . try_get_string ( "collation" ) ?. to_lowercase ( ) . as_str ( ) {
271
271
"utf8" => Ok ( "utf8" ) ,
272
272
_ => Ok ( "binary" ) ,
273
273
}
@@ -503,8 +503,12 @@ impl Settings {
503
503
}
504
504
505
505
pub fn get_query_flight_compression ( & self ) -> Result < Option < FlightCompression > > {
506
- match self . try_get_string ( "query_flight_compression" ) ?. as_str ( ) {
507
- "None" => Ok ( None ) ,
506
+ match self
507
+ . try_get_string ( "query_flight_compression" ) ?
508
+ . to_uppercase ( )
509
+ . as_str ( )
510
+ {
511
+ "NONE" => Ok ( None ) ,
508
512
"LZ4" => Ok ( Some ( FlightCompression :: Lz4 ) ) ,
509
513
"ZSTD" => Ok ( Some ( FlightCompression :: Zstd ) ) ,
510
514
_ => unreachable ! ( "check possible_values in set variable" ) ,
Original file line number Diff line number Diff line change @@ -79,3 +79,19 @@ unset max_memory_usage
79
79
80
80
statement ok
81
81
unset max_threads
82
+
83
+ statement ok
84
+ set query_flight_compression = 'Lz4';
85
+
86
+ query TT
87
+ select value from system.settings where name = 'query_flight_compression'
88
+ ----
89
+ LZ4
90
+
91
+ statement ok
92
+ set query_flight_compression = 'lz4';
93
+
94
+ query TT
95
+ select value from system.settings where name = 'query_flight_compression'
96
+ ----
97
+ LZ4
You can’t perform that action at this time.
0 commit comments