Skip to content

Commit

Permalink
Refactor query execution to avoid toJSON call in SparkExpectationsAct…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
dannymeijer committed Dec 13, 2024
1 parent 9500ed9 commit 01f61f6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions spark_expectations/utils/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def agg_query_dq_detailed_result(
)
):
for _key, _querydq_query in sub_key_value.items():
_querydq_df = _context.spark.sql(_dq_rule["expectation" + "_" + _key])
querydq_output.append(
(
_context.get_run_id,
Expand All @@ -340,11 +341,7 @@ def agg_query_dq_detailed_result(
[
(
_key,
_context.spark.sql(
_dq_rule["expectation" + "_" + _key]
)
.toJSON()
.collect(),
[row.asDict() for row in _querydq_df.collect()],
)
]
),
Expand Down

0 comments on commit 01f61f6

Please sign in to comment.