Skip to content

Commit 0d6fc7a

Browse files
authored
refine: remove dead branch and fix comment typos in intersect/except preprocess (#6079)
1 parent 47961bc commit 0d6fc7a

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

prqlc/prqlc/src/sql/pq/preprocess.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ pub(in crate::sql) fn except(
357357

358358
// determine DISTINCT
359359
let mut distinct = false;
360-
// EXCEPT ALL can become except EXCEPT DISTINCT, if top is DISTINCT.
360+
// EXCEPT ALL can become EXCEPT DISTINCT, if top is DISTINCT.
361361
// DISTINCT-ness of bottom has no effect on the output.
362362
if res.len() >= 3 {
363363
if let Distinct = &res[res.len() - 3] {
@@ -410,9 +410,6 @@ pub(in crate::sql) fn intersect(
410410
while let Some(t) = pipeline.next() {
411411
res.push(t);
412412

413-
if res.is_empty() {
414-
continue;
415-
}
416413
let Join {
417414
side: JoinSide::Inner,
418415
filter: join_cond,
@@ -444,7 +441,7 @@ pub(in crate::sql) fn intersect(
444441

445442
// determine DISTINCT
446443
let mut distinct = false;
447-
// INTERSECT ALL can become except INTERSECT DISTINCT
444+
// INTERSECT ALL can become INTERSECT DISTINCT
448445
// - if top is DISTINCT or
449446
// - if output is DISTINCT
450447
if res.len() > 1 {
@@ -457,13 +454,13 @@ pub(in crate::sql) fn intersect(
457454
}
458455

459456
if !distinct && !ctx.dialect.intersect_all() {
460-
// INTERCEPT ALL is not supported
457+
// INTERSECT ALL is not supported
461458
// can we fall back to anti-join?
462459
if ctx.anchor.contains_wildcard(&top) || ctx.anchor.contains_wildcard(&bottom) {
463460
return Err(Error::new_simple(format!("The dialect {:?} does not support INTERSECT ALL", ctx.dialect))
464461
.push_hint("providing more column information will allow the query to be translated to an anti-join."));
465462
} else {
466-
// Don't create Intercept, fallback to inner join.
463+
// Don't create Intersect, fallback to inner join.
467464
continue;
468465
}
469466
}

0 commit comments

Comments
 (0)