Skip to content

Commit 7224901

Browse files
authored
Optimization of the function "intersect" (#5388)
1 parent d64076b commit 7224901

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎datafusion/optimizer/src/eliminate_cross_join.rs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,12 @@ fn intersect(
247247
vec1: &[(Expr, Expr)],
248248
vec2: &[(Expr, Expr)],
249249
) {
250-
for x1 in vec1.iter() {
251-
for x2 in vec2.iter() {
252-
if x1.0 == x2.0 && x1.1 == x2.1 || x1.1 == x2.0 && x1.0 == x2.1 {
253-
accum.push((x1.0.clone(), x1.1.clone()));
250+
if !(vec1.is_empty() || vec2.is_empty()) {
251+
for x1 in vec1.iter() {
252+
for x2 in vec2.iter() {
253+
if x1.0 == x2.0 && x1.1 == x2.1 || x1.1 == x2.0 && x1.0 == x2.1 {
254+
accum.push((x1.0.clone(), x1.1.clone()));
255+
}
254256
}
255257
}
256258
}

0 commit comments

Comments
 (0)