0

I am using deequ verificationsuite to validate my sql tables but I am unable to implement dynamic assert conditions for checks :

val verificationResult: VerificationResult = { VerificationSuite()
  .onData(dataset)
  .addCheck(
    Check(CheckLevel.Error, "Review Check") 
      .hasSize(_ >= 3000000)
  .run()
}

So if you see the assert condition _ >= 3000000 this need to be made dynamic in such a way so that I can support following assertions too :

_ >= 3000000
_ <= 3000000
_ == 3000000
_ > 3000000
_ < 3000000

So how can I provide dynamic assertions to hasSize check in the example I have highlighted.

vibhor Gupta
  • 103
  • 11

1 Answers1

0
def validate(val){

    def gtCondn(): Boolean = {
        _ >= val
    }

    val verificationResult: VerificationResult = { VerificationSuite()
      .onData(dataset)
      .addCheck(Check(CheckLevel.Error, "Review Check").hasSize(gtCondn)).run()
    }
}
vibhor Gupta
  • 103
  • 11