Adding new suggestion rule in deequ

484 views Asked by At

I would like to add several new rules in suggestions deequ workflow. For example deequ is offering check if column contains URL (containsURL). I would like to make corresponding suggestion rule.

I would appreciate suggestions how to do that.

Thanks,

Dejan

1

There are 1 answers

0
steps On

The official documentation contains an example for constraint suggestion. In the example, the constraint suggestion is executed via

val suggestionResult = ConstraintSuggestionRunner()
  .onData(data)
  .addConstraintRules(Rules.DEFAULT)
  .run()

The rules are passed in by specifying the argument to addConstraintRules. Rules.DEFAULT, the default set of rules to use, is defined in the ConstraintSuggestionRunner (link).

Hence, to add a new rule, you'd need to declare a rule that extends ConstraintRule (link) or one of its subtypes (link) and pass it to the ConstraintSuggestionRunner when executing.