Skip to content

Commit

Permalink
Work around to avoid core dump, Note: this commit will cause memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Chong Gao committed Jan 16, 2025
1 parent f305e0c commit b38c240
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ case class CudfHLLPP(override val dataType: DataType,
cudf.Scalar.structFromColumnViews(cvs: _*)
}
} else {
withResource(new HyperLogLogPlusPlusHostUDF(AggregationType.Reduction, precision)) { hll =>
input.reduce(ReductionAggregation.hostUDF(hll), DType.STRUCT)
}
val hll = new HyperLogLogPlusPlusHostUDF(AggregationType.Reduction, precision)
input.reduce(ReductionAggregation.hostUDF(hll), DType.STRUCT)
}
}
override lazy val groupByAggregate: GroupByAggregation =
withResource(new HyperLogLogPlusPlusHostUDF(AggregationType.GroupBy, precision)) { hll =>
override lazy val groupByAggregate: GroupByAggregation = {
val hll =new HyperLogLogPlusPlusHostUDF(AggregationType.GroupBy, precision)
GroupByAggregation.hostUDF(hll)
}
override val name: String = "CudfHyperLogLogPlusPlus"
Expand All @@ -63,14 +62,13 @@ case class CudfMergeHLLPP(override val dataType: DataType,
precision: Int)
extends CudfAggregate {
override lazy val reductionAggregate: cudf.ColumnVector => cudf.Scalar =
(input: cudf.ColumnVector) => withResource(
new HyperLogLogPlusPlusHostUDF(AggregationType.ReductionMerge, precision)) { hll =>
(input: cudf.ColumnVector) => {
val hll = new HyperLogLogPlusPlusHostUDF(AggregationType.ReductionMerge, precision)
input.reduce(ReductionAggregation.hostUDF(hll), DType.STRUCT)
}

override lazy val groupByAggregate: GroupByAggregation =
withResource(
new HyperLogLogPlusPlusHostUDF(AggregationType.GroupByMerge, precision)) { hll =>
override lazy val groupByAggregate: GroupByAggregation = {
val hll = new HyperLogLogPlusPlusHostUDF(AggregationType.GroupByMerge, precision)
GroupByAggregation.hostUDF(hll)
}

Expand Down

0 comments on commit b38c240

Please sign in to comment.