Skip to content

Commit f5dee23

Browse files
committed
fix a bug in reduce multijoin on singletons
1 parent 6a6dcef commit f5dee23

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/algorithm/reduce.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn reduce_identity_impl(
342342
}
343343

344344
fn reduce_singleton(node: &Node, val: Value, process: impl Fn(Value) -> Value) -> Value {
345-
use {Node::*, Primitive::*};
345+
use {ImplPrimitive::*, Node::*, Primitive::*};
346346
if val.rank() == 0 {
347347
return val;
348348
}
@@ -356,6 +356,9 @@ fn reduce_singleton(node: &Node, val: Value, process: impl Fn(Value) -> Value) -
356356
[init @ .., Prim(Join, _)] if net_0_args(2, init) => {
357357
at_least_rank(1, row.unboxed_if(any_nodes_are_unboxes(init)))
358358
}
359+
[init @ .., ImplPrim(MultiJoin(n), _)] if net_0_args(*n, init) => {
360+
at_least_rank(1, row.unboxed_if(any_nodes_are_unboxes(init)))
361+
}
359362
[init @ .., Format(parts, _)] if net_0_args(parts.len().saturating_sub(1), init) => {
360363
row.format().into()
361364
}

tests/loops.ua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ A ← ↯2_3_4⇡24
8080
⍤⤙≍ [1] /(+1⊂) [1]
8181
⍤⤙≍ [] /(+1⊂) []
8282

83+
⍤⤙≍ ⤙/⊂₃@ "A"
84+
⍤⤙≍ ⤙/◇⊂₃@ "A"
85+
8386
⍤⤙≍ "1 2" /$"_ _" [1 2]
8487
⍤⤙≍ "1" /$"_ _" [1]
8588
⍤⤙≍ "" /$"_ _" []

0 commit comments

Comments
 (0)