Error using EvaluateDataQuality when trying to compare array

0

When i create a rule to compare arrays directly like here https://docs.aws.amazon.com/glue/latest/dg/data-quality-getting-started.html it works perfectly.

When i try use

    table_ruleset = """ Rules=[my_rules]""""
    EvaluateDataQuality().process_rows(
frame=empty,
        ruleset=table_ruleset,
        publishing_options={
            "dataQualityEvaluationContext": "data_evaluations",
            "enableDataQualityCloudWatchMetrics": True,
            "enableDataQualityResultsPublishing": True,
        },
        additional_options={"performanceTuning.caching": "CACHE_NOTHING"},
    )

its failing i think parsing the text my_rules is equal to:

my_rules  = """ [  CustomSql "select array_agg(code) from table where IN ( 'CANCELLED', 'REPROGRAMATED', 'GRACE' );" =[], CustomSql "select array_agg(code) from table" = [] ] """

but im reciving

IllegalArgumentException: Parsing Error: No rules or analyzers provided., line 3:338 no viable alternative at input 'Rules=[CustomSql "select array_agg(code) from table where IN ( 'CANCELLED', 'REPROGRAMATED', 'GRACE' );" =['

Im doing something wrong? Or is this a problem with the library

1개 답변
0
수락된 답변

I don't think that's allowed (I don't see what you mean by "compare arrays directly works"), arrays/lists are for the IN operand not = , the order would likely break it and empty arrays are not allowed either.
You should be able to redefine your query so it returns a number of a boolean, for instance if you want to check that code array return empty:

CustomSql "select size(array_agg(code)) from table where IN ( 'CANCELLED', 'REPROGRAMATED', 'GRACE' );" = 0

or just:

CustomSql "select count(code) from table where IN ( 'CANCELLED', 'REPROGRAMATED', 'GRACE' );" = 0
profile pictureAWS
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠