Skip to content

Commit

Permalink
fix the bug
Browse files Browse the repository at this point in the history
Signed-off-by: Runji Wang <[email protected]>
  • Loading branch information
wangrunji0408 committed Dec 9, 2023
1 parent a562777 commit 9c64760
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/expr/impl/src/scalar/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ impl Expression for CaseExpression {
let when_len = self.when_clauses.len();
let mut result_array = Vec::with_capacity(when_len + 1);
for (when_idx, WhenClause { when, then }) in self.when_clauses.iter().enumerate() {
let calc_then_vis = when.eval(&input).await?.as_bool().to_bitmap();
let input_vis = input.visibility().clone();
// note that evaluated result from when clause may contain bits that are not visible,
// so we need to mask it with input visibility.
let calc_then_vis = when.eval(&input).await?.as_bool().to_bitmap() & &input_vis;
input.set_visibility(calc_then_vis.clone());
let then_res = then.eval(&input).await?;
calc_then_vis
Expand Down

0 comments on commit 9c64760

Please sign in to comment.