Skip to content

Commit

Permalink
fix(spark helpers): sorter function updated to avoid crash (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
DSuveges committed May 20, 2024
1 parent 7d2c2eb commit 6dfee41
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gentropy/common/spark_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common utilities in Spark that can be used across the project."""

from __future__ import annotations

import re
Expand Down Expand Up @@ -363,6 +364,7 @@ def order_array_of_structs_by_field(column_name: str, field_name: str) -> Column
array_sort(
{column_name},
(left, right) -> case
when left.{field_name} is null and right.{field_name} is null then 0
when left.{field_name} is null then 1
when right.{field_name} is null then -1
when left.{field_name} < right.{field_name} then 1
Expand Down

0 comments on commit 6dfee41

Please sign in to comment.