Skip to content

Commit

Permalink
BUG: Partially revert #1758
Browse files Browse the repository at this point in the history
This caused a few failures with downstream code, so I've reverted the
changes to ibis/pandas/core.py.  I've left other fixes from #1758
unchanged.  I'll revisit the reimplementation in the near future.
Author: Phillip Cloud <cpcloud@gmail.com>

Closes #1837 from cpcloud/revert-topo and squashes the following commits:

c9662ac [Phillip Cloud] Just pass kwargs through
5d8ec82 [Phillip Cloud] Make zero argument UDFs work again
9fa4481 [Phillip Cloud] Revert toposort change
d9c00ef [Phillip Cloud] Remove unnecessary code
deed6aa [Phillip Cloud] Revert select parts
  • Loading branch information
cpcloud committed Jun 19, 2019
1 parent 4003554 commit 730df43
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 266 deletions.
14 changes: 3 additions & 11 deletions ibis/file/client.py
Expand Up @@ -2,8 +2,7 @@

import ibis
import ibis.expr.types as ir
from ibis.pandas.core import execute
from ibis.pandas.dispatch import execute_last
from ibis.pandas.core import execute_and_reset


class FileClient(ibis.client.Client):
Expand Down Expand Up @@ -35,15 +34,8 @@ def database(self, name=None, path=None):
return FileDatabase(name, self, path=path)

def execute(self, expr, params=None, **kwargs): # noqa
assert isinstance(expr, ir.Expr), "Expected ir.Expr, got {}".format(
type(expr)
)
return execute_last(
expr.op(),
execute(expr, params=params, **kwargs),
params=params,
**kwargs,
)
assert isinstance(expr, ir.Expr)
return execute_and_reset(expr, params=params, **kwargs)

def list_tables(self, path=None):
raise NotImplementedError
Expand Down
3 changes: 3 additions & 0 deletions ibis/file/tests/test_csv.py
Expand Up @@ -74,6 +74,9 @@ def test_read(csv, data):
expected['time'] = expected['time'].astype(str)
tm.assert_frame_equal(result, expected)

result = closes.execute()
tm.assert_frame_equal(result, expected)


def test_read_with_projection(csv2, data):

Expand Down
3 changes: 3 additions & 0 deletions ibis/file/tests/test_hdf5.py
Expand Up @@ -90,6 +90,9 @@ def test_read(hdf, data):
expected = data['close']
tm.assert_frame_equal(result, expected)

result = closes.execute()
tm.assert_frame_equal(result, expected)


def test_insert(transformed, tmpdir):

Expand Down
4 changes: 3 additions & 1 deletion ibis/file/tests/test_parquet.py
Expand Up @@ -4,7 +4,6 @@
from pandas.util import testing as tm

import ibis

from ibis.file.client import FileDatabase

pa = pytest.importorskip('pyarrow') # isort:skip
Expand Down Expand Up @@ -87,6 +86,9 @@ def test_read(parquet, data):
expected = data['close']
tm.assert_frame_equal(result, expected)

result = closes.execute()
tm.assert_frame_equal(result, expected)


def test_write(transformed, tmpdir):
t = transformed
Expand Down
7 changes: 2 additions & 5 deletions ibis/pandas/client.py
Expand Up @@ -20,8 +20,7 @@
import ibis.expr.schema as sch
import ibis.expr.types as ir
from ibis.compat import CategoricalDtype, DatetimeTZDtype
from ibis.pandas.core import execute
from ibis.pandas.dispatch import execute_last
from ibis.pandas.core import execute_and_reset

try:
infer_pandas_dtype = pd.api.types.infer_dtype
Expand Down Expand Up @@ -370,9 +369,7 @@ def execute(self, query, params=None, limit='default', **kwargs):
type(query).__name__
)
)
result = execute(query, params=params, **kwargs)
query_op = query.op()
return execute_last(query_op, result, params=params, **kwargs)
return execute_and_reset(query, params=params, **kwargs)

def compile(self, expr, *args, **kwargs):
"""Compile `expr`.
Expand Down

0 comments on commit 730df43

Please sign in to comment.