Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
Signed-off-by: Gera Shegalov <gera@apache.org>
  • Loading branch information
gerashegalov committed Oct 24, 2022
1 parent cad5763 commit 9b32ba3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,8 @@ object GpuIntervalUtils extends Arm {
}

withResource(negatives) { _ =>
withResource(Scalar.fromLong(1L)) { posOne =>
withResource(Scalar.fromLong(-1L)) { negOne =>
negatives.ifElse(negOne, posOne)
}
withResource(Seq(1L, -1L).safeMap(Scalar.fromLong)) { case Seq(posOne, negOne) =>
negatives.ifElse(negOne, posOne)
}
}
}
Expand Down
18 changes: 8 additions & 10 deletions sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuCSVScan.scala
Original file line number Diff line number Diff line change
Expand Up @@ -344,22 +344,20 @@ class CSVPartitionReader(
_.lower()
}

val isTrue = closeOnExcept(lowerStripped) { _ =>
withResource(Scalar.fromString(true.toString)) {
val (isTrue, isValidBool) = withResource(lowerStripped) { _ =>
val isTrueRes = withResource(Scalar.fromString(true.toString)) {
lowerStripped.equalTo
}
}

withResource(isTrue) { _ =>
val isValidBool = withResource(lowerStripped) { _ =>
val isValidBoolRes = closeOnExcept(isTrueRes) { _ =>
withResource(ColumnVector.fromStrings(true.toString, false.toString)) {
lowerStripped.contains
}
}
withResource(isValidBool) { _ =>
withResource(Scalar.fromNull(DType.BOOL8)) { nullBool =>
isValidBool.ifElse(isTrue, nullBool)
}
(isTrueRes, isValidBoolRes)
}
withResource(Seq(isTrue, isValidBool)) { _ =>
withResource(Scalar.fromNull(DType.BOOL8)) { nullBool =>
isValidBool.ifElse(isTrue, nullBool)
}
}
}
Expand Down

0 comments on commit 9b32ba3

Please sign in to comment.