Skip to content

Commit

Permalink
chore: enable pre-commit and benchmarks on the-epic-split
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Feb 3, 2024
1 parent 463df8e commit 7555a51
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 38 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ibis-docs-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
branches:
- main
- "*.x.x"
- the-epic-split
merge_group:

concurrency:
Expand Down
18 changes: 1 addition & 17 deletions ibis/backends/postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,14 @@ def do_connect(
cur.execute("SET TIMEZONE = UTC")

def list_tables(
self,
like: str | None = None,
database: str | None = None,
schema: str | None = None,
self, like: str | None = None, schema: str | None = None
) -> list[str]:
"""List the tables in the database.
Parameters
----------
like
A pattern to use for listing tables.
database
(deprecated) The database to perform the list against.
schema
The schema to perform the list against.
Expand All @@ -296,19 +291,8 @@ def list_tables(
:::
"""
if database is not None:
util.warn_deprecated(
"database",
instead="Use the `schema` keyword argument instead",
as_of="7.1",
removed_in="8.0",
)

conditions = [TRUE]

if database is not None:
conditions = C.table_catalog.eq(sge.convert(database))

if schema is not None:
conditions = C.table_schema.eq(sge.convert(schema))

Expand Down
12 changes: 3 additions & 9 deletions ibis/backends/snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,16 +539,10 @@ def list_tables(
"""

if database is not None and schema is None:
util.warn_deprecated(
"database",
instead=(
f"{self.name} cannot list tables only using `database` specifier. "
"Include a `schema` argument."
),
as_of="7.1",
removed_in="8.0",
raise com.IbisInputError(
f"{self.name} cannot list tables only using `database` specifier. "
"Include a `schema` argument."
)
database = sg.parse_one(database, into=sge.Table).sql(dialect=self.name)
elif database is None and schema is not None:
database = sg.parse_one(schema, into=sge.Table).sql(dialect=self.name)
else:
Expand Down
23 changes: 11 additions & 12 deletions ibis/backends/tests/test_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
import ibis.expr.operations as ops
import ibis.expr.types as ir
from ibis.backends.base import _get_backend_names
from ibis.backends.pandas.udf import udf

# ruff: noqa: F821

pytestmark = pytest.mark.skip(reason="the backends must be rewritten first")
pytestmark = pytest.mark.benchmark


def make_t():
Expand Down Expand Up @@ -280,9 +279,9 @@ def high_card_grouped_rolling(t):
return t.value.mean().over(high_card_rolling_window(t))


# @udf.reduction(["double"], "double")
# def my_mean(series):
# return series.mean()
@udf.reduction(["double"], "double")
def my_mean(series):
return series.mean()


def low_card_grouped_rolling_udf_mean(t):
Expand All @@ -293,9 +292,9 @@ def high_card_grouped_rolling_udf_mean(t):
return my_mean(t.value).over(high_card_rolling_window(t))


# @udf.analytic(["double"], "double")
# def my_zscore(series):
# return (series - series.mean()) / series.std()
@udf.analytic(["double"], "double")
def my_zscore(series):
return (series - series.mean()) / series.std()


def low_card_window(t):
Expand All @@ -314,9 +313,9 @@ def high_card_window_analytics_udf(t):
return my_zscore(t.value).over(high_card_window(t))


# @udf.reduction(["double", "double"], "double")
# def my_wm(v, w):
# return np.average(v, weights=w)
@udf.reduction(["double", "double"], "double")
def my_wm(v, w):
return np.average(v, weights=w)


def low_card_grouped_rolling_udf_wm(t):
Expand Down

0 comments on commit 7555a51

Please sign in to comment.