Skip to content

Commit 4bb9484

Browse files
authored
fix(ibis_yaml): Distinct: register from_yaml loader (#1303)
fixes #1301
1 parent 319eaf1 commit 4bb9484

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

python/xorq/common/utils/snowflake_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@ def get_snowflake_last_modification_time(dt):
107107
.LAST_ALTERED.execute()
108108
.values
109109
)
110-
if not values:
110+
if not len(values):
111+
raise ValueError
112+
(value, *rest) = values
113+
if rest:
111114
raise ValueError
112-
(value,) = values
113115
return value
114116

115117

python/xorq/ibis_yaml/translate.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,13 @@ def _sort_from_yaml(yaml_dict: dict, context: TranslationContext) -> ir.Expr:
11181118
return sort_op.to_expr()
11191119

11201120

1121+
@register_from_yaml_handler("Distinct")
1122+
def _distinct_from_yaml(yaml_dict: dict, context: TranslationContext) -> ir.Expr:
1123+
args = tuple(translate_from_yaml(el, context) for el in yaml_dict["args"])
1124+
distinct_op = ops.Distinct(*args)
1125+
return distinct_op.to_expr()
1126+
1127+
11211128
@translate_to_yaml.register(ops.SortKey)
11221129
def _sort_key_to_yaml(op: ops.SortKey, context: TranslationContext) -> dict:
11231130
return freeze(

0 commit comments

Comments
 (0)