Skip to content

Register custom code checks as user defined functions #266

Closed Answered by canimus
marrov asked this question in Q&A
Discussion options

You must be logged in to vote

@marrov v0.11.1 has now a is_custom check.
The following test case show how to use it, in general, is just a function that receives a dataframe, and by default it will use the last column of the dataframe to compute the evaluation summary:

def test_positive(spark):
    df = spark.range(10)
    check = Check(CheckLevel.WARNING, "pytest")
    check.is_custom("id", lambda x: x.withColumn("test", F.col("id") >= 0))
    rs = check.validate(df)
    assert rs.first().status == "PASS"
    assert rs.first().violations == 0
    assert rs.first().pass_threshold == 1.0

At the moment is only covered for pyspark at a later stage, we could see if its as straight forward in the other dataframe libraries.

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@canimus
Comment options

@marrov
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by marrov
Comment options

You must be logged in to vote
4 replies
@canimus
Comment options

@canimus
Comment options

@marrov
Comment options

@canimus
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request
2 participants