Skip to content
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ case class GpuSlice(x: Expression, start: Expression, length: Expression)

override def doColumnar(listCol: GpuColumnVector, startS: GpuScalar,
lengthS: GpuScalar): ColumnVector = {
// When either start or length is null, return all nulls like the CPU does.
// When input column is all nulls or either start or length is null, return all nulls like the CPU does.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is too long which caused

error file=/home/runner/work/spark-rapids/spark-rapids/sql-plugin/src/main/scala/org/apache/spark/sql/rapids/collectionOperations.scala message=File line length exceeds 100 characters. line=172
Processed 1332 file(s)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the line length issue by breaking the long comment and condition into multiple lines in commit 4e60e36.

// This matches CPU behavior for slice function with null inputs.
if (listCol.getRowCount == listCol.numNulls() || !startS.isValid || !lengthS.isValid) {
GpuColumnVector.columnVectorFromNull(listCol.getRowCount.toInt, dataType)
} else {
Expand Down Expand Up @@ -216,6 +217,11 @@ case class GpuSlice(x: Expression, start: Expression, length: Expression)
} else {
val list = listCol.getBase
val start = startCol.getBase
withResource(GpuDivModLike.mergeNulls(list, start)) { mergedNulls =>
if (mergedNulls.getRowCount == mergedNulls.getNullCount) {
return GpuColumnVector.columnVectorFromNull(listCol.getRowCount.toInt, dataType)
}
}
val length = lengthS.getValue.asInstanceOf[Int]
withResource(Scalar.fromInt(0)) { zero =>
if (start.contains(zero)) {
Expand All @@ -237,6 +243,14 @@ case class GpuSlice(x: Expression, start: Expression, length: Expression)
val list = listCol.getBase
val start = startCol.getBase
val length = lengthCol.getBase
val mergedNullsList = withResource(GpuDivModLike.mergeNulls(list, start)) { mergedNulls =>
GpuDivModLike.mergeNulls(mergedNulls, length)
}
withResource(mergedNullsList) { _ =>
if (mergedNullsList.getRowCount == mergedNullsList.getNullCount) {
return GpuColumnVector.columnVectorFromNull(listCol.getRowCount.toInt, dataType)
}
}
withResource(Scalar.fromInt(0)) { zero =>
if (start.contains(zero)) {
throw RapidsErrorUtils.unexpectedValueForStartInFunctionError(prettyName)
Expand Down
Loading