Skip to content

InList: merge check branch #2833

@liukun4515

Description

@liukun4515

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions