Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InList: merge check branch #2833

Closed
liukun4515 opened this issue Jul 4, 2022 · 0 comments · Fixed by #4057
Closed

InList: merge check branch #2833

liukun4515 opened this issue Jul 4, 2022 · 0 comments · Fixed by #4057
Assignees

Comments

@liukun4515
Copy link
Contributor

Two $NEGATED cases look very similar, is it possible to combine them to save code?

e.g.

if $CONTAINS_NULL {
  $ARRAY
    .iter()
    .map(|vop| match vop.map(|v| {
      if $NEGATED { !$VALUES.contains(&v) } else { $VALUES.contains(&v) }
    }) {
      Some(true) if $NEGATED => None,
      Some(false) if !$NEGATED => None,
      x => x,
    })
  .collect::<BooleanArray>()
} else {
  $ARRAY
    .iter()
    .map(|vop| vop.map(|v| {
      if $NEGATED { !$VALUES.contains(&v) } else { $VALUES.contains(&v) }
    })
    .collect::<BooleanArray>()
}

Originally posted by @viirya in #2809 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant