Skip to content

Commit

Permalink
fix(datatypes): manually cast the type of pos to int16 for `table…
Browse files Browse the repository at this point in the history
….info()` (#9139)
  • Loading branch information
jitingxu1 authored Jun 5, 2024
1 parent 5bef96a commit 9eb1ed1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,23 @@ def test_table_info(alltypes):
assert expr.columns == list(df.columns)


@pytest.mark.notyet(
["druid"],
raises=PyDruidProgrammingError,
reason="Druid only supports trivial unions",
)
@pytest.mark.notyet(
["flink"], reason="IOException - Insufficient number of network buffers"
)
def test_table_info_large(con):
num_cols = 129
col_names = [f"col_{i}" for i in range(num_cols)]
t = ibis.memtable({col: [0, 1] for col in col_names})
result = con.execute(t.info())
assert list(result.name) == col_names
assert result.pos.dtype == np.int16


@pytest.mark.notimpl(
[
"datafusion",
Expand Down
2 changes: 1 addition & 1 deletion ibis/expr/types/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2865,7 +2865,7 @@ def info(self) -> Table:
nulls=lambda t: t.isna.sum(),
non_nulls=lambda t: (1 - t.isna).sum(),
null_frac=lambda t: t.isna.mean(),
pos=lit(pos),
pos=lit(pos, type=dt.int16),
)
aggs.append(agg)
return ibis.union(*aggs).order_by(ibis.asc("pos"))
Expand Down

0 comments on commit 9eb1ed1

Please sign in to comment.