Skip to content

Commit

Permalink
Revert "Update to libcudf unsigned sum aggregation types change (#10267
Browse files Browse the repository at this point in the history
…)"

This reverts commit 3bb2f6c.

Signed-off-by: Robert (Bobby) Evans <bobby@apache.org>
  • Loading branch information
revans2 committed Jan 30, 2024
1 parent e375368 commit 998ca27
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,6 @@ case class GpuExtractChunk32(
override def children: Seq[Expression] = Seq(data)
}

object GpuExtractChunk32 {
/** Build the aggregate expressions for summing the four 32-bit chunks of a 128-bit decimal. */
def chunkSumExprs(): Seq[CudfAggregate] = (0 until 4).map { i =>
// first three chunk columns are UINT32, so they are promoted to UINT64 during aggregation.
val colType = if (i < 3) GpuUnsignedLongType else LongType
new CudfSum(colType)
}
}

/**
* Reassembles a 128-bit value from four separate 64-bit sum results
* @param chunkAttrs attributes for the four 64-bit sum chunks ordered from least significant to
Expand Down Expand Up @@ -1100,7 +1091,7 @@ case class GpuDecimal128Sum(
chunks :+ GpuIsNull(child)
}

private lazy val updateSumChunks = GpuExtractChunk32.chunkSumExprs
private lazy val updateSumChunks = (0 until 4).map(_ => new CudfSum(LongType))

override lazy val updateAggregates: Seq[CudfAggregate] = updateSumChunks :+ updateIsEmpty

Expand All @@ -1119,7 +1110,7 @@ case class GpuDecimal128Sum(
chunks ++ Seq(isEmpty, GpuIsNull(sum))
}

private lazy val mergeSumChunks = GpuExtractChunk32.chunkSumExprs()
private lazy val mergeSumChunks = (0 until 4).map(_ => new CudfSum(LongType))

// To be able to do decimal overflow detection, we need a CudfSum that does **not** ignore nulls.
// Cudf does not have such an aggregation, so for merge we have to work around that similar to
Expand Down Expand Up @@ -1484,7 +1475,7 @@ case class GpuDecimal128Average(child: Expression, dt: DecimalType)
chunks :+ forCount
}

private lazy val updateSumChunks = GpuExtractChunk32.chunkSumExprs()
private lazy val updateSumChunks = (0 until 4).map(_ => new CudfSum(LongType))

override lazy val updateAggregates: Seq[CudfAggregate] = updateSumChunks :+ updateCount

Expand All @@ -1502,7 +1493,7 @@ case class GpuDecimal128Average(child: Expression, dt: DecimalType)
chunks ++ Seq(count, GpuIsNull(sum))
}

private lazy val mergeSumChunks = GpuExtractChunk32.chunkSumExprs()
private lazy val mergeSumChunks = (0 until 4).map(_ => new CudfSum(LongType))

override lazy val mergeAggregates: Seq[CudfAggregate] =
mergeSumChunks ++ Seq(mergeCount, mergeIsOverflow)
Expand Down

0 comments on commit 998ca27

Please sign in to comment.