com.sparkutils.quality.impl.RuleSuiteResultDetailsExpr.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quality_9.1.dbr_3.1_2.12 Show documentation
Show all versions of quality_9.1.dbr_3.1_2.12 Show documentation
A Spark library for managing in-process data quality rules via Spark SQL
The newest version!
package com.sparkutils.quality.impl
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
import org.apache.spark.sql.catalyst.expressions.{Expression, NonSQLExpression, UnaryExpression}
import org.apache.spark.sql.shim.expressions.InputTypeChecks
import org.apache.spark.sql.types._
import com.sparkutils.quality.types.{ruleSuiteResultType, ruleSuiteDetailsResultType}
object RuleSuiteResultDetailsExpr {
def getDetails(input: scala.Any): InternalRow = {
// should actually be a row
val ir = input.asInstanceOf[InternalRow]
InternalRow(ir.getLong(0), ir.getMap(2))
}
}
/**
* Consumes a RuleSuiteResult and returns RuleSuiteDetails
*/
case class RuleSuiteResultDetailsExpr(child: Expression) extends UnaryExpression with NonSQLExpression with InputTypeChecks {
override def inputDataTypes: Seq[Seq[DataType]] = Seq(Seq(ruleSuiteResultType))
override protected def nullSafeEval(input : scala.Any) : scala.Any = RuleSuiteResultDetailsExpr.getDetails(input)
def dataType: DataType = ruleSuiteDetailsResultType
override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode =
defineCodeGen(ctx, ev, c => s"com.sparkutils.quality.impl.RuleSuiteResultDetailsExpr.getDetails($c)")
protected def withNewChildInternal(newChild: Expression): Expression = copy(child = newChild)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy