Github user guoyuepeng commented on a diff in the pull request:
https://github.com/apache/incubator-griffin/pull/434#discussion_r224956565
--- Diff:
measure/src/main/scala/org/apache/griffin/measure/step/builder/dsl/transform/AccuracyExpr2DQSteps.scala
---
@@ -125,14 +126,20 @@ case class AccuracyExpr2DQSteps(context: DQContext,
// 4. accuracy metric
val accuracyTableName = ruleParam.getOutDfName()
val matchedColName = details.getStringOrKey(_matched)
+ val matchedFractionColName = details.getStringOrKey(_matchedFraction)
val accuracyMetricSql = procType match {
case BatchProcessType =>
s"""
- |SELECT `${totalCountTableName}`.`${totalColName}` AS
`${totalColName}`,
- |coalesce(`${missCountTableName}`.`${missColName}`, 0) AS
`${missColName}`,
- |(`${totalCountTableName}`.`${totalColName}` -
coalesce(`${missCountTableName}`.`${missColName}`, 0)) AS `${matchedColName}`
- |FROM `${totalCountTableName}` LEFT JOIN
`${missCountTableName}`
- """.stripMargin
+ SELECT A.total AS `${totalColName}`,
+ A.miss AS `${missColName}`,
+ (A.total - A.miss) AS `${matchedColName}`,
+ coalesce( (A.total - A.miss) / A.total, 1.0) AS
`${matchedFractionColName}`
--- End diff --
add one more metrics, ok.
---