This is an automated email from the ASF dual-hosted git repository. jmalkin pushed a commit to branch codegen_fix in repository https://gitbox.apache.org/repos/asf/datasketches-spark.git
commit f3e5b476d80c41f394b66576612c69d782df4e37 Author: Jon <[email protected]> AuthorDate: Wed Feb 26 23:13:09 2025 -0800 Clean up codegen to avoid exceptions and allow that processing path --- .../sql/datasketches/theta/expressions/ThetaExpressions.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/scala/org/apache/spark/sql/datasketches/theta/expressions/ThetaExpressions.scala b/src/main/scala/org/apache/spark/sql/datasketches/theta/expressions/ThetaExpressions.scala index 8dbb8ea..dc9985c 100644 --- a/src/main/scala/org/apache/spark/sql/datasketches/theta/expressions/ThetaExpressions.scala +++ b/src/main/scala/org/apache/spark/sql/datasketches/theta/expressions/ThetaExpressions.scala @@ -63,7 +63,7 @@ case class ThetaSketchGetEstimate(child: Expression) val sketch = ctx.freshName("sketch") val code = s""" ${childEval.code} - final org.apache.datasketches.theta.Sketch $sketch = org.apache.spark.sql.types.ThetaSketchWrapper.wrapAsReadOnlySketch(${childEval.value}); + final org.apache.datasketches.theta.Sketch $sketch = org.apache.spark.sql.datasketches.theta.types.ThetaSketchWrapper.wrapAsReadOnlySketch(${childEval.value}); final double ${ev.value} = $sketch.getEstimate(); """ ev.copy(code = CodeBlock(Seq(code), Seq.empty), isNull = childEval.isNull) @@ -81,7 +81,7 @@ case class ThetaSketchGetEstimate(child: Expression) examples = """ Example: > SELECT _FUNC_(theta_sketch_agg_build(col)) FROM VALUES (1), (2), (3) tab(col); - ### HeapCompactSketch SUMMARY: + ### HeapCompactSketch SUMMARY: Estimate : 3.0 Upper Bound, 95% conf : 3.0 Lower Bound, 95% conf : 3.0 @@ -120,8 +120,8 @@ case class ThetaSketchToString(child: Expression) val sketch = ctx.freshName("sketch") val code = s""" ${childEval.code} - final org.apache.datasketches.theta.Sketch $sketch = org.apache.spark.sql.types.ThetaSketchWrapper.wrapAsReadOnlySketch(${childEval.value}); - final String ${ev.value} = $sketch.toString()); + final org.apache.datasketches.theta.Sketch $sketch = org.apache.spark.sql.datasketches.theta.types.ThetaSketchWrapper.wrapAsReadOnlySketch(${childEval.value}); + final org.apache.spark.unsafe.types.UTF8String ${ev.value} = org.apache.spark.unsafe.types.UTF8String.fromString($sketch.toString()); """ ev.copy(code = CodeBlock(Seq(code), Seq.empty), isNull = childEval.isNull) } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
