Skip to content

Commit

Permalink
save a temp columnvector
Browse files Browse the repository at this point in the history
Signed-off-by: Haoyang Li <[email protected]>
  • Loading branch information
thirtiseven committed Dec 6, 2024
1 parent ee65a32 commit 24e75a2
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1247,11 +1247,9 @@ case class GpuContainsAny(input: Expression, targets: Seq[UTF8String])
val boolCvs = withResource(ColumnVector.fromUTF8Strings(targetsBytes: _*)) { targetsCv =>
input.getBase.stringContains(targetsCv)
}
withResource(boolCvs) { _ =>
val falseCv = withResource(Scalar.fromBool(false)) { falseScalar =>
ColumnVector.fromScalar(falseScalar, input.getRowCount.toInt)
}
boolCvs.foldLeft(falseCv)((l, r) => withResource(l) { _ => l.or(r)})
withResource(boolCvs.tail) { _ =>
// boolCvs.head and intermediate values are closed within the withResource in the lambda
boolCvs.tail.foldLeft(boolCvs.head)((l, r) => withResource(l) { _ => l.or(r)})
}
}
}
Expand Down

0 comments on commit 24e75a2

Please sign in to comment.