datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

InList: merge check branch

Open liukun4515 opened this issue 3 years ago • 0 comments

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 https://github.com/apache/arrow-datafusion/pull/2809#discussion_r912515638

liukun4515 avatar Jul 04 '22 02:07 liukun4515