Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Chong Gao committed Oct 24, 2024
1 parent 5595f3c commit 136e69a
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ case class GpuHyperLogLogPlusPlusEvaluation(children: Seq[Expression],

override def columnarEval(batch: ColumnarBatch): GpuColumnVector = {

// TODO
// withResourceIfAllowed(childExpr.columnarEval(batch)) { sketches =>
// val distinctValues = HLL.estimateDistinctValueFromSketches(
// TODO
// withResourceIfAllowed(childExpr.columnarEval(batch)) { sketches =>
// val distinctValues = HLL.estimateDistinctValueFromSketches(
// sketches.getBase, numRegistersPerSketch)
// GpuColumnVector.from(distinctValues, LongType)
// }
// GpuColumnVector.from(distinctValues, LongType)
// }

val numRows = batch.numRows()
val zeros = Array.fill(numRows)(0L)
val longCv = ColumnVector.fromLongs(zeros : _*)
val longCv = ColumnVector.fromLongs(zeros: _*)
GpuColumnVector.from(longCv, LongType)
}
}
Expand Down Expand Up @@ -140,15 +140,10 @@ case class GpuHyperLogLogPlusPlus(childExpr: Expression, relativeSD: Double)
/**
* Convert Struct<long, ..., long> column to long columns
*/
private def extractChildren: Seq[Expression] = Seq.tabulate(hllppHelper.numWords) {
override lazy val postUpdate: Seq[Expression] = Seq.tabulate(hllppHelper.numWords) {
i => GpuGetStructField(postUpdateAttr.head, i)
}

/**
* Convert to long columns
*/
override lazy val postUpdate: Seq[Expression] = extractChildren

/**
* convert to Struct<long, ..., long>
*/
Expand All @@ -158,9 +153,11 @@ case class GpuHyperLogLogPlusPlus(childExpr: Expression, relativeSD: Double)
Seq(CudfMergeHLLPP(cuDFBufferType, numRegistersPerSketch))

/**
* Convert to long columns
* Convert Struct<long, ..., long> column to long columns
*/
override lazy val postMerge: Seq[Expression] = extractChildren
override lazy val postMerge: Seq[Expression] = Seq.tabulate(hllppHelper.numWords) {
i => GpuGetStructField(postMergeAttr.head, i)
}

override lazy val evaluateExpression: Expression =
GpuHyperLogLogPlusPlusEvaluation(aggBufferAttributes, numRegistersPerSketch)
Expand Down

0 comments on commit 136e69a

Please sign in to comment.