Skip to content

Commit

Permalink
fix(snowflake): use _flatten to avoid overriding unrelated function…
Browse files Browse the repository at this point in the history
… in other backends
  • Loading branch information
cpcloud committed Feb 1, 2023
1 parent 57aee3b commit 8c31594
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ibis/backends/snowflake/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ def _arbitrary(t, op):
return t._reduction(sa.func.min, op)


class flatten(GenericFunction):
class _flatten(GenericFunction):
def __init__(self, arg, *, type: sa.types.TypeEngine) -> None:
super().__init__(arg)
self.type = sqltypes.TableValueType(sa.Column("value", type))


@compiles(flatten, "snowflake")
@compiles(_flatten, "snowflake")
def compiles_flatten(element, compiler, **kw):
arg = compiler.function_argspec(element, **kw)
return f"FLATTEN(INPUT => {arg}, MODE => 'ARRAY')"
Expand All @@ -154,7 +154,7 @@ def _unnest(t, op):
sep = util.guid()
sqla_type = t.get_sqla_type(op.output_dtype)
col = (
flatten(sa.func.split(sa.func.array_to_string(arg, sep), sep), type=sqla_type)
_flatten(sa.func.split(sa.func.array_to_string(arg, sep), sep), type=sqla_type)
.lateral()
.c["value"]
)
Expand Down

0 comments on commit 8c31594

Please sign in to comment.