一个用于测量大型数据集中的数据质量开源项目-deequ

Deequ 是一个建立在 Apache Spark 之上的库,用于定义“数据单元测试”,用于测量大型数据集中的数据质量。提供JAVA及Python实现。

github访问地址:https://github.com/awslabs/deequ

一个用于测量大型数据集中的数据质量开源项目-deequ

Deequ 有 4 个主要组件,它们是:

  • 指标计算:Profiles利用分析器分析数据集的每一列。Analyzers在这里用作计算大规模数据分析和验证指标的基础模块。
  • 约束建议:为要在数据集上运行的各种分析器组指定规则,以返回建议在验证套件中运行的约束集合。
  • 约束验证:根据您设置的各种约束对数据集执行数据验证。
  • 指标库允许对 Deequ 随着时间的运行进行持久性和跟踪。

代码示例

import com.amazon.deequ.VerificationSuite
import com.amazon.deequ.checks.{Check, CheckLevel, CheckStatus}


val verificationResult = VerificationSuite()
  .onData(data)
  .addCheck(
    Check(CheckLevel.Error, "unit testing my data")
      .hasSize(_ == 5) // we expect 5 rows
      .isComplete("id") // should never be NULL
      .isUnique("id") // should not contain duplicates
      .isComplete("productName") // should never be NULL
      // should only contain the values "high" and "low"
      .isContainedIn("priority", Array("high", "low"))
      .isNonNegative("numViews") // should not contain negative values
      // at least half of the descriptions should contain a url
      .containsURL("description", _ >= 0.5)
      // half of the items should have less than 10 views
      .hasApproxQuantile("numViews", 0.5, _ <= 10))
    .run()
发表评论
留言与评论(共有 0 条评论) “”
   
验证码:

相关文章

推荐文章