Skip to content

Commit

Permalink
chore(refactor): handle 0-length args in highest_precedence_shape()
Browse files Browse the repository at this point in the history
moving towards ibis-project#8666
  • Loading branch information
NickCrews committed Jun 7, 2024
1 parent 1055ce3 commit 6a2f71d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions ibis/expr/operations/arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class Array(Value):

exprs: VarTuple[Value]

@attribute
def shape(self):
return rlz.highest_precedence_shape(self.exprs)
shape = rlz.shape_like("exprs")

@attribute
def dtype(self):
Expand Down
4 changes: 4 additions & 0 deletions ibis/expr/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from public import public

import ibis.expr.datashape as ds
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis import util
Expand All @@ -16,6 +17,9 @@

@public
def highest_precedence_shape(nodes):
nodes = tuple(nodes)
if len(nodes) == 0:
return ds.scalar
return max(node.shape for node in nodes)


Expand Down

0 comments on commit 6a2f71d

Please sign in to comment.