Skip to content

Commit

Permalink
refactor(compilers): move compilers out of the backend dependency path (
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Jul 15, 2024
1 parent ef4e47b commit 122330a
Show file tree
Hide file tree
Showing 46 changed files with 110 additions and 90 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ibis-backends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
sys-deps:
- libgeos-dev
- name: risingwave
title: Risingwave
title: RisingWave
serial: true
services:
- risingwave
Expand Down Expand Up @@ -304,7 +304,7 @@ jobs:
- os: windows-latest
backend:
name: risingwave
title: Risingwave
title: RisingWave
serial: true
services:
- risingwave
Expand Down
6 changes: 3 additions & 3 deletions docs/backends/risingwave.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ con = ibis.risingwave.connect() # <1>

## `conda`

Install for Risingwave:
Install for RisingWave:

```{.bash}
conda install -c conda-forge ibis-risingwave
Expand All @@ -48,7 +48,7 @@ con = ibis.risingwave.connect() # <1>

## `mamba`

Install for Risingwave:
Install for RisingWave:

```{.bash}
mamba install -c conda-forge ibis-risingwave
Expand Down Expand Up @@ -98,7 +98,7 @@ render_do_connect("risingwave")

```{python}
#| echo: false
BACKEND = "Risingwave"
BACKEND = "RisingWave"
```

{{< include ./_templates/api.qmd >}}
2 changes: 1 addition & 1 deletion docs/backends/support/matrix.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import ibis.expr.operations as ops
def make_support_matrix():
"""Construct the backend operation support matrix data."""
from ibis.backends.sql.compiler import ALL_OPERATIONS
from ibis.backends.sql.compilers.base import ALL_OPERATIONS
support_matrix_ignored_operations = (ops.ScalarParameter,)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
rename_partitioned_column,
schema_from_bigquery_table,
)
from ibis.backends.bigquery.compiler import BigQueryCompiler
from ibis.backends.bigquery.datatypes import BigQuerySchema
from ibis.backends.bigquery.udf.core import PythonToJavaScriptTranslator
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compilers import BigQueryCompiler
from ibis.backends.sql.datatypes import BigQueryType

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/bigquery/tests/unit/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis import _
from ibis.backends.bigquery.compiler import BigQueryCompiler
from ibis.backends.sql.compilers import BigQueryCompiler
from ibis.common.annotations import ValidationError

to_sql = ibis.bigquery.compile
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/clickhouse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import BaseBackend, CanCreateDatabase
from ibis.backends.clickhouse.compiler import ClickHouseCompiler
from ibis.backends.clickhouse.converter import ClickHousePandasData
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import C
from ibis.backends.sql.compilers import ClickHouseCompiler
from ibis.backends.sql.compilers.base import C

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator, Mapping
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/datafusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import ibis.expr.schema as sch
import ibis.expr.types as ir
from ibis.backends import CanCreateCatalog, CanCreateDatabase, CanCreateSchema, NoUrl
from ibis.backends.datafusion.compiler import DataFusionCompiler
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import C
from ibis.backends.sql.compilers import DataFusionCompiler
from ibis.backends.sql.compilers.base import C
from ibis.common.dispatch import lazy_singledispatch
from ibis.expr.operations.udf import InputType
from ibis.formats.pyarrow import PyArrowSchema, PyArrowType
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/druid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import ibis.expr.datatypes as dt
import ibis.expr.schema as sch
from ibis.backends.druid.compiler import DruidCompiler
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import STAR
from ibis.backends.sql.compilers import DruidCompiler
from ibis.backends.sql.compilers.base import STAR
from ibis.backends.sql.datatypes import DruidType

if TYPE_CHECKING:
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/duckdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateDatabase, CanCreateSchema, UrlFromPath
from ibis.backends.duckdb.compiler import DuckDBCompiler
from ibis.backends.duckdb.converter import DuckDBPandasData
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import STAR, C
from ibis.backends.sql.compilers import DuckDBCompiler
from ibis.backends.sql.compilers.base import STAR, C
from ibis.common.dispatch import lazy_singledispatch
from ibis.expr.operations.udf import InputType
from ibis.util import deprecated
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/exasol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateDatabase, CanCreateSchema
from ibis.backends.exasol.compiler import ExasolCompiler
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import STAR, C
from ibis.backends.sql.compilers import ExasolCompiler
from ibis.backends.sql.compilers.base import STAR, C

if TYPE_CHECKING:
from collections.abc import Iterable, Mapping
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/flink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import ibis.expr.schema as sch
import ibis.expr.types as ir
from ibis.backends import CanCreateDatabase, NoUrl
from ibis.backends.flink.compiler import FlinkCompiler
from ibis.backends.flink.ddl import (
CreateDatabase,
CreateTableWithSchema,
Expand All @@ -22,6 +21,7 @@
RenameTable,
)
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compilers import FlinkCompiler
from ibis.backends.tests.errors import Py4JJavaError
from ibis.expr.operations.udf import InputType
from ibis.util import gen_name
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/impala/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from ibis import util
from ibis.backends.impala import ddl, udf
from ibis.backends.impala.client import ImpalaTable
from ibis.backends.impala.compiler import ImpalaCompiler
from ibis.backends.impala.ddl import (
CTAS,
CreateDatabase,
Expand All @@ -39,6 +38,7 @@
wrap_udf,
)
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compilers import ImpalaCompiler

if TYPE_CHECKING:
from collections.abc import Mapping
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/impala/tests/mocks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from ibis.backends.impala.compiler import ImpalaCompiler
from ibis.backends.sql.compilers import ImpalaCompiler
from ibis.tests.expr.mocks import MockBackend


Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/mssql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateCatalog, CanCreateDatabase, CanCreateSchema, NoUrl
from ibis.backends.mssql.compiler import MSSQLCompiler
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import STAR, C
from ibis.backends.sql.compilers import MSSQLCompiler
from ibis.backends.sql.compilers.base import STAR, C

if TYPE_CHECKING:
from collections.abc import Iterable, Mapping
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/mysql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateDatabase
from ibis.backends.mysql.compiler import MySQLCompiler
from ibis.backends.mysql.datatypes import _type_from_cursor_info
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import STAR, TRUE, C
from ibis.backends.sql.compilers import MySQLCompiler
from ibis.backends.sql.compilers.base import STAR, TRUE, C

if TYPE_CHECKING:
from collections.abc import Mapping
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/oracle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanListDatabase, CanListSchema
from ibis.backends.oracle.compiler import OracleCompiler
from ibis.backends.sql import STAR, SQLBackend
from ibis.backends.sql.compiler import C
from ibis.backends.sql.compilers import OracleCompiler
from ibis.backends.sql.compilers.base import C

if TYPE_CHECKING:
from urllib.parse import ParseResult
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateDatabase, CanCreateSchema, CanListCatalog
from ibis.backends.postgres.compiler import PostgresCompiler
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import TRUE, C, ColGen, F
from ibis.backends.sql.compilers import PostgresCompiler
from ibis.backends.sql.compilers.base import TRUE, C, ColGen, F
from ibis.common.exceptions import InvalidDecoratorError

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/pyspark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateDatabase, CanListCatalog
from ibis.backends.pyspark.compiler import PySparkCompiler
from ibis.backends.pyspark.converter import PySparkPandasData
from ibis.backends.pyspark.datatypes import PySparkSchema, PySparkType
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compilers import PySparkCompiler
from ibis.expr.operations.udf import InputType
from ibis.legacy.udf.vectorized import _coerce_to_series
from ibis.util import deprecated
Expand Down
10 changes: 5 additions & 5 deletions ibis/backends/risingwave/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Risingwave backend."""
"""RisingWave backend."""

from __future__ import annotations

Expand All @@ -16,7 +16,7 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends.postgres import Backend as PostgresBackend
from ibis.backends.risingwave.compiler import RisingwaveCompiler
from ibis.backends.sql.compilers import RisingWaveCompiler
from ibis.util import experimental

if TYPE_CHECKING:
Expand Down Expand Up @@ -45,7 +45,7 @@ def format_properties(props):

class Backend(PostgresBackend):
name = "risingwave"
compiler = RisingwaveCompiler()
compiler = RisingWaveCompiler()
supports_python_udfs = False

def do_connect(
Expand Down Expand Up @@ -88,7 +88,7 @@ def do_connect(
[...]
>>> t = con.table("functional_alltypes")
>>> t
RisingwaveTable[table]
RisingWaveTable[table]
name: functional_alltypes
schema:
id : int32
Expand Down Expand Up @@ -140,7 +140,7 @@ def create_table(
encode_format: str | None = None,
encode_properties: dict | None = None,
):
"""Create a table in Risingwave.
"""Create a table in RisingWave.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/risingwave/tests/test_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_simple_mv(con, alltypes, column):
def test_mv_on_simple_source(con):
sc_name = util.gen_name("simple_sc")
schema = ibis.schema([("v", "int32")])
# use Risingwave's internal data generator to imitate a upstream data source
# use RisingWave's internal data generator to imitate a upstream data source
connector_properties = {
"connector": "datagen",
"fields.v.kind": "sequence",
Expand Down Expand Up @@ -58,7 +58,7 @@ def test_mv_on_simple_source(con):
def test_mv_on_table_with_connector(con):
tblc_name = util.gen_name("simple_table_with_connector")
schema = ibis.schema([("v", "int32")])
# use Risingwave's internal data generator to imitate a upstream data source
# use RisingWave's internal data generator to imitate a upstream data source
connector_properties = {
"connector": "datagen",
"fields.v.kind": "sequence",
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import CanCreateCatalog, CanCreateDatabase, CanCreateSchema
from ibis.backends.snowflake.compiler import SnowflakeCompiler
from ibis.backends.snowflake.converter import SnowflakePandasData
from ibis.backends.sql import SQLBackend
from ibis.backends.sql.compiler import STAR
from ibis.backends.sql.compilers import SnowflakeCompiler
from ibis.backends.sql.compilers.base import STAR
from ibis.backends.sql.datatypes import SnowflakeType

if TYPE_CHECKING:
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
import ibis.expr.types as ir
from ibis import util
from ibis.backends import BaseBackend
from ibis.backends.sql.compiler import STAR
from ibis.backends.sql.compilers.base import STAR

if TYPE_CHECKING:
from collections.abc import Iterable, Mapping

import pandas as pd
import pyarrow as pa

from ibis.backends.sql.compiler import SQLGlotCompiler
from ibis.backends.sql.compilers.base import SQLGlotCompiler
from ibis.expr.schema import SchemaLike


Expand Down
39 changes: 39 additions & 0 deletions ibis/backends/sql/compilers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from __future__ import annotations

__all__ = [
"BigQueryCompiler",
"ClickHouseCompiler",
"DataFusionCompiler",
"DruidCompiler",
"DuckDBCompiler",
"ExasolCompiler",
"FlinkCompiler",
"ImpalaCompiler",
"MSSQLCompiler",
"MySQLCompiler",
"OracleCompiler",
"PostgresCompiler",
"PySparkCompiler",
"RisingWaveCompiler",
"SnowflakeCompiler",
"SQLiteCompiler",
"TrinoCompiler",
]

from ibis.backends.sql.compilers.bigquery import BigQueryCompiler
from ibis.backends.sql.compilers.clickhouse import ClickHouseCompiler
from ibis.backends.sql.compilers.datafusion import DataFusionCompiler
from ibis.backends.sql.compilers.druid import DruidCompiler
from ibis.backends.sql.compilers.duckdb import DuckDBCompiler
from ibis.backends.sql.compilers.exasol import ExasolCompiler
from ibis.backends.sql.compilers.flink import FlinkCompiler
from ibis.backends.sql.compilers.impala import ImpalaCompiler
from ibis.backends.sql.compilers.mssql import MSSQLCompiler
from ibis.backends.sql.compilers.mysql import MySQLCompiler
from ibis.backends.sql.compilers.oracle import OracleCompiler
from ibis.backends.sql.compilers.postgres import PostgresCompiler
from ibis.backends.sql.compilers.pyspark import PySparkCompiler
from ibis.backends.sql.compilers.risingwave import RisingWaveCompiler
from ibis.backends.sql.compilers.snowflake import SnowflakeCompiler
from ibis.backends.sql.compilers.sqlite import SQLiteCompiler
from ibis.backends.sql.compilers.trino import TrinoCompiler
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis import util
from ibis.backends.sql.compiler import NULL, STAR, SQLGlotCompiler
from ibis.backends.sql.compilers.base import NULL, STAR, SQLGlotCompiler
from ibis.backends.sql.datatypes import BigQueryType, BigQueryUDFType
from ibis.backends.sql.rewrites import (
exclude_unsupported_window_frame_from_ops,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops
from ibis import util
from ibis.backends.sql.compiler import NULL, STAR, AggGen, SQLGlotCompiler
from ibis.backends.sql.compilers.base import NULL, STAR, AggGen, SQLGlotCompiler
from ibis.backends.sql.datatypes import ClickHouseType
from ibis.backends.sql.dialects import ClickHouse

Expand Down
Loading

0 comments on commit 122330a

Please sign in to comment.