override protected def nullSafeCodeGen()

in src/main/scala/org/apache/spark/sql/datasketches/theta/expressions/ThetaExpressions.scala [123:132]


  override protected def nullSafeCodeGen(ctx: CodegenContext, ev: ExprCode, f: String => String): ExprCode = {
    val childEval = child.genCode(ctx)
    val sketch = ctx.freshName("sketch")
    val code = s"""
      ${childEval.code}
      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)
  }