Skip to content

Commit 25dbf81

Browse files
authored
chore: add a setting for inlist to join (#15024)
1 parent 917df09 commit 25dbf81

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/query/settings/src/settings_default.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ impl DefaultSettings {
290290
mode: SettingMode::Both,
291291
range: Some(SettingRange::Numeric(0..=u64::MAX)),
292292
}),
293+
("inlist_to_join_threshold", DefaultSettingValue{
294+
value: UserSettingValue::UInt64(1024),
295+
desc: "Set the threshold for converting IN list to JOIN.",
296+
mode: SettingMode::Both,
297+
range: Some(SettingRange::Numeric(0..=u64::MAX)),
298+
}),
293299
("enable_bloom_runtime_filter", DefaultSettingValue {
294300
value: UserSettingValue::UInt64(1),
295301
desc: "Enables runtime filter optimization for JOIN.",

src/query/settings/src/settings_getter_setter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ impl Settings {
285285
Ok(self.try_get_u64("join_spilling_partition_bits")? as usize)
286286
}
287287

288+
pub fn get_inlist_to_join_threshold(&self) -> Result<usize> {
289+
Ok(self.try_get_u64("inlist_to_join_threshold")? as usize)
290+
}
291+
288292
pub fn get_bloom_runtime_filter(&self) -> Result<bool> {
289293
Ok(self.try_get_u64("enable_bloom_runtime_filter")? != 0)
290294
}

src/query/sql/src/planner/semantic/type_check.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ impl<'a> TypeChecker<'a> {
380380
not,
381381
..
382382
} => {
383-
if self.ctx.get_cluster().is_empty() && list.len() >= 1024 {
383+
if self.ctx.get_cluster().is_empty()
384+
&& list.len() >= self.ctx.get_settings().get_inlist_to_join_threshold()?
385+
{
384386
if *not {
385387
return self
386388
.resolve_unary_op(*span, &UnaryOperator::Not, &Expr::InList {

0 commit comments

Comments
 (0)