Skip to content

Commit

Permalink
feat(deps): support duckdb 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and kszucs committed Sep 7, 2022
1 parent cf4d39d commit 47165b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
3 changes: 3 additions & 0 deletions ibis/backends/duckdb/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import collections
import numbers
import operator

import numpy as np
Expand Down Expand Up @@ -86,6 +87,8 @@ def _literal(_, expr):
return sa.cast(sa.func.list_value(*value), sqla_type)
elif isinstance(value, np.ndarray):
return sa.cast(sa.func.list_value(*value.tolist()), sqla_type)
elif isinstance(value, (numbers.Real, np.floating)) and np.isnan(value):
return sa.cast(sa.literal("NaN"), sqla_type)
elif isinstance(value, collections.abc.Mapping):
if isinstance(dtype, dt.Struct):
placeholders = ", ".join(
Expand Down
10 changes: 4 additions & 6 deletions ibis/backends/tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_trig_functions_literals(con, expr, expected):
param(_.dc.atan(), np.arctan, id="atan"),
param(_.dc.atan2(_.dc), lambda c: np.arctan2(c, c), id="atan2"),
param(_.dc.cos(), np.cos, id="cos"),
param(_.dc.cot(), lambda c: np.cos(c) / np.sin(c), id="cot"),
param(_.dc.cot(), lambda c: 1.0 / np.tan(c), id="cot"),
param(_.dc.sin(), np.sin, id="sin"),
param(_.dc.tan(), np.tan, id="tan"),
],
Expand All @@ -217,12 +217,10 @@ def test_trig_functions_literals(con, expr, expected):
)
def test_trig_functions_columns(backend, expr, alltypes, df, expected_fn):
dc_max = df.double_col.max()
result = (
alltypes.mutate(dc=(_.double_col / dc_max).nullifzero())
.select([expr.name("tmp")])
.execute()
.tmp
expr = alltypes.mutate(dc=(_.double_col / dc_max).nullifzero()).select(
tmp=expr
)
result = expr.tmp.execute()
expected = expected_fn(
(df.double_col / dc_max).replace(0.0, np.nan)
).rename("tmp")
Expand Down
9 changes: 0 additions & 9 deletions poetry-overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ in
'';
});

duckdb = super.duckdb.overrideAttrs (_: rec {
inherit (pkgs.duckdb) version src patches;
format = "setuptools";
preConfigure = ''
cd tools/pythonpkg
'';
SETUPTOOLS_SCM_PRETEND_VERSION = version;
});

hatch-fancy-pypi-readme = super.buildPythonPackage rec {
pname = "hatch-fancy-pypi-readme";
version = "22.3.0";
Expand Down

0 comments on commit 47165b2

Please sign in to comment.