Skip to content

Commit

Permalink
Stop using copyWithBooleanColumnAsValidity [databricks] (#11418)
Browse files Browse the repository at this point in the history
* stop using copyWithBooleanColumnAsValidity

Signed-off-by: Chong Gao <res_life@163.com>

* Refactor: rename variable

---------

Signed-off-by: Chong Gao <res_life@163.com>
Co-authored-by: Chong Gao <res_life@163.com>
  • Loading branch information
res-life and Chong Gao authored Sep 3, 2024
1 parent ee2049a commit 6d4c4ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ object GpuOrcScan {
withResource(overflowFlags) { _ =>
// This is an integer type so we don't have to worry about
// nested DTypes here.
withResource(Scalar.fromNull(toType)) { NULL =>
overflowFlags.ifElse(casted, NULL)
withResource(Scalar.fromNull(toType)) { nullVal =>
overflowFlags.ifElse(casted, nullVal)
}
}
}
Expand Down Expand Up @@ -338,8 +338,8 @@ object GpuOrcScan {
// next convert to long,
// then down cast long to the target integral type.
val longDoubles = withResource(doubleCanFitInLong(col)) { fitLongs =>
withResource(Scalar.fromNull(fromDt)) { NULL =>
fitLongs.ifElse(col, NULL)
withResource(Scalar.fromNull(fromDt)) { nullVal =>
fitLongs.ifElse(col, nullVal)
}
}
withResource(longDoubles) { _ =>
Expand Down Expand Up @@ -394,7 +394,9 @@ object GpuOrcScan {
withResource(doubleMillis.add(half)) { doubleMillisPlusHalf =>
withResource(doubleMillisPlusHalf.floor()) { millis =>
withResource(getOverflowFlags(doubleMillis, millis)) { overflowFlags =>
millis.copyWithBooleanColumnAsValidity(overflowFlags)
withResource(Scalar.fromNull(millis.getType)) { nullVal =>
overflowFlags.ifElse(millis, nullVal)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ case class GpuArrayContains(left: Expression, right: Expression)
containsResult.or(_)
}
withResource(containsKeyOrNotContainsNull) { lcnn =>
withResource(Scalar.fromNull(DType.BOOL8)) { NULL =>
lcnn.ifElse(containsResult, NULL)
withResource(Scalar.fromNull(DType.BOOL8)) { nullVal =>
lcnn.ifElse(containsResult, nullVal)
}
}
}
Expand Down

0 comments on commit 6d4c4ef

Please sign in to comment.