diff --git a/.codespellrc b/.codespellrc index 15f29d179c21..ae8edd6352b7 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,6 +1,6 @@ [codespell] # local codespell matches `./docs`, pre-commit codespell matches `docs` -skip = *.lock,.direnv,.git,./docs/_freeze,./docs/_output/**,./docs/_inv/**,docs/_freeze/**,*.svg,*.css,*.html,*.js +skip = *.lock,.direnv,.git,./docs/_freeze,./docs/_output/**,./docs/_inv/**,docs/_freeze/**,*.svg,*.css,*.html,*.js,ibis/backends/tests/tpc/queries/duckdb/ds/44.sql ignore-regex = \b(i[if]f|I[IF]F|AFE)\b builtin = clear,rare,names ignore-words-list = tim,notin,ang diff --git a/ci/schema/trino.sql b/ci/schema/trino.sql index 2092ed9d9b13..d4c4ff4f3997 100644 --- a/ci/schema/trino.sql +++ b/ci/schema/trino.sql @@ -1,5 +1,4 @@ -DROP TABLE IF EXISTS hive.default.diamonds; -CREATE TABLE hive.default.diamonds ( +CREATE TABLE IF NOT EXISTS hive.default.diamonds ( "carat" DOUBLE, "cut" VARCHAR, "color" VARCHAR, @@ -18,8 +17,7 @@ CREATE TABLE hive.default.diamonds ( CREATE OR REPLACE VIEW memory.default.diamonds AS SELECT * FROM hive.default.diamonds; -DROP TABLE IF EXISTS hive.default.astronauts; -CREATE TABLE hive.default.astronauts ( +CREATE TABLE IF NOT EXISTS hive.default.astronauts ( "id" BIGINT, "number" BIGINT, "nationwide_number" BIGINT, @@ -52,8 +50,7 @@ CREATE TABLE hive.default.astronauts ( CREATE OR REPLACE VIEW memory.default.astronauts AS SELECT * FROM hive.default.astronauts; -DROP TABLE IF EXISTS hive.default.batting; -CREATE TABLE hive.default.batting ( +CREATE TABLE IF NOT EXISTS hive.default.batting ( "playerID" VARCHAR, "yearID" BIGINT, "stint" BIGINT, @@ -84,8 +81,7 @@ CREATE TABLE hive.default.batting ( CREATE OR REPLACE VIEW memory.default.batting AS SELECT * FROM hive.default.batting; -DROP TABLE IF EXISTS hive.default.awards_players; -CREATE TABLE hive.default.awards_players ( +CREATE TABLE IF NOT EXISTS hive.default.awards_players ( "playerID" VARCHAR, "awardID" VARCHAR, "yearID" BIGINT, @@ -93,15 +89,14 @@ CREATE TABLE hive.default.awards_players ( "tie" VARCHAR, "notes" VARCHAR ) WITH ( - external_location = 's3a://trino/awards-players', + external_location = 's3a://trino/awards_players', format = 'PARQUET' ); CREATE OR REPLACE VIEW memory.default.awards_players AS SELECT * FROM hive.default.awards_players; -DROP TABLE IF EXISTS hive.default.functional_alltypes; -CREATE TABLE hive.default.functional_alltypes ( +CREATE TABLE IF NOT EXISTS hive.default.functional_alltypes ( "id" INTEGER, "bool_col" BOOLEAN, "tinyint_col" TINYINT, @@ -116,9 +111,10 @@ CREATE TABLE hive.default.functional_alltypes ( "year" INTEGER, "month" INTEGER ) WITH ( - external_location = 's3a://trino/functional-alltypes', + external_location = 's3a://trino/functional_alltypes', format = 'PARQUET' ); + CREATE OR REPLACE VIEW memory.default.functional_alltypes AS SELECT * FROM hive.default.functional_alltypes; diff --git a/ibis/backends/datafusion/tests/conftest.py b/ibis/backends/datafusion/tests/conftest.py index f7733ee45eb9..308735a68d9b 100644 --- a/ibis/backends/datafusion/tests/conftest.py +++ b/ibis/backends/datafusion/tests/conftest.py @@ -18,6 +18,7 @@ class TestConf(BackendTest): supports_json = False supports_arrays = True supports_tpch = True + supports_tpcds = True stateful = False deps = ("datafusion",) # Query 1 seems to require a bit more room here @@ -39,20 +40,14 @@ def _load_data(self, **_: Any) -> None: def connect(*, tmpdir, worker_id, **kw): return ibis.datafusion.connect(**kw) - def load_tpch(self) -> None: - """Load TPC-H data.""" - self.tpch_tables = frozenset(self._load_tpc(suite="h", scale_factor="0.17")) - def _load_tpc(self, *, suite, scale_factor): con = self.connection schema = f"tpc{suite}" con.create_database(schema) - tables = set() for path in self.data_dir.joinpath( schema, f"sf={scale_factor}", "parquet" ).glob("*.parquet"): table_name = path.with_suffix("").name - tables.add(table_name) con.con.sql( # datafusion can't create an external table in a specific schema it seems # so hack around that by @@ -68,13 +63,12 @@ def _load_tpc(self, *, suite, scale_factor): f"CREATE TABLE {schema}.{table_name} AS SELECT * FROM {table_name}" ) con.con.sql(f"DROP TABLE {table_name}") - return tables - def _transform_tpch_sql(self, parsed): + def _transform_tpc_sql(self, parsed, *, suite, leaves): def add_catalog_and_schema(node): - if isinstance(node, sg.exp.Table) and node.name in self.tpch_tables: + if isinstance(node, sg.exp.Table) and node.name in leaves: return node.__class__( - catalog="tpch", + catalog=f"tpc{suite}", **{k: v for k, v in node.args.items() if k != "catalog"}, ) return node diff --git a/ibis/backends/duckdb/tests/conftest.py b/ibis/backends/duckdb/tests/conftest.py index eff718a2c9a7..4fbaa8069fa5 100644 --- a/ibis/backends/duckdb/tests/conftest.py +++ b/ibis/backends/duckdb/tests/conftest.py @@ -115,42 +115,20 @@ def _load_tpc(self, *, suite, scale_factor): con.con.execute(f"CREATE OR REPLACE SCHEMA {schema}") parquet_dir = self.data_dir.joinpath(schema, f"sf={scale_factor}", "parquet") assert parquet_dir.exists(), parquet_dir - tables = set() for path in parquet_dir.glob("*.parquet"): table_name = path.with_suffix("").name - tables.add(table_name) # duckdb automatically infers the sf= as a hive partition so we # need to disable it con.con.execute( f"CREATE OR REPLACE VIEW {schema}.{table_name} AS " f"FROM read_parquet({str(path)!r}, hive_partitioning=false)" ) - return tables - def load_tpch(self) -> None: - """Load TPC-H data.""" - self.tpch_tables = frozenset(self._load_tpc(suite="h", scale_factor="0.17")) - - def load_tpcds(self) -> None: - """Load TPC-DS data.""" - self.tpcds_tables = frozenset(self._load_tpc(suite="ds", scale_factor="0.2")) - - def _transform_tpch_sql(self, parsed): - def add_catalog_and_schema(node): - if isinstance(node, sg.exp.Table) and node.name in self.tpch_tables: - return node.__class__( - catalog="tpch", - **{k: v for k, v in node.args.items() if k != "catalog"}, - ) - return node - - return parsed.transform(add_catalog_and_schema) - - def _transform_tpcds_sql(self, parsed): + def _transform_tpc_sql(self, parsed, *, suite, leaves): def add_catalog_and_schema(node): - if isinstance(node, sg.exp.Table) and node.name in self.tpcds_tables: + if isinstance(node, sg.exp.Table) and node.name in leaves: return node.__class__( - catalog="tpcds", + catalog=f"tpc{suite}", **{k: v for k, v in node.args.items() if k != "catalog"}, ) return node diff --git a/ibis/backends/snowflake/tests/conftest.py b/ibis/backends/snowflake/tests/conftest.py index 3b74d18a6fdf..4aeb3d8e0dea 100644 --- a/ibis/backends/snowflake/tests/conftest.py +++ b/ibis/backends/snowflake/tests/conftest.py @@ -90,28 +90,47 @@ class TestConf(BackendTest): supports_map = True deps = ("snowflake.connector",) supports_tpch = True + supports_tpcds = True - def load_tpch(self) -> None: - """No-op, snowflake already defines these in `SNOWFLAKE_SAMPLE_DATA`.""" + def _load_tpc(self, *, suite, scale_factor) -> None: + """Create views of data in the TPC-H catalog that ships with Trino. - def h(self, name: str): - name = name.upper() - t = self.connection.table(name, database="SNOWFLAKE_SAMPLE_DATA.TPCH_SF1") - return t.rename("snake_case") + This method create relations that have column names prefixed with the + first one (or two in the case of partsupp -> ps) character table name + to match the DuckDB TPC-H query conventions. + """ + con = self.connection + schema = f"tpc{suite}" + + con.create_database(schema, force=True) + + parquet_dir = self.data_dir.joinpath(schema, f"sf={scale_factor}", "parquet") + assert parquet_dir.exists(), parquet_dir + + tables = frozenset(con.list_tables(database=("IBIS_TESTING", schema))) + for path in parquet_dir.glob("*.parquet"): + table_name = path.with_suffix("").name + if table_name not in tables: + con.create_table( + table_name, + con.read_parquet(path), + database=f'IBIS_TESTING."{schema}"', + ) + + def _transform_tpc_sql(self, parsed, *, suite, leaves): + def quote(node): + if isinstance(node, sg.exp.Identifier): + return sg.to_identifier(node.name, quoted=True) + return node - def _transform_tpch_sql(self, parsed): def add_catalog_and_schema(node): - if isinstance(node, sg.exp.Table): - return node.__class__( - db="TPCH_SF1", - catalog="SNOWFLAKE_SAMPLE_DATA", - **{ - k: v for k, v in node.args.items() if k not in ("db", "catalog") - }, - ) + if isinstance(node, sg.exp.Table) and node.name in leaves: + node.args["db"] = sg.to_identifier(f"tpc{suite}") + node.args["catalog"] = sg.to_identifier("IBIS_TESTING") return node result = parsed.transform(add_catalog_and_schema) + result = result.transform(quote) return result def _load_data(self, **_: Any) -> None: diff --git a/ibis/backends/tests/base.py b/ibis/backends/tests/base.py index 28376b879ba4..52bad316e60f 100644 --- a/ibis/backends/tests/base.py +++ b/ibis/backends/tests/base.py @@ -113,7 +113,7 @@ def name(cls) -> str: def connect(*, tmpdir, worker_id, **kw: Any): """Return a connection with data loaded from `data_dir`.""" - def _transform_tpch_sql(self, parsed): + def _transform_tpc_sql(self, parsed, *, suite, leaves): return parsed def _load_data(self, **_: Any) -> None: @@ -140,6 +140,14 @@ def stateful_load(self, fn, **kw): self.stateless_load(**kw) fn.touch() + def load_tpch(self) -> None: + """Load TPC-H data.""" + self._load_tpc(suite="h", scale_factor="0.17") + + def load_tpcds(self) -> None: + """Load TPC-DS data.""" + self._load_tpc(suite="ds", scale_factor="0.2") + @classmethod def load_data( cls, data_dir: Path, tmpdir: Path, worker_id: str, **kw: Any @@ -314,6 +322,12 @@ def h(self, name: str) -> ir.Table: def ds(self, name: str) -> ir.Table: return self._tpc_table(name, "ds") + def list_tpc_tables(self, suite: Literal["h", "ds"]) -> frozenset[str]: + return frozenset( + path.with_suffix("").name + for path in self.data_dir.joinpath(f"tpc{suite}").rglob("*.parquet") + ) + class ServiceBackendTest(BackendTest): """Parent class to use for backend test configuration if backend requires a diff --git a/ibis/backends/tests/tpc/conftest.py b/ibis/backends/tests/tpc/conftest.py index b7eed9b04229..ce30aaa83ac3 100644 --- a/ibis/backends/tests/tpc/conftest.py +++ b/ibis/backends/tests/tpc/conftest.py @@ -4,7 +4,7 @@ import functools import re from pathlib import Path -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Literal import pytest import sqlglot as sg @@ -20,38 +20,43 @@ def pytest_pyfunc_call(pyfuncitem): - """Inject `backend` and `snapshot` fixtures to all TPC-DS test functions. + """Inject `backend` and fixtures to all TPC-DS test functions. Defining this hook here limits its scope to the TPC-DS tests. """ testfunction = pyfuncitem.obj funcargs = pyfuncitem.funcargs testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames} - result = testfunction( - **testargs, backend=funcargs["backend"], snapshot=funcargs["snapshot"] - ) + result = testfunction(**testargs, backend=funcargs["backend"]) assert ( result is None ), "test function should not return anything, did you mean to use assert?" return True -def tpc_test(suite_name): - def inner(test: Callable[..., ir.Table]): - """Decorator for TPC tests. +def tpc_test(suite_name: Literal["h", "ds"], result_is_empty=False): + """Decorator for TPC tests. + + Parameters + ---------- + suite_name + The name of the TPC suite. Only `'h'` and ~'ds'~ are supported right now. + result_is_empty + If the expected result is an empty table. - Automates the process of loading the SQL query from the file system and - asserting that the result of the ibis expression is equal to the expected - result of executing the raw SQL. - """ + Automates the process of loading the SQL query from the file system and + asserting that the result of the ibis expression is equal to the expected + result of executing the raw SQL. + """ + def inner(test: Callable[..., ir.Table]): name = f"tpc{suite_name}" @getattr(pytest.mark, name) - @pytest.mark.usefixtures("backend", "snapshot") + @pytest.mark.usefixtures("backend") @pytest.mark.xdist_group(name) @functools.wraps(test) - def wrapper(*args, backend, snapshot, **kwargs): + def wrapper(*args, backend, **kwargs): backend_name = backend.name() if not getattr(backend, f"supports_{name}"): pytest.skip( @@ -70,10 +75,9 @@ def wrapper(*args, backend, snapshot, **kwargs): sql = sg.parse_one(raw_sql, read="duckdb") - transform_method = getattr( - backend, f"_transform_{name}_sql", lambda sql: sql + sql = backend._transform_tpc_sql( + sql, suite=suite_name, leaves=backend.list_tpc_tables(suite_name) ) - sql = transform_method(sql) raw_sql = sql.sql(dialect="duckdb", pretty=True) @@ -81,18 +85,16 @@ def wrapper(*args, backend, snapshot, **kwargs): result_expr = test(*args, **kwargs) - ibis_sql = ibis.to_sql(result_expr, dialect=backend_name) - assert result_expr._find_backend(use_default=False) is backend.connection result = backend.connection.to_pandas(result_expr) - assert not result.empty + assert (result_is_empty and result.empty) or not result.empty expected = expected_expr.to_pandas() assert list(map(str.lower, expected.columns)) == result.columns.tolist() expected.columns = result.columns expected = PandasData.convert_table(expected, result_expr.schema()) - assert not expected.empty + assert (result_is_empty and expected.empty) or not expected.empty assert len(expected) == len(result) assert result.columns.tolist() == expected.columns.tolist() @@ -108,9 +110,6 @@ def wrapper(*args, backend, snapshot, **kwargs): == right.values.tolist() ) - # only write sql if the execution passes - snapshot.assert_match(ibis_sql, sql_path_name) - return wrapper return inner diff --git a/ibis/backends/tests/tpc/ds/test_queries.py b/ibis/backends/tests/tpc/ds/test_queries.py new file mode 100644 index 000000000000..7dc3a4e2d83f --- /dev/null +++ b/ibis/backends/tests/tpc/ds/test_queries.py @@ -0,0 +1,1373 @@ +from __future__ import annotations + +import calendar as cal + +import pytest + +from ibis import _, date, ifelse, null +from ibis import literal as lit +from ibis import selectors as s +from ibis.backends.tests.tpc.conftest import tpc_test + + +@tpc_test("ds") +def test_01(store_returns, date_dim, store, customer): + customer_total_return = ( + store_returns.join( + date_dim.filter(_.d_year == 2000), [("sr_returned_date_sk", "d_date_sk")] + ) + .group_by(ctr_customer_sk=_.sr_customer_sk, ctr_store_sk=_.sr_store_sk) + .agg(ctr_total_return=_.sr_return_amt.sum()) + ) + ctr2 = customer_total_return.view() + return ( + customer_total_return.join( + store.filter(_.s_state == "TN"), [("ctr_store_sk", "s_store_sk")] + ) + .join(customer, _.ctr_customer_sk == customer.c_customer_sk) + .filter( + lambda t: t.ctr_total_return + > ctr2.filter(t.ctr_store_sk == ctr2.ctr_store_sk) + .ctr_total_return.mean() + .as_scalar() + * 1.2 + ) + .select(_.c_customer_id) + .order_by(_.c_customer_id) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.broken(["datafusion"], reason="internal error") +def test_02(web_sales, catalog_sales, date_dim): + wscs = web_sales.select( + sold_date_sk=_.ws_sold_date_sk, sales_price=_.ws_ext_sales_price + ).union( + catalog_sales.select( + sold_date_sk=_.cs_sold_date_sk, sales_price=_.cs_ext_sales_price + ) + ) + + # start on Sunday + days = [(i, cal.day_abbr[i].lower(), cal.day_name[i]) for i in range(-1, 6)] + + wswscs = ( + wscs.join(date_dim, _.sold_date_sk == date_dim.d_date_sk) + .group_by(_.d_week_seq) + .agg( + **{ + f"{day_abbr}_sales": _.sales_price.sum(where=_.d_day_name == day_name) + for _i, day_abbr, day_name in days + } + ) + ) + + y = wswscs.join(date_dim.filter(_.d_year == 2001), "d_week_seq").select( + d_week_seq1=wswscs.d_week_seq, + **{c + "1": c for c in wswscs.columns if c.endswith("_sales")}, + ) + z = wswscs.join(date_dim.filter(_.d_year == 2001 + 1), "d_week_seq").select( + d_week_seq2=wswscs.d_week_seq, + **{c + "2": c for c in wswscs.columns if c.endswith("_sales")}, + ) + return ( + y.join(z, y.d_week_seq1 == z.d_week_seq2 - 53) + .select( + _.d_week_seq1, + **{ + f"r{i + 2}": (_[f"{day_abbr}_sales1"] / _[f"{day_abbr}_sales2"]).round( + 2 + ) + for i, day_abbr, _n in days + }, + ) + .order_by(_.d_week_seq1) + ) + + +@tpc_test("ds") +def test_03(date_dim, store_sales, item): + return ( + date_dim.join(store_sales, date_dim.d_date_sk == store_sales.ss_sold_date_sk) + .join(item, store_sales.ss_item_sk == item.i_item_sk) + .filter(_.i_manufact_id == 128, _.d_moy == 11) + .group_by(_.d_year, brand_id=_.i_brand_id, brand=_.i_brand) + .agg(sum_agg=_.ss_ext_sales_price.sum()) + .order_by(_.d_year, _.sum_agg.desc(), _.brand_id) + .limit(100) + ) + + +@tpc_test("ds", result_is_empty=True) +@pytest.mark.broken( + ["datafusion"], reason="Optimizer rule 'common_sub_expression_eliminate' failed" +) +def test_04(customer, store_sales, catalog_sales, web_sales, date_dim): + def profile(sales, *, name): + char = name[0] + prefix = {"w": "ws_bill", "c": "cs_bill", "s": "ss"}[char] + return ( + customer.join( + sales, customer.c_customer_sk == sales[f"{prefix}_customer_sk"] + ) + .join(date_dim, sales[f"{char}s_sold_date_sk"] == date_dim.d_date_sk) + .group_by( + customer_id=_.c_customer_id, + customer_first_name=_.c_first_name, + customer_last_name=_.c_last_name, + customer_preferred_cust_flag=_.c_preferred_cust_flag, + customer_birth_country=_.c_birth_country, + customer_login=_.c_login, + customer_email_address=_.c_email_address, + dyear=_.d_year, + ) + .agg( + year_total=( + ( + ( + _[f"{char}s_ext_list_price"] + - _[f"{char}s_ext_wholesale_cost"] + - _[f"{char}s_ext_discount_amt"] + ) + + _[f"{char}s_ext_sales_price"] + ) + / 2 + ).sum(), + sale_type=lit(char), + ) + ) + + year_total = ( + profile(store_sales, name="store_sales") + .union(profile(catalog_sales, name="catalog_sales")) + .union(profile(web_sales, name="web_sales")) + ) + + t_s_firstyear = year_total.filter( + _.sale_type == "s", _.dyear == 2001, _.year_total > 0 + ) + t_s_secyear = year_total.view().filter(_.sale_type == "s", _.dyear == 2001 + 1) + t_c_firstyear = year_total.view().filter( + _.sale_type == "c", _.dyear == 2001, _.year_total > 0 + ) + t_c_secyear = year_total.view().filter(_.sale_type == "c", _.dyear == 2001 + 1) + t_w_firstyear = year_total.view().filter( + _.sale_type == "w", _.dyear == 2001, _.year_total > 0 + ) + t_w_secyear = year_total.view().filter(_.sale_type == "w", _.dyear == 2001 + 1) + return ( + t_s_firstyear.join(t_s_secyear, "customer_id") + .join(t_c_secyear, t_s_firstyear.customer_id == t_c_secyear.customer_id) + .join( + t_c_firstyear, + [ + t_s_firstyear.customer_id == t_c_firstyear.customer_id, + ifelse( + t_c_firstyear.year_total > 0, + t_c_secyear.year_total / t_c_firstyear.year_total, + null(), + ) + > ifelse( + t_s_firstyear.year_total > 0, + t_s_secyear.year_total / t_s_firstyear.year_total, + null(), + ), + ], + ) + .join(t_w_firstyear, t_s_firstyear.customer_id == t_w_firstyear.customer_id) + .join( + t_w_secyear, + [ + t_s_firstyear.customer_id == t_w_secyear.customer_id, + ifelse( + t_c_firstyear.year_total > 0, + t_c_secyear.year_total / t_c_firstyear.year_total, + null(), + ) + > ifelse( + t_w_firstyear.year_total > 0, + t_w_secyear.year_total / t_w_firstyear.year_total, + null(), + ), + ], + ) + .select( + t_s_secyear.customer_id, + t_s_secyear.customer_first_name, + t_s_secyear.customer_last_name, + t_s_secyear.customer_preferred_cust_flag, + ) + .order_by(s.all()) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.xfail(raises=NotImplementedError, reason="requires rollup") +def test_05( + store_sales, + store_returns, + store, + catalog_sales, + catalog_returns, + catalog_page, + web_sales, + web_returns, + web_site, + date_dim, +): + raise NotImplementedError() + + +@tpc_test("ds") +def test_06(customer_address, customer, store_sales, date_dim, item): + return ( + customer_address.join( + customer, customer_address.ca_address_sk == customer.c_current_addr_sk + ) + .join(store_sales, customer.c_customer_sk == store_sales.ss_customer_sk) + .join(date_dim, store_sales.ss_sold_date_sk == date_dim.d_date_sk) + .join(item, store_sales.ss_item_sk == item.i_item_sk) + .filter( + date_dim.d_month_seq + == ( + date_dim.filter(_.d_year == 2001, _.d_moy == 1) + .select(_.d_month_seq) + .distinct() + .as_scalar() + ), + lambda i: ( + i.i_current_price + > 1.2 + * item.view() + .filter(lambda j: j.i_category == i.i_category) + .agg(lambda j: j.i_current_price.mean()) + .as_scalar() + ), + ) + .group_by(state=_.ca_state) + .having(_.count() >= 10) + .agg(cnt=_.count()) + .order_by(_.cnt, _.state) + .limit(100) + ) + + +@tpc_test("ds") +def test_07(store_sales, customer_demographics, date_dim, item, promotion): + return ( + store_sales.join(date_dim, [("ss_sold_date_sk", "d_date_sk")]) + .join(item, [("ss_item_sk", "i_item_sk")]) + .join(customer_demographics, [("ss_cdemo_sk", "cd_demo_sk")]) + .join(promotion, [("ss_promo_sk", "p_promo_sk")]) + .filter( + _.cd_gender == "M", + _.cd_marital_status == "S", + _.cd_education_status == "College", + ((_.p_channel_email == "N") | (_.p_channel_event == "N")), + _.d_year == 2000, + ) + .group_by(_.i_item_id) + .agg( + agg1=_.ss_quantity.mean(), + agg2=_.ss_list_price.mean(), + agg3=_.ss_coupon_amt.mean(), + agg4=_.ss_sales_price.mean(), + ) + .order_by(_.i_item_id) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.broken( + ["datafusion"], + reason='The left or right side of the join does not have all columns on "on"', +) +def test_08(store_sales, date_dim, store, customer_address, customer): + zip_codes = ( + "24128", + "76232", + "65084", + "87816", + "83926", + "77556", + "20548", + "26231", + "43848", + "15126", + "91137", + "61265", + "98294", + "25782", + "17920", + "18426", + "98235", + "40081", + "84093", + "28577", + "55565", + "17183", + "54601", + "67897", + "22752", + "86284", + "18376", + "38607", + "45200", + "21756", + "29741", + "96765", + "23932", + "89360", + "29839", + "25989", + "28898", + "91068", + "72550", + "10390", + "18845", + "47770", + "82636", + "41367", + "76638", + "86198", + "81312", + "37126", + "39192", + "88424", + "72175", + "81426", + "53672", + "10445", + "42666", + "66864", + "66708", + "41248", + "48583", + "82276", + "18842", + "78890", + "49448", + "14089", + "38122", + "34425", + "79077", + "19849", + "43285", + "39861", + "66162", + "77610", + "13695", + "99543", + "83444", + "83041", + "12305", + "57665", + "68341", + "25003", + "57834", + "62878", + "49130", + "81096", + "18840", + "27700", + "23470", + "50412", + "21195", + "16021", + "76107", + "71954", + "68309", + "18119", + "98359", + "64544", + "10336", + "86379", + "27068", + "39736", + "98569", + "28915", + "24206", + "56529", + "57647", + "54917", + "42961", + "91110", + "63981", + "14922", + "36420", + "23006", + "67467", + "32754", + "30903", + "20260", + "31671", + "51798", + "72325", + "85816", + "68621", + "13955", + "36446", + "41766", + "68806", + "16725", + "15146", + "22744", + "35850", + "88086", + "51649", + "18270", + "52867", + "39972", + "96976", + "63792", + "11376", + "94898", + "13595", + "10516", + "90225", + "58943", + "39371", + "94945", + "28587", + "96576", + "57855", + "28488", + "26105", + "83933", + "25858", + "34322", + "44438", + "73171", + "30122", + "34102", + "22685", + "71256", + "78451", + "54364", + "13354", + "45375", + "40558", + "56458", + "28286", + "45266", + "47305", + "69399", + "83921", + "26233", + "11101", + "15371", + "69913", + "35942", + "15882", + "25631", + "24610", + "44165", + "99076", + "33786", + "70738", + "26653", + "14328", + "72305", + "62496", + "22152", + "10144", + "64147", + "48425", + "14663", + "21076", + "18799", + "30450", + "63089", + "81019", + "68893", + "24996", + "51200", + "51211", + "45692", + "92712", + "70466", + "79994", + "22437", + "25280", + "38935", + "71791", + "73134", + "56571", + "14060", + "19505", + "72425", + "56575", + "74351", + "68786", + "51650", + "20004", + "18383", + "76614", + "11634", + "18906", + "15765", + "41368", + "73241", + "76698", + "78567", + "97189", + "28545", + "76231", + "75691", + "22246", + "51061", + "90578", + "56691", + "68014", + "51103", + "94167", + "57047", + "14867", + "73520", + "15734", + "63435", + "25733", + "35474", + "24676", + "94627", + "53535", + "17879", + "15559", + "53268", + "59166", + "11928", + "59402", + "33282", + "45721", + "43933", + "68101", + "33515", + "36634", + "71286", + "19736", + "58058", + "55253", + "67473", + "41918", + "19515", + "36495", + "19430", + "22351", + "77191", + "91393", + "49156", + "50298", + "87501", + "18652", + "53179", + "18767", + "63193", + "23968", + "65164", + "68880", + "21286", + "72823", + "58470", + "67301", + "13394", + "31016", + "70372", + "67030", + "40604", + "24317", + "45748", + "39127", + "26065", + "77721", + "31029", + "31880", + "60576", + "24671", + "45549", + "13376", + "50016", + "33123", + "19769", + "22927", + "97789", + "46081", + "72151", + "15723", + "46136", + "51949", + "68100", + "96888", + "64528", + "14171", + "79777", + "28709", + "11489", + "25103", + "32213", + "78668", + "22245", + "15798", + "27156", + "37930", + "62971", + "21337", + "51622", + "67853", + "10567", + "38415", + "15455", + "58263", + "42029", + "60279", + "37125", + "56240", + "88190", + "50308", + "26859", + "64457", + "89091", + "82136", + "62377", + "36233", + "63837", + "58078", + "17043", + "30010", + "60099", + "28810", + "98025", + "29178", + "87343", + "73273", + "30469", + "64034", + "39516", + "86057", + "21309", + "90257", + "67875", + "40162", + "11356", + "73650", + "61810", + "72013", + "30431", + "22461", + "19512", + "13375", + "55307", + "30625", + "83849", + "68908", + "26689", + "96451", + "38193", + "46820", + "88885", + "84935", + "69035", + "83144", + "47537", + "56616", + "94983", + "48033", + "69952", + "25486", + "61547", + "27385", + "61860", + "58048", + "56910", + "16807", + "17871", + "35258", + "31387", + "35458", + "35576", + ) + + v1 = ( + customer_address.select(ca_zip=_.ca_zip[:5]) + .filter(_.ca_zip.isin(zip_codes)) + .intersect( + customer_address.join( + customer.filter(_.c_preferred_cust_flag == "Y"), + [("ca_address_sk", "c_current_addr_sk")], + ) + .group_by(_.ca_zip) + .having(_.count() > 10) + .agg() + .select(ca_zip=_.ca_zip[:5]) + ) + ) + return ( + store_sales.join( + date_dim.filter(_.d_qoy == 2, _.d_year == 1998), + [("ss_sold_date_sk", "d_date_sk")], + ) + .join(store, [("ss_store_sk", "s_store_sk")]) + .join(v1, store.s_zip[:2] == v1.ca_zip[:2]) + .group_by(_.s_store_name) + .agg(net_profit=_.ss_net_profit.sum()) + .order_by(_.s_store_name) + ) + + +@tpc_test("ds") +def test_09(store_sales, reason): + return reason.filter(_.r_reason_sk == 1).select( + **{ + f"bucket{b:d}": ifelse( + store_sales.filter(_.ss_quantity.between(lower, upper)).count() > value, + store_sales.filter( + _.ss_quantity.between(lower, upper) + ).ss_ext_discount_amt.mean(), + store_sales.filter( + _.ss_quantity.between(lower, upper) + ).ss_net_paid.mean(), + ) + for b, (lower, upper, value) in enumerate( + ( + (1, 20, 74129), + (21, 40, 122840), + (41, 60, 56580), + (61, 80, 10097), + (81, 100, 165306), + ), + start=1, + ) + } + ) + + +@tpc_test("ds") +@pytest.mark.broken( + ["datafusion"], reason="Exception: Optimizer rule 'scalar_subquery_to_join' failed" +) +def test_10( + customer, + customer_address, + customer_demographics, + store_sales, + date_dim, + web_sales, + catalog_sales, +): + return ( + customer.join(customer_address, [("c_current_addr_sk", "ca_address_sk")]) + .join(customer_demographics, [("c_current_cdemo_sk", "cd_demo_sk")]) + .filter( + _.ca_county.isin( + [ + "Rush County", + "Toole County", + "Jefferson County", + "Dona Ana County", + "La Porte County", + ] + ), + lambda t: ( + store_sales.join(date_dim, [("ss_sold_date_sk", "d_date_sk")]) + .filter( + t.c_customer_sk == store_sales.ss_customer_sk, + _.d_year == 2002, + _.d_moy.between(1, 1 + 3), + ) + .count() + > 0 + ), + lambda t: ( + web_sales.join(date_dim, [("ws_sold_date_sk", "d_date_sk")]) + .filter( + t.c_customer_sk == web_sales.ws_bill_customer_sk, + _.d_year == 2002, + _.d_moy.between(1, 1 + 3), + ) + .count() + > 0 + ) + | ( + catalog_sales.join(date_dim, [("cs_sold_date_sk", "d_date_sk")]) + .filter( + t.c_customer_sk == catalog_sales.cs_ship_customer_sk, + _.d_year == 2002, + _.d_moy.between(1, 1 + 3), + ) + .count() + > 0 + ), + ) + .group_by( + "cd_gender", + "cd_marital_status", + "cd_education_status", + "cd_purchase_estimate", + "cd_credit_rating", + "cd_dep_count", + "cd_dep_employed_count", + "cd_dep_college_count", + ) + .agg({f"cnt{i:d}": _.count() for i in range(1, 7)}) + .select( + "cd_gender", + "cd_marital_status", + "cd_education_status", + "cnt1", + "cd_purchase_estimate", + "cnt2", + "cd_credit_rating", + "cnt3", + "cd_dep_count", + "cnt4", + "cd_dep_employed_count", + "cnt5", + "cd_dep_college_count", + "cnt6", + ) + .order_by(~s.startswith("cnt")) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.broken( + ["datafusion"], + reason="Exception: Optimizer rule 'common_sub_expression_eliminate' failed", +) +def test_11(customer, store_sales, web_sales, date_dim): + def agg(*, sale_type: str, table, join_key): + prefix = f"{sale_type}s" + return ( + customer.join(table, [("c_customer_sk", join_key)]) + .join(date_dim, [(f"{prefix}_sold_date_sk", "d_date_sk")]) + .group_by( + customer_id=_.c_customer_id, + customer_first_name=_.c_first_name, + customer_last_name=_.c_last_name, + customer_preferred_cust_flag=_.c_preferred_cust_flag, + customer_birth_country=_.c_birth_country, + customer_login=_.c_login, + customer_email_address=_.c_email_address, + dyear=_.d_year, + ) + .agg( + year_total=( + _[f"{prefix}_ext_list_price"] - _[f"{prefix}_ext_discount_amt"] + ).sum(), + sale_type=lit(sale_type), + ) + ) + + year_total = agg(sale_type="s", table=store_sales, join_key="ss_customer_sk").union( + agg(sale_type="w", table=web_sales, join_key="ws_bill_customer_sk") + ) + + t_s_firstyear = year_total.view() + t_s_secyear = year_total.view() + t_w_firstyear = year_total.view() + t_w_secyear = year_total.view() + return ( + t_s_firstyear.filter(_.sale_type == "s", _.dyear == 2001, _.year_total > 0) + .join( + t_s_secyear.filter(_.sale_type == "s", _.dyear == 2001 + 1), "customer_id" + ) + .join(t_w_firstyear.filter(_.sale_type == "w", _.dyear == 2001), "customer_id") + .join( + t_w_secyear.filter( + _.sale_type == "w", _.dyear == 2001 + 1, _.year_total > 0 + ), + "customer_id", + ) + .select( + t_s_secyear.customer_id, + t_s_secyear.customer_first_name, + t_s_secyear.customer_last_name, + t_s_secyear.customer_preferred_cust_flag, + w_first_year_total=t_w_firstyear.year_total, + w_sec_year_total=t_w_secyear.year_total, + s_first_year_total=t_s_firstyear.year_total, + s_sec_year_total=t_s_secyear.year_total, + ) + .filter( + ifelse( + _.w_first_year_total > 0, + (_.w_sec_year_total * 1.0000) / _.w_first_year_total, + 0.0, + ) + > ifelse( + _.s_first_year_total > 0, + (_.s_sec_year_total * 1.0000) / _.s_first_year_total, + 0.0, + ) + ) + .drop(s.endswith("_year_total")) + .order_by(s.across(s.all(), _.asc(nulls_first=True))) + .limit(100) + ) + + +@tpc_test("ds") +def test_12(web_sales, item, date_dim): + return ( + web_sales.join(item, [("ws_item_sk", "i_item_sk")]) + .join(date_dim, [("ws_sold_date_sk", "d_date_sk")]) + .filter( + _.i_category.isin(("Sports", "Books", "Home")), + _.d_date.between(date("1999-02-22"), date("1999-03-24")), + ) + .group_by( + _.i_item_id, _.i_item_desc, _.i_category, _.i_class, _.i_current_price + ) + .agg(itemrevenue=_.ws_ext_sales_price.sum()) + .mutate( + revenueratio=_.itemrevenue + * 100.000 + / _.itemrevenue.sum().over(group_by=_.i_class) + ) + .order_by(_.i_category, _.i_class, _.i_item_id, _.i_item_desc, "revenueratio") + .limit(100) + ) + + +@tpc_test("ds") +def test_13( + store_sales, + store, + customer_demographics, + household_demographics, + customer_address, + date_dim, +): + return ( + store_sales.join(store, [("ss_store_sk", "s_store_sk")]) + .join(household_demographics, [("ss_hdemo_sk", "hd_demo_sk")]) + .join(customer_demographics, [("ss_cdemo_sk", "cd_demo_sk")]) + .join(customer_address, [("ss_addr_sk", "ca_address_sk")]) + .join(date_dim, [("ss_sold_date_sk", "d_date_sk")]) + .filter( + _.ca_country == "United States", + _.d_year == 2001, + ( + (_.cd_marital_status == "M") + & (_.cd_education_status == "Advanced Degree") + & _.ss_sales_price.between(100.00, 150.00) + & (_.hd_dep_count == 3) + ) + | ( + (_.cd_marital_status == "S") + & (_.cd_education_status == "College") + & _.ss_sales_price.between(50.00, 100.00) + & (_.hd_dep_count == 1) + ) + | ( + (_.cd_marital_status == "W") + & (_.cd_education_status == "2 yr Degree") + & _.ss_sales_price.between(150.00, 200.00) + & (_.hd_dep_count == 1) + ), + (_.ca_state.isin(("TX", "OH", "TX")) & _.ss_net_profit.between(100, 200)) + | (_.ca_state.isin(("OR", "NM", "KY")) & _.ss_net_profit.between(150, 300)) + | (_.ca_state.isin(("VA", "TX", "MS")) & _.ss_net_profit.between(50, 250)), + ) + .agg( + avg1=_.ss_quantity.mean(), + avg2=_.ss_ext_sales_price.mean(), + avg3=_.ss_ext_wholesale_cost.mean(), + sum1=_.ss_ext_wholesale_cost.sum(), + ) + ) + + +@tpc_test("ds") +@pytest.mark.xfail(raises=NotImplementedError, reason="requires rollup") +def test_14(item, store_sales, date_dim, catalog_sales, web_sales): + raise NotImplementedError() + + +@tpc_test("ds") +def test_15(catalog_sales, customer, customer_address, date_dim): + return ( + catalog_sales.join(customer, [("cs_bill_customer_sk", "c_customer_sk")]) + .join(customer_address, [("c_current_addr_sk", "ca_address_sk")]) + .join(date_dim, [("cs_sold_date_sk", "d_date_sk")]) + .filter( + _.ca_zip[:5].isin( + ( + "85669", + "86197", + "88274", + "83405", + "86475", + "85392", + "85460", + "80348", + "81792", + ) + ) + | _.ca_state.isin(("CA", "WA", "GA")) + | (_.cs_sales_price > 500), + _.d_qoy == 2, + _.d_year == 2001, + ) + .group_by(_.ca_zip) + .agg(total_sales_price=_.cs_sales_price.sum()) + .order_by(_.ca_zip.asc(nulls_first=True)) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.notyet( + ["datafusion"], + reason="Error during planning: Correlated column is not allowed in predicate", +) +def test_16(catalog_sales, date_dim, customer_address, call_center, catalog_returns): + return ( + catalog_sales.join(date_dim, [("cs_ship_date_sk", "d_date_sk")]) + .join(customer_address, [("cs_ship_addr_sk", "ca_address_sk")]) + .join(call_center, [("cs_call_center_sk", "cc_call_center_sk")]) + .filter( + _.d_date.between(date("2002-02-01"), date("2002-04-02")), + _.ca_state == "GA", + _.cc_county == "Williamson County", + lambda t: catalog_sales.filter( + t.cs_order_number == _.cs_order_number, + t.cs_warehouse_sk != _.cs_warehouse_sk, + ).count() + > 0, + lambda t: catalog_returns.filter( + t.cs_order_number == _.cr_order_number + ).count() + == 0, + ) + .agg( + **{ + "order count": _.cs_order_number.nunique(), + "total shipping cost": _.cs_ext_ship_cost.sum(), + "total net profit": _.cs_net_profit.sum(), + } + ) + .order_by(_["order count"]) + .limit(100) + ) + + +@tpc_test("ds", result_is_empty=True) +def test_17(store_sales, store_returns, catalog_sales, date_dim, store, item): + d1 = date_dim + d2 = date_dim.view() + d3 = date_dim.view() + return ( + store_sales.join( + store_returns, + [ + ("ss_customer_sk", "sr_customer_sk"), + ("ss_item_sk", "sr_item_sk"), + ("ss_ticket_number", "sr_ticket_number"), + ], + ) + .join( + catalog_sales, + [("sr_customer_sk", "cs_bill_customer_sk"), ("sr_item_sk", "cs_item_sk")], + ) + .join(item, [("ss_item_sk", "i_item_sk")]) + .join(store, [("ss_store_sk", "s_store_sk")]) + .join( + d1.filter(_.d_quarter_name == "2001Q1").select("d_date_sk"), + [("ss_sold_date_sk", "d_date_sk")], + ) + # ideally we wouldn't need this but an integrity conflict results otherwise + .drop("d_date_sk") + .join( + d2.filter(_.d_quarter_name.isin(("2001Q1", "2001Q2", "2001Q3"))).select( + "d_date_sk" + ), + [("sr_returned_date_sk", "d_date_sk")], + ) + .join( + d3.filter(_.d_quarter_name.isin(("2001Q1", "2001Q2", "2001Q3"))).select( + "d_date_sk" + ), + [("cs_sold_date_sk", "d_date_sk")], + ) + .group_by(_.i_item_id, _.i_item_desc, _.s_state) + .agg( + store_sales_quantitycount=_.ss_quantity.count(), + store_sales_quantityave=_.ss_quantity.mean(), + store_sales_quantitystdev=_.ss_quantity.std(), + store_sales_quantitycov=_.ss_quantity.std() / _.ss_quantity.mean(), + store_returns_quantitycount=_.sr_return_quantity.count(), + store_returns_quantityave=_.sr_return_quantity.mean(), + store_returns_quantitystdev=_.sr_return_quantity.std(), + store_returns_quantitycov=( + _.sr_return_quantity.std() / _.sr_return_quantity.mean() + ), + catalog_sales_quantitycount=_.cs_quantity.count(), + catalog_sales_quantityave=_.cs_quantity.mean(), + catalog_sales_quantitystdev=_.cs_quantity.std(), + catalog_sales_quantitycov=_.cs_quantity.std() / _.cs_quantity.mean(), + ) + .order_by(_.i_item_id, _.i_item_desc, _.s_state) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.xfail(raises=NotImplementedError, reason="requires rollup") +def test_18( + catalog_sales, customer_demographics, customer, customer_address, date_dim, item +): + raise NotImplementedError() + + +@tpc_test("ds") +def test_19(date_dim, store_sales, item, customer, customer_address, store): + return ( + date_dim.join(store_sales, [("d_date_sk", "ss_sold_date_sk")]) + .join(item, [("ss_item_sk", "i_item_sk")]) + .join(customer, [("ss_customer_sk", "c_customer_sk")]) + .join(customer_address, [("c_current_addr_sk", "ca_address_sk")]) + .join(store, [("ss_store_sk", "s_store_sk"), _.ca_zip[:5] != store.s_zip[:5]]) + .filter(_.i_manager_id == 8, _.d_moy == 11, _.d_year == 1998) + .group_by( + brand_id=_.i_brand_id, + brand=_.i_brand, + i_manufact_id=_.i_manufact_id, + i_manufact=_.i_manufact, + ) + .agg(ext_price=_.ss_ext_sales_price.sum()) + .order_by( + _.ext_price.desc(), _.brand, _.brand_id, _.i_manufact_id, _.i_manufact + ) + .limit(100) + ) + + +@tpc_test("ds") +def test_20(catalog_sales, item, date_dim): + return ( + catalog_sales.join( + item.filter(_.i_category.isin(("Sports", "Books", "Home"))), + [("cs_item_sk", "i_item_sk")], + ) + .join( + date_dim.filter(_.d_date.between(date("1999-02-22"), date("1999-03-24"))), + [("cs_sold_date_sk", "d_date_sk")], + ) + .group_by( + _.i_item_id, _.i_item_desc, _.i_category, _.i_class, _.i_current_price + ) + .agg(itemrevenue=_.cs_ext_sales_price.sum()) + .mutate( + revenueratio=( + _.itemrevenue * 100.0000 / _.itemrevenue.sum().over(group_by=_.i_class) + ) + ) + .order_by( + _.i_category.asc(nulls_first=True), + _.i_class.asc(nulls_first=True), + _.i_item_id.asc(nulls_first=True), + _.i_item_desc.asc(nulls_first=True), + _.revenueratio.asc(nulls_first=True), + ) + .limit(100) + ) + + +@tpc_test("ds") +def test_21(inventory, warehouse, item, date_dim): + return ( + inventory.join(warehouse, [("inv_warehouse_sk", "w_warehouse_sk")]) + .join( + item.filter(_.i_current_price.between(0.99, 1.49)), + [("inv_item_sk", "i_item_sk")], + ) + .join( + date_dim.filter(_.d_date.between(date("2000-02-10"), date("2000-04-10"))), + [("inv_date_sk", "d_date_sk")], + ) + .group_by(_.w_warehouse_name, _.i_item_id) + .agg( + inv_before=_.inv_quantity_on_hand.sum(where=_.d_date < date("2000-03-11")), + inv_after=_.inv_quantity_on_hand.sum(where=_.d_date >= date("2000-03-11")), + ) + .filter( + ifelse( + _.inv_before > 0, (_.inv_after * 1.000) / _.inv_before, null() + ).between(2.000 / 3.000, 3.000 / 2.000) + ) + .order_by( + _.w_warehouse_name.asc(nulls_first=True), _.i_item_id.asc(nulls_first=True) + ) + .limit(100) + ) + + +@tpc_test("ds") +@pytest.mark.xfail(raises=NotImplementedError, reason="requires rollup") +def test_22(inventory, date_dim, item): + raise NotImplementedError() + + +@tpc_test("ds") +@pytest.mark.xfail(raises=NotImplementedError, reason="requires rollup") +def test_23(inventory, date_dim, item): + raise NotImplementedError() + + +@tpc_test("ds", result_is_empty=True) +def test_24(store_sales, store_returns, store, item, customer, customer_address): + ssales = ( + store_sales.join( + store_returns, + [("ss_ticket_number", "sr_ticket_number"), ("ss_item_sk", "sr_item_sk")], + ) + .join(store.filter(_.s_market_id == 8), [("ss_store_sk", "s_store_sk")]) + .join(item, [("ss_item_sk", "i_item_sk")]) + .join(customer, [("ss_customer_sk", "c_customer_sk")]) + .join( + customer_address, + [ + ("c_current_addr_sk", "ca_address_sk"), + _.c_birth_country != customer_address.ca_country.upper(), + _.s_zip == customer_address.ca_zip, + ], + ) + .group_by( + _.c_last_name, + _.c_first_name, + _.s_store_name, + _.ca_state, + _.s_state, + _.i_color, + _.i_current_price, + _.i_manager_id, + _.i_units, + _.i_size, + ) + .agg(netpaid=_.ss_net_paid.sum()) + ) + return ( + ssales.filter(_.i_color == "peach") + .group_by(_.c_last_name, _.c_first_name, _.s_store_name) + .having(_.netpaid.sum() > ssales.netpaid.mean().as_scalar() * 0.05) + .agg(paid=_.netpaid.sum()) + .order_by(~s.c("paid")) + ) + + +@tpc_test("ds", result_is_empty=True) +def test_25(store_sales, store_returns, catalog_sales, date_dim, store, item): + date_dim = date_dim.filter(_.d_year == 2001) + return ( + store_sales.join( + store_returns, + [ + ("ss_customer_sk", "sr_customer_sk"), + ("ss_ticket_number", "sr_ticket_number"), + ("ss_item_sk", "sr_item_sk"), + ], + ) + .join(store, [("ss_store_sk", "s_store_sk")]) + .join(item, [("ss_item_sk", "i_item_sk")]) + .join( + catalog_sales, + [("sr_customer_sk", "cs_bill_customer_sk"), ("sr_item_sk", "cs_item_sk")], + ) + .join(date_dim.filter(_.d_moy == 4), [("ss_sold_date_sk", "d_date_sk")]) + .drop(s.startswith("d_")) + .join( + date_dim.view().filter(_.d_moy.between(4, 10)), + [("sr_returned_date_sk", "d_date_sk")], + ) + .join( + date_dim.view().filter(_.d_moy.between(4, 10)), + [("cs_sold_date_sk", "d_date_sk")], + ) + .group_by(_.i_item_id, _.i_item_desc, _.s_store_id, _.s_store_name) + .agg( + store_sales_profit=_.ss_net_profit.sum(), + store_returns_loss=_.sr_net_loss.sum(), + catalog_sales_profit=_.cs_net_profit.sum(), + ) + .order_by(~s.endswith(("profit", "loss"))) + .limit(100) + ) + + +@tpc_test("ds") +def test_26(catalog_sales, customer_demographics, date_dim, item, promotion): + return ( + catalog_sales.join( + date_dim.filter(_.d_year == 2000), [("cs_sold_date_sk", "d_date_sk")] + ) + .join(item, [("cs_item_sk", "i_item_sk")]) + .join( + customer_demographics.filter( + _.cd_gender == "M", + _.cd_marital_status == "S", + _.cd_education_status == "College", + ), + [("cs_bill_cdemo_sk", "cd_demo_sk")], + ) + .join( + promotion.filter((_.p_channel_email == "N") | (_.p_channel_event == "N")), + [("cs_promo_sk", "p_promo_sk")], + ) + .group_by(_.i_item_id) + .agg( + agg1=_.cs_quantity.mean(), + agg2=_.cs_list_price.mean(), + agg3=_.cs_coupon_amt.mean(), + agg4=_.cs_sales_price.mean(), + ) + .order_by(_.i_item_id) + .limit(100) + ) + + +@tpc_test("ds") +def test_27(store_sales, customer_demographics, date_dim, store, item): + results = ( + store_sales.join(customer_demographics, [("ss_cdemo_sk", "cd_demo_sk")]) + .join(date_dim, [("ss_sold_date_sk", "d_date_sk")]) + .join(store, [("ss_store_sk", "s_store_sk")]) + .join(item, [("ss_item_sk", "i_item_sk")]) + .filter( + _.cd_gender == "M", + _.cd_marital_status == "S", + _.cd_education_status == "College", + _.d_year == 2002, + _.s_state == "TN", + ) + .select( + _.i_item_id, + _.s_state, + g_state=lit(0), + agg1=_.ss_quantity, + agg2=_.ss_list_price, + agg3=_.ss_coupon_amt, + agg4=_.ss_sales_price, + ) + ) + return ( + results.group_by(~s.startswith("agg")) + .agg(s.across(s.startswith("agg"), _.mean())) + .union( + results.group_by( + _.i_item_id, s_state=null(store.s_state.type()), g_state=lit(1) + ).agg(s.across(s.startswith("agg"), _.mean())) + ) + .union( + results.group_by( + i_item_id=null(item.i_item_id.type()), + s_state=null(store.s_state.type()), + g_state=lit(1), + ).agg(s.across(s.startswith("agg"), _.mean())) + ) + .order_by(_.i_item_id.asc(nulls_first=True), _.s_state.asc(nulls_first=True)) + .limit(100) + ) diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/datafusion/01.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/datafusion/01.sql deleted file mode 100644 index 7ff549b9bd5c..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/datafusion/01.sql +++ /dev/null @@ -1,57 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t1"."l_returnflag", - "t1"."l_linestatus", - SUM("t1"."l_quantity") AS "sum_qty", - SUM("t1"."l_extendedprice") AS "sum_base_price", - SUM("t1"."l_extendedprice" * ( - 1 - "t1"."l_discount" - )) AS "sum_disc_price", - SUM( - ( - "t1"."l_extendedprice" * ( - 1 - "t1"."l_discount" - ) - ) * ( - "t1"."l_tax" + 1 - ) - ) AS "sum_charge", - AVG("t1"."l_quantity") AS "avg_qty", - AVG("t1"."l_extendedprice") AS "avg_price", - AVG("t1"."l_discount") AS "avg_disc", - COUNT(*) AS "count_order" - FROM ( - SELECT - "t1"."l_orderkey", - "t1"."l_partkey", - "t1"."l_suppkey", - "t1"."l_linenumber", - "t1"."l_quantity", - "t1"."l_extendedprice", - "t1"."l_discount", - "t1"."l_tax", - "t1"."l_shipdate", - "t1"."l_commitdate", - "t1"."l_receiptdate", - "t1"."l_shipinstruct", - "t1"."l_shipmode", - "t1"."l_comment", - "t1"."l_returnflag", - "t1"."l_linestatus" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t0" - WHERE - "t0"."l_shipdate" <= DATE_TRUNC('DAY', '1998-09-02') - ) AS "t1" - ) AS t1 - GROUP BY - "t1"."l_returnflag", - "t1"."l_linestatus" -) AS "t2" -ORDER BY - "t2"."l_returnflag" ASC, - "t2"."l_linestatus" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/duckdb/01.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/duckdb/01.sql deleted file mode 100644 index 1e014dbb77dd..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/duckdb/01.sql +++ /dev/null @@ -1,38 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t1"."l_returnflag", - "t1"."l_linestatus", - SUM("t1"."l_quantity") AS "sum_qty", - SUM("t1"."l_extendedprice") AS "sum_base_price", - SUM("t1"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t1"."l_discount" - )) AS "sum_disc_price", - SUM( - ( - "t1"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t1"."l_discount" - ) - ) * ( - "t1"."l_tax" + CAST(1 AS TINYINT) - ) - ) AS "sum_charge", - AVG("t1"."l_quantity") AS "avg_qty", - AVG("t1"."l_extendedprice") AS "avg_price", - AVG("t1"."l_discount") AS "avg_disc", - COUNT(*) AS "count_order" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t0" - WHERE - "t0"."l_shipdate" <= MAKE_DATE(1998, 9, 2) - ) AS "t1" - GROUP BY - 1, - 2 -) AS "t2" -ORDER BY - "t2"."l_returnflag" ASC, - "t2"."l_linestatus" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/snowflake/01.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/snowflake/01.sql deleted file mode 100644 index 3e31b7a41a5f..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/snowflake/01.sql +++ /dev/null @@ -1,53 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t1"."l_returnflag", - "t1"."l_linestatus", - SUM("t1"."l_quantity") AS "sum_qty", - SUM("t1"."l_extendedprice") AS "sum_base_price", - SUM("t1"."l_extendedprice" * ( - 1 - "t1"."l_discount" - )) AS "sum_disc_price", - SUM( - ( - "t1"."l_extendedprice" * ( - 1 - "t1"."l_discount" - ) - ) * ( - "t1"."l_tax" + 1 - ) - ) AS "sum_charge", - AVG("t1"."l_quantity") AS "avg_qty", - AVG("t1"."l_extendedprice") AS "avg_price", - AVG("t1"."l_discount") AS "avg_disc", - COUNT(*) AS "count_order" - FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - WHERE - "t0"."L_SHIPDATE" <= DATE_FROM_PARTS(1998, 9, 2) - ) AS "t1" - GROUP BY - 1, - 2 -) AS "t2" -ORDER BY - "t2"."l_returnflag" ASC, - "t2"."l_linestatus" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/trino/01.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/trino/01.sql deleted file mode 100644 index 529d665a15fe..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_01/trino/01.sql +++ /dev/null @@ -1,53 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t1"."l_returnflag", - "t1"."l_linestatus", - SUM("t1"."l_quantity") AS "sum_qty", - SUM("t1"."l_extendedprice") AS "sum_base_price", - SUM("t1"."l_extendedprice" * ( - 1 - "t1"."l_discount" - )) AS "sum_disc_price", - SUM( - ( - "t1"."l_extendedprice" * ( - 1 - "t1"."l_discount" - ) - ) * ( - "t1"."l_tax" + 1 - ) - ) AS "sum_charge", - AVG("t1"."l_quantity") AS "avg_qty", - AVG("t1"."l_extendedprice") AS "avg_price", - AVG("t1"."l_discount") AS "avg_disc", - COUNT(*) AS "count_order" - FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - WHERE - "t0"."l_shipdate" <= FROM_ISO8601_DATE('1998-09-02') - ) AS "t1" - GROUP BY - 1, - 2 -) AS "t2" -ORDER BY - "t2"."l_returnflag" ASC, - "t2"."l_linestatus" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/datafusion/02.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/datafusion/02.sql deleted file mode 100644 index c249b7dc1534..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/datafusion/02.sql +++ /dev/null @@ -1,98 +0,0 @@ -SELECT - "t14"."s_acctbal", - "t14"."s_name", - "t14"."n_name", - "t14"."p_partkey", - "t14"."p_mfgr", - "t14"."s_address", - "t14"."s_phone", - "t14"."s_comment" -FROM ( - SELECT - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment", - "t6"."ps_partkey", - "t6"."ps_suppkey", - "t6"."ps_availqty", - "t6"."ps_supplycost", - "t6"."ps_comment", - "t8"."s_suppkey", - "t8"."s_name", - "t8"."s_address", - "t8"."s_nationkey", - "t8"."s_phone", - "t8"."s_acctbal", - "t8"."s_comment", - "t10"."n_nationkey", - "t10"."n_name", - "t10"."n_regionkey", - "t10"."n_comment", - "t12"."r_regionkey", - "t12"."r_name", - "t12"."r_comment" - FROM "tpch"."part" AS "t5" - INNER JOIN "tpch"."partsupp" AS "t6" - ON "t5"."p_partkey" = "t6"."ps_partkey" - INNER JOIN "tpch"."supplier" AS "t8" - ON "t8"."s_suppkey" = "t6"."ps_suppkey" - INNER JOIN "tpch"."nation" AS "t10" - ON "t8"."s_nationkey" = "t10"."n_nationkey" - INNER JOIN "tpch"."region" AS "t12" - ON "t10"."n_regionkey" = "t12"."r_regionkey" -) AS "t14" -WHERE - "t14"."p_size" = 15 - AND "t14"."p_type" LIKE '%BRASS' - AND "t14"."r_name" = 'EUROPE' - AND "t14"."ps_supplycost" = ( - SELECT - MIN("t16"."ps_supplycost") AS "Min(ps_supplycost)" - FROM ( - SELECT - * - FROM ( - SELECT - "t7"."ps_partkey", - "t7"."ps_suppkey", - "t7"."ps_availqty", - "t7"."ps_supplycost", - "t7"."ps_comment", - "t9"."s_suppkey", - "t9"."s_name", - "t9"."s_address", - "t9"."s_nationkey", - "t9"."s_phone", - "t9"."s_acctbal", - "t9"."s_comment", - "t11"."n_nationkey", - "t11"."n_name", - "t11"."n_regionkey", - "t11"."n_comment", - "t13"."r_regionkey", - "t13"."r_name", - "t13"."r_comment" - FROM "tpch"."partsupp" AS "t7" - INNER JOIN "tpch"."supplier" AS "t9" - ON "t9"."s_suppkey" = "t7"."ps_suppkey" - INNER JOIN "tpch"."nation" AS "t11" - ON "t9"."s_nationkey" = "t11"."n_nationkey" - INNER JOIN "tpch"."region" AS "t13" - ON "t11"."n_regionkey" = "t13"."r_regionkey" - ) AS "t15" - WHERE - "t15"."r_name" = 'EUROPE' AND "t14"."p_partkey" = "t15"."ps_partkey" - ) AS "t16" - ) -ORDER BY - "t14"."s_acctbal" DESC NULLS LAST, - "t14"."n_name" ASC, - "t14"."s_name" ASC, - "t14"."p_partkey" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/duckdb/02.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/duckdb/02.sql deleted file mode 100644 index 70bceb0ab53b..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/duckdb/02.sql +++ /dev/null @@ -1,98 +0,0 @@ -SELECT - "t14"."s_acctbal", - "t14"."s_name", - "t14"."n_name", - "t14"."p_partkey", - "t14"."p_mfgr", - "t14"."s_address", - "t14"."s_phone", - "t14"."s_comment" -FROM ( - SELECT - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment", - "t6"."ps_partkey", - "t6"."ps_suppkey", - "t6"."ps_availqty", - "t6"."ps_supplycost", - "t6"."ps_comment", - "t8"."s_suppkey", - "t8"."s_name", - "t8"."s_address", - "t8"."s_nationkey", - "t8"."s_phone", - "t8"."s_acctbal", - "t8"."s_comment", - "t10"."n_nationkey", - "t10"."n_name", - "t10"."n_regionkey", - "t10"."n_comment", - "t12"."r_regionkey", - "t12"."r_name", - "t12"."r_comment" - FROM "tpch"."part" AS "t5" - INNER JOIN "tpch"."partsupp" AS "t6" - ON "t5"."p_partkey" = "t6"."ps_partkey" - INNER JOIN "tpch"."supplier" AS "t8" - ON "t8"."s_suppkey" = "t6"."ps_suppkey" - INNER JOIN "tpch"."nation" AS "t10" - ON "t8"."s_nationkey" = "t10"."n_nationkey" - INNER JOIN "tpch"."region" AS "t12" - ON "t10"."n_regionkey" = "t12"."r_regionkey" -) AS "t14" -WHERE - "t14"."p_size" = CAST(15 AS TINYINT) - AND "t14"."p_type" LIKE '%BRASS' - AND "t14"."r_name" = 'EUROPE' - AND "t14"."ps_supplycost" = ( - SELECT - MIN("t16"."ps_supplycost") AS "Min(ps_supplycost)" - FROM ( - SELECT - * - FROM ( - SELECT - "t7"."ps_partkey", - "t7"."ps_suppkey", - "t7"."ps_availqty", - "t7"."ps_supplycost", - "t7"."ps_comment", - "t9"."s_suppkey", - "t9"."s_name", - "t9"."s_address", - "t9"."s_nationkey", - "t9"."s_phone", - "t9"."s_acctbal", - "t9"."s_comment", - "t11"."n_nationkey", - "t11"."n_name", - "t11"."n_regionkey", - "t11"."n_comment", - "t13"."r_regionkey", - "t13"."r_name", - "t13"."r_comment" - FROM "tpch"."partsupp" AS "t7" - INNER JOIN "tpch"."supplier" AS "t9" - ON "t9"."s_suppkey" = "t7"."ps_suppkey" - INNER JOIN "tpch"."nation" AS "t11" - ON "t9"."s_nationkey" = "t11"."n_nationkey" - INNER JOIN "tpch"."region" AS "t13" - ON "t11"."n_regionkey" = "t13"."r_regionkey" - ) AS "t15" - WHERE - "t15"."r_name" = 'EUROPE' AND "t14"."p_partkey" = "t15"."ps_partkey" - ) AS "t16" - ) -ORDER BY - "t14"."s_acctbal" DESC, - "t14"."n_name" ASC, - "t14"."s_name" ASC, - "t14"."p_partkey" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/snowflake/02.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/snowflake/02.sql deleted file mode 100644 index bb954da312e0..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/snowflake/02.sql +++ /dev/null @@ -1,142 +0,0 @@ -WITH "t9" AS ( - SELECT - "t4"."R_REGIONKEY" AS "r_regionkey", - "t4"."R_NAME" AS "r_name", - "t4"."R_COMMENT" AS "r_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."REGION" AS "t4" -), "t8" AS ( - SELECT - "t3"."N_NATIONKEY" AS "n_nationkey", - "t3"."N_NAME" AS "n_name", - "t3"."N_REGIONKEY" AS "n_regionkey", - "t3"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t3" -), "t7" AS ( - SELECT - "t2"."S_SUPPKEY" AS "s_suppkey", - "t2"."S_NAME" AS "s_name", - "t2"."S_ADDRESS" AS "s_address", - "t2"."S_NATIONKEY" AS "s_nationkey", - "t2"."S_PHONE" AS "s_phone", - "t2"."S_ACCTBAL" AS "s_acctbal", - "t2"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t2" -), "t6" AS ( - SELECT - "t1"."PS_PARTKEY" AS "ps_partkey", - "t1"."PS_SUPPKEY" AS "ps_suppkey", - "t1"."PS_AVAILQTY" AS "ps_availqty", - "t1"."PS_SUPPLYCOST" AS "ps_supplycost", - "t1"."PS_COMMENT" AS "ps_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PARTSUPP" AS "t1" -) -SELECT - "t23"."s_acctbal", - "t23"."s_name", - "t23"."n_name", - "t23"."p_partkey", - "t23"."p_mfgr", - "t23"."s_address", - "t23"."s_phone", - "t23"."s_comment" -FROM ( - SELECT - "t10"."p_partkey", - "t10"."p_name", - "t10"."p_mfgr", - "t10"."p_brand", - "t10"."p_type", - "t10"."p_size", - "t10"."p_container", - "t10"."p_retailprice", - "t10"."p_comment", - "t15"."ps_partkey", - "t15"."ps_suppkey", - "t15"."ps_availqty", - "t15"."ps_supplycost", - "t15"."ps_comment", - "t17"."s_suppkey", - "t17"."s_name", - "t17"."s_address", - "t17"."s_nationkey", - "t17"."s_phone", - "t17"."s_acctbal", - "t17"."s_comment", - "t19"."n_nationkey", - "t19"."n_name", - "t19"."n_regionkey", - "t19"."n_comment", - "t21"."r_regionkey", - "t21"."r_name", - "t21"."r_comment" - FROM ( - SELECT - "t0"."P_PARTKEY" AS "p_partkey", - "t0"."P_NAME" AS "p_name", - "t0"."P_MFGR" AS "p_mfgr", - "t0"."P_BRAND" AS "p_brand", - "t0"."P_TYPE" AS "p_type", - "t0"."P_SIZE" AS "p_size", - "t0"."P_CONTAINER" AS "p_container", - "t0"."P_RETAILPRICE" AS "p_retailprice", - "t0"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t0" - ) AS "t10" - INNER JOIN "t6" AS "t15" - ON "t10"."p_partkey" = "t15"."ps_partkey" - INNER JOIN "t7" AS "t17" - ON "t17"."s_suppkey" = "t15"."ps_suppkey" - INNER JOIN "t8" AS "t19" - ON "t17"."s_nationkey" = "t19"."n_nationkey" - INNER JOIN "t9" AS "t21" - ON "t19"."n_regionkey" = "t21"."r_regionkey" -) AS "t23" -WHERE - "t23"."p_size" = 15 - AND "t23"."p_type" LIKE '%BRASS' - AND "t23"."r_name" = 'EUROPE' - AND "t23"."ps_supplycost" = ( - SELECT - MIN("t25"."ps_supplycost") AS "Min(ps_supplycost)" - FROM ( - SELECT - * - FROM ( - SELECT - "t16"."ps_partkey", - "t16"."ps_suppkey", - "t16"."ps_availqty", - "t16"."ps_supplycost", - "t16"."ps_comment", - "t18"."s_suppkey", - "t18"."s_name", - "t18"."s_address", - "t18"."s_nationkey", - "t18"."s_phone", - "t18"."s_acctbal", - "t18"."s_comment", - "t20"."n_nationkey", - "t20"."n_name", - "t20"."n_regionkey", - "t20"."n_comment", - "t22"."r_regionkey", - "t22"."r_name", - "t22"."r_comment" - FROM "t6" AS "t16" - INNER JOIN "t7" AS "t18" - ON "t18"."s_suppkey" = "t16"."ps_suppkey" - INNER JOIN "t8" AS "t20" - ON "t18"."s_nationkey" = "t20"."n_nationkey" - INNER JOIN "t9" AS "t22" - ON "t20"."n_regionkey" = "t22"."r_regionkey" - ) AS "t24" - WHERE - "t24"."r_name" = 'EUROPE' AND "t23"."p_partkey" = "t24"."ps_partkey" - ) AS "t25" - ) -ORDER BY - "t23"."s_acctbal" DESC NULLS LAST, - "t23"."n_name" ASC, - "t23"."s_name" ASC, - "t23"."p_partkey" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/trino/02.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/trino/02.sql deleted file mode 100644 index 9d1c38fb21a4..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_02/trino/02.sql +++ /dev/null @@ -1,137 +0,0 @@ -WITH "t6" AS ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."region" AS "t4" -), "t5" AS ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t3" -), "t9" AS ( - SELECT - "t2"."s_suppkey", - "t2"."s_name", - "t2"."s_address", - "t2"."s_nationkey", - "t2"."s_phone", - CAST("t2"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t2"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t2" -), "t8" AS ( - SELECT - "t1"."ps_partkey", - "t1"."ps_suppkey", - "t1"."ps_availqty", - CAST("t1"."ps_supplycost" AS DECIMAL(15, 2)) AS "ps_supplycost", - "t1"."ps_comment" - FROM "hive"."ibis_tpch_sf1"."partsupp" AS "t1" -) -SELECT - "t23"."s_acctbal", - "t23"."s_name", - "t23"."n_name", - "t23"."p_partkey", - "t23"."p_mfgr", - "t23"."s_address", - "t23"."s_phone", - "t23"."s_comment" -FROM ( - SELECT - "t12"."p_partkey", - "t12"."p_name", - "t12"."p_mfgr", - "t12"."p_brand", - "t12"."p_type", - "t12"."p_size", - "t12"."p_container", - "t12"."p_retailprice", - "t12"."p_comment", - "t19"."ps_partkey", - "t19"."ps_suppkey", - "t19"."ps_availqty", - "t19"."ps_supplycost", - "t19"."ps_comment", - "t21"."s_suppkey", - "t21"."s_name", - "t21"."s_address", - "t21"."s_nationkey", - "t21"."s_phone", - "t21"."s_acctbal", - "t21"."s_comment", - "t15"."n_nationkey", - "t15"."n_name", - "t15"."n_regionkey", - "t15"."n_comment", - "t17"."r_regionkey", - "t17"."r_name", - "t17"."r_comment" - FROM ( - SELECT - "t0"."p_partkey", - "t0"."p_name", - "t0"."p_mfgr", - "t0"."p_brand", - "t0"."p_type", - "t0"."p_size", - "t0"."p_container", - CAST("t0"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t0"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t0" - ) AS "t12" - INNER JOIN "t8" AS "t19" - ON "t12"."p_partkey" = "t19"."ps_partkey" - INNER JOIN "t9" AS "t21" - ON "t21"."s_suppkey" = "t19"."ps_suppkey" - INNER JOIN "t5" AS "t15" - ON "t21"."s_nationkey" = "t15"."n_nationkey" - INNER JOIN "t6" AS "t17" - ON "t15"."n_regionkey" = "t17"."r_regionkey" -) AS "t23" -WHERE - "t23"."p_size" = 15 - AND "t23"."p_type" LIKE '%BRASS' - AND "t23"."r_name" = 'EUROPE' - AND "t23"."ps_supplycost" = ( - SELECT - MIN("t25"."ps_supplycost") AS "Min(ps_supplycost)" - FROM ( - SELECT - * - FROM ( - SELECT - "t20"."ps_partkey", - "t20"."ps_suppkey", - "t20"."ps_availqty", - "t20"."ps_supplycost", - "t20"."ps_comment", - "t22"."s_suppkey", - "t22"."s_name", - "t22"."s_address", - "t22"."s_nationkey", - "t22"."s_phone", - "t22"."s_acctbal", - "t22"."s_comment", - "t16"."n_nationkey", - "t16"."n_name", - "t16"."n_regionkey", - "t16"."n_comment", - "t18"."r_regionkey", - "t18"."r_name", - "t18"."r_comment" - FROM "t8" AS "t20" - INNER JOIN "t9" AS "t22" - ON "t22"."s_suppkey" = "t20"."ps_suppkey" - INNER JOIN "t5" AS "t16" - ON "t22"."s_nationkey" = "t16"."n_nationkey" - INNER JOIN "t6" AS "t18" - ON "t16"."n_regionkey" = "t18"."r_regionkey" - ) AS "t24" - WHERE - "t24"."r_name" = 'EUROPE' AND "t23"."p_partkey" = "t24"."ps_partkey" - ) AS "t25" - ) -ORDER BY - "t23"."s_acctbal" DESC, - "t23"."n_name" ASC, - "t23"."s_name" ASC, - "t23"."p_partkey" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/datafusion/03.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/datafusion/03.sql deleted file mode 100644 index 3ef4e9466b1a..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/datafusion/03.sql +++ /dev/null @@ -1,107 +0,0 @@ -SELECT - "t8"."l_orderkey", - "t8"."revenue", - "t8"."o_orderdate", - "t8"."o_shippriority" -FROM ( - SELECT - "t7"."l_orderkey", - "t7"."o_orderdate", - "t7"."o_shippriority", - SUM("t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - )) AS "revenue" - FROM ( - SELECT - "t7"."c_custkey", - "t7"."c_name", - "t7"."c_address", - "t7"."c_nationkey", - "t7"."c_phone", - "t7"."c_acctbal", - "t7"."c_mktsegment", - "t7"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_comment", - "t7"."l_partkey", - "t7"."l_suppkey", - "t7"."l_linenumber", - "t7"."l_quantity", - "t7"."l_extendedprice", - "t7"."l_discount", - "t7"."l_tax", - "t7"."l_returnflag", - "t7"."l_linestatus", - "t7"."l_shipdate", - "t7"."l_commitdate", - "t7"."l_receiptdate", - "t7"."l_shipinstruct", - "t7"."l_shipmode", - "t7"."l_comment", - "t7"."l_orderkey", - "t7"."o_orderdate", - "t7"."o_shippriority" - FROM ( - SELECT - * - FROM ( - SELECT - "t3"."c_custkey", - "t3"."c_name", - "t3"."c_address", - "t3"."c_nationkey", - "t3"."c_phone", - "t3"."c_acctbal", - "t3"."c_mktsegment", - "t3"."c_comment", - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_shipmode", - "t5"."l_comment" - FROM "tpch"."customer" AS "t3" - INNER JOIN "tpch"."orders" AS "t4" - ON "t3"."c_custkey" = "t4"."o_custkey" - INNER JOIN "tpch"."lineitem" AS "t5" - ON "t5"."l_orderkey" = "t4"."o_orderkey" - ) AS "t6" - WHERE - "t6"."c_mktsegment" = 'BUILDING' - AND "t6"."o_orderdate" < DATE_TRUNC('DAY', '1995-03-15') - AND "t6"."l_shipdate" > DATE_TRUNC('DAY', '1995-03-15') - ) AS "t7" - ) AS t7 - GROUP BY - "t7"."l_orderkey", - "t7"."o_orderdate", - "t7"."o_shippriority" -) AS "t8" -ORDER BY - "t8"."revenue" DESC NULLS LAST, - "t8"."o_orderdate" ASC -LIMIT 10 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/duckdb/03.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/duckdb/03.sql deleted file mode 100644 index 530ae0904226..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/duckdb/03.sql +++ /dev/null @@ -1,71 +0,0 @@ -SELECT - "t8"."l_orderkey", - "t8"."revenue", - "t8"."o_orderdate", - "t8"."o_shippriority" -FROM ( - SELECT - "t7"."l_orderkey", - "t7"."o_orderdate", - "t7"."o_shippriority", - SUM("t7"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t7"."l_discount" - )) AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t3"."c_custkey", - "t3"."c_name", - "t3"."c_address", - "t3"."c_nationkey", - "t3"."c_phone", - "t3"."c_acctbal", - "t3"."c_mktsegment", - "t3"."c_comment", - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_shipmode", - "t5"."l_comment" - FROM "tpch"."customer" AS "t3" - INNER JOIN "tpch"."orders" AS "t4" - ON "t3"."c_custkey" = "t4"."o_custkey" - INNER JOIN "tpch"."lineitem" AS "t5" - ON "t5"."l_orderkey" = "t4"."o_orderkey" - ) AS "t6" - WHERE - "t6"."c_mktsegment" = 'BUILDING' - AND "t6"."o_orderdate" < MAKE_DATE(1995, 3, 15) - AND "t6"."l_shipdate" > MAKE_DATE(1995, 3, 15) - ) AS "t7" - GROUP BY - 1, - 2, - 3 -) AS "t8" -ORDER BY - "t8"."revenue" DESC, - "t8"."o_orderdate" ASC -LIMIT 10 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/snowflake/03.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/snowflake/03.sql deleted file mode 100644 index 1c42732b80e4..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/snowflake/03.sql +++ /dev/null @@ -1,113 +0,0 @@ -SELECT - "t11"."l_orderkey", - "t11"."revenue", - "t11"."o_orderdate", - "t11"."o_shippriority" -FROM ( - SELECT - "t10"."l_orderkey", - "t10"."o_orderdate", - "t10"."o_shippriority", - SUM("t10"."l_extendedprice" * ( - 1 - "t10"."l_discount" - )) AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."c_custkey", - "t6"."c_name", - "t6"."c_address", - "t6"."c_nationkey", - "t6"."c_phone", - "t6"."c_acctbal", - "t6"."c_mktsegment", - "t6"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderdate", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_shippriority", - "t7"."o_comment", - "t8"."l_orderkey", - "t8"."l_partkey", - "t8"."l_suppkey", - "t8"."l_linenumber", - "t8"."l_quantity", - "t8"."l_extendedprice", - "t8"."l_discount", - "t8"."l_tax", - "t8"."l_returnflag", - "t8"."l_linestatus", - "t8"."l_shipdate", - "t8"."l_commitdate", - "t8"."l_receiptdate", - "t8"."l_shipinstruct", - "t8"."l_shipmode", - "t8"."l_comment" - FROM ( - SELECT - "t0"."C_CUSTKEY" AS "c_custkey", - "t0"."C_NAME" AS "c_name", - "t0"."C_ADDRESS" AS "c_address", - "t0"."C_NATIONKEY" AS "c_nationkey", - "t0"."C_PHONE" AS "c_phone", - "t0"."C_ACCTBAL" AS "c_acctbal", - "t0"."C_MKTSEGMENT" AS "c_mktsegment", - "t0"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t0" - ) AS "t6" - INNER JOIN ( - SELECT - "t1"."O_ORDERKEY" AS "o_orderkey", - "t1"."O_CUSTKEY" AS "o_custkey", - "t1"."O_ORDERSTATUS" AS "o_orderstatus", - "t1"."O_TOTALPRICE" AS "o_totalprice", - "t1"."O_ORDERDATE" AS "o_orderdate", - "t1"."O_ORDERPRIORITY" AS "o_orderpriority", - "t1"."O_CLERK" AS "o_clerk", - "t1"."O_SHIPPRIORITY" AS "o_shippriority", - "t1"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t1" - ) AS "t7" - ON "t6"."c_custkey" = "t7"."o_custkey" - INNER JOIN ( - SELECT - "t2"."L_ORDERKEY" AS "l_orderkey", - "t2"."L_PARTKEY" AS "l_partkey", - "t2"."L_SUPPKEY" AS "l_suppkey", - "t2"."L_LINENUMBER" AS "l_linenumber", - "t2"."L_QUANTITY" AS "l_quantity", - "t2"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t2"."L_DISCOUNT" AS "l_discount", - "t2"."L_TAX" AS "l_tax", - "t2"."L_RETURNFLAG" AS "l_returnflag", - "t2"."L_LINESTATUS" AS "l_linestatus", - "t2"."L_SHIPDATE" AS "l_shipdate", - "t2"."L_COMMITDATE" AS "l_commitdate", - "t2"."L_RECEIPTDATE" AS "l_receiptdate", - "t2"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t2"."L_SHIPMODE" AS "l_shipmode", - "t2"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t2" - ) AS "t8" - ON "t8"."l_orderkey" = "t7"."o_orderkey" - ) AS "t9" - WHERE - "t9"."c_mktsegment" = 'BUILDING' - AND "t9"."o_orderdate" < DATE_FROM_PARTS(1995, 3, 15) - AND "t9"."l_shipdate" > DATE_FROM_PARTS(1995, 3, 15) - ) AS "t10" - GROUP BY - 1, - 2, - 3 -) AS "t11" -ORDER BY - "t11"."revenue" DESC NULLS LAST, - "t11"."o_orderdate" ASC -LIMIT 10 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/trino/03.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/trino/03.sql deleted file mode 100644 index 23b38915c4e3..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_03/trino/03.sql +++ /dev/null @@ -1,113 +0,0 @@ -SELECT - "t11"."l_orderkey", - "t11"."revenue", - "t11"."o_orderdate", - "t11"."o_shippriority" -FROM ( - SELECT - "t10"."l_orderkey", - "t10"."o_orderdate", - "t10"."o_shippriority", - SUM("t10"."l_extendedprice" * ( - 1 - "t10"."l_discount" - )) AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."c_custkey", - "t6"."c_name", - "t6"."c_address", - "t6"."c_nationkey", - "t6"."c_phone", - "t6"."c_acctbal", - "t6"."c_mktsegment", - "t6"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderdate", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_shippriority", - "t7"."o_comment", - "t8"."l_orderkey", - "t8"."l_partkey", - "t8"."l_suppkey", - "t8"."l_linenumber", - "t8"."l_quantity", - "t8"."l_extendedprice", - "t8"."l_discount", - "t8"."l_tax", - "t8"."l_returnflag", - "t8"."l_linestatus", - "t8"."l_shipdate", - "t8"."l_commitdate", - "t8"."l_receiptdate", - "t8"."l_shipinstruct", - "t8"."l_shipmode", - "t8"."l_comment" - FROM ( - SELECT - "t0"."c_custkey", - "t0"."c_name", - "t0"."c_address", - "t0"."c_nationkey", - "t0"."c_phone", - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t0"."c_mktsegment", - "t0"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t0" - ) AS "t6" - INNER JOIN ( - SELECT - "t1"."o_orderkey", - "t1"."o_custkey", - "t1"."o_orderstatus", - CAST("t1"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t1"."o_orderdate", - "t1"."o_orderpriority", - "t1"."o_clerk", - "t1"."o_shippriority", - "t1"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t1" - ) AS "t7" - ON "t6"."c_custkey" = "t7"."o_custkey" - INNER JOIN ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - CAST("t2"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t2"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t2"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t2"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t2" - ) AS "t8" - ON "t8"."l_orderkey" = "t7"."o_orderkey" - ) AS "t9" - WHERE - "t9"."c_mktsegment" = 'BUILDING' - AND "t9"."o_orderdate" < FROM_ISO8601_DATE('1995-03-15') - AND "t9"."l_shipdate" > FROM_ISO8601_DATE('1995-03-15') - ) AS "t10" - GROUP BY - 1, - 2, - 3 -) AS "t11" -ORDER BY - "t11"."revenue" DESC, - "t11"."o_orderdate" ASC -LIMIT 10 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/datafusion/04.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/datafusion/04.sql deleted file mode 100644 index 015deb5f3625..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/datafusion/04.sql +++ /dev/null @@ -1,43 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t3"."o_orderpriority", - COUNT(*) AS "order_count" - FROM ( - SELECT - "t3"."o_orderkey", - "t3"."o_custkey", - "t3"."o_orderstatus", - "t3"."o_totalprice", - "t3"."o_orderdate", - "t3"."o_clerk", - "t3"."o_shippriority", - "t3"."o_comment", - "t3"."o_orderpriority" - FROM ( - SELECT - * - FROM "tpch"."orders" AS "t0" - WHERE - EXISTS( - SELECT - 1 - FROM "tpch"."lineitem" AS "t1" - WHERE - ( - "t1"."l_orderkey" = "t0"."o_orderkey" - ) - AND ( - "t1"."l_commitdate" < "t1"."l_receiptdate" - ) - ) - AND "t0"."o_orderdate" >= DATE_TRUNC('DAY', '1993-07-01') - AND "t0"."o_orderdate" < DATE_TRUNC('DAY', '1993-10-01') - ) AS "t3" - ) AS t3 - GROUP BY - "t3"."o_orderpriority" -) AS "t4" -ORDER BY - "t4"."o_orderpriority" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/duckdb/04.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/duckdb/04.sql deleted file mode 100644 index 6f8ec9982981..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/duckdb/04.sql +++ /dev/null @@ -1,31 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t3"."o_orderpriority", - COUNT(*) AS "order_count" - FROM ( - SELECT - * - FROM "tpch"."orders" AS "t0" - WHERE - EXISTS( - SELECT - 1 - FROM "tpch"."lineitem" AS "t1" - WHERE - ( - "t1"."l_orderkey" = "t0"."o_orderkey" - ) - AND ( - "t1"."l_commitdate" < "t1"."l_receiptdate" - ) - ) - AND "t0"."o_orderdate" >= MAKE_DATE(1993, 7, 1) - AND "t0"."o_orderdate" < MAKE_DATE(1993, 10, 1) - ) AS "t3" - GROUP BY - 1 -) AS "t4" -ORDER BY - "t4"."o_orderpriority" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/snowflake/04.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/snowflake/04.sql deleted file mode 100644 index a566f18e3f84..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/snowflake/04.sql +++ /dev/null @@ -1,43 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t4"."o_orderpriority", - COUNT(*) AS "order_count" - FROM ( - SELECT - * - FROM ( - SELECT - "t0"."O_ORDERKEY" AS "o_orderkey", - "t0"."O_CUSTKEY" AS "o_custkey", - "t0"."O_ORDERSTATUS" AS "o_orderstatus", - "t0"."O_TOTALPRICE" AS "o_totalprice", - "t0"."O_ORDERDATE" AS "o_orderdate", - "t0"."O_ORDERPRIORITY" AS "o_orderpriority", - "t0"."O_CLERK" AS "o_clerk", - "t0"."O_SHIPPRIORITY" AS "o_shippriority", - "t0"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t0" - ) AS "t2" - WHERE - EXISTS( - SELECT - 1 - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t1" - WHERE - ( - "t1"."L_ORDERKEY" = "t2"."o_orderkey" - ) - AND ( - "t1"."L_COMMITDATE" < "t1"."L_RECEIPTDATE" - ) - ) - AND "t2"."o_orderdate" >= DATE_FROM_PARTS(1993, 7, 1) - AND "t2"."o_orderdate" < DATE_FROM_PARTS(1993, 10, 1) - ) AS "t4" - GROUP BY - 1 -) AS "t5" -ORDER BY - "t5"."o_orderpriority" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/trino/04.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/trino/04.sql deleted file mode 100644 index 0f5683088a4a..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_04/trino/04.sql +++ /dev/null @@ -1,43 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t4"."o_orderpriority", - COUNT(*) AS "order_count" - FROM ( - SELECT - * - FROM ( - SELECT - "t0"."o_orderkey", - "t0"."o_custkey", - "t0"."o_orderstatus", - CAST("t0"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t0"."o_orderdate", - "t0"."o_orderpriority", - "t0"."o_clerk", - "t0"."o_shippriority", - "t0"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t0" - ) AS "t2" - WHERE - EXISTS( - SELECT - 1 - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t1" - WHERE - ( - "t1"."l_orderkey" = "t2"."o_orderkey" - ) - AND ( - "t1"."l_commitdate" < "t1"."l_receiptdate" - ) - ) - AND "t2"."o_orderdate" >= FROM_ISO8601_DATE('1993-07-01') - AND "t2"."o_orderdate" < FROM_ISO8601_DATE('1993-10-01') - ) AS "t4" - GROUP BY - 1 -) AS "t5" -ORDER BY - "t5"."o_orderpriority" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/datafusion/05.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/datafusion/05.sql deleted file mode 100644 index 199587fb3bf8..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/datafusion/05.sql +++ /dev/null @@ -1,133 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t13"."n_name", - SUM("t13"."l_extendedprice" * ( - 1 - "t13"."l_discount" - )) AS "revenue" - FROM ( - SELECT - "t13"."c_custkey", - "t13"."c_name", - "t13"."c_address", - "t13"."c_nationkey", - "t13"."c_phone", - "t13"."c_acctbal", - "t13"."c_mktsegment", - "t13"."c_comment", - "t13"."o_orderkey", - "t13"."o_custkey", - "t13"."o_orderstatus", - "t13"."o_totalprice", - "t13"."o_orderdate", - "t13"."o_orderpriority", - "t13"."o_clerk", - "t13"."o_shippriority", - "t13"."o_comment", - "t13"."l_orderkey", - "t13"."l_partkey", - "t13"."l_suppkey", - "t13"."l_linenumber", - "t13"."l_quantity", - "t13"."l_extendedprice", - "t13"."l_discount", - "t13"."l_tax", - "t13"."l_returnflag", - "t13"."l_linestatus", - "t13"."l_shipdate", - "t13"."l_commitdate", - "t13"."l_receiptdate", - "t13"."l_shipinstruct", - "t13"."l_shipmode", - "t13"."l_comment", - "t13"."s_suppkey", - "t13"."s_name", - "t13"."s_address", - "t13"."s_nationkey", - "t13"."s_phone", - "t13"."s_acctbal", - "t13"."s_comment", - "t13"."n_nationkey", - "t13"."n_regionkey", - "t13"."n_comment", - "t13"."r_regionkey", - "t13"."r_name", - "t13"."r_comment", - "t13"."n_name" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."c_custkey", - "t6"."c_name", - "t6"."c_address", - "t6"."c_nationkey", - "t6"."c_phone", - "t6"."c_acctbal", - "t6"."c_mktsegment", - "t6"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderdate", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_shippriority", - "t7"."o_comment", - "t8"."l_orderkey", - "t8"."l_partkey", - "t8"."l_suppkey", - "t8"."l_linenumber", - "t8"."l_quantity", - "t8"."l_extendedprice", - "t8"."l_discount", - "t8"."l_tax", - "t8"."l_returnflag", - "t8"."l_linestatus", - "t8"."l_shipdate", - "t8"."l_commitdate", - "t8"."l_receiptdate", - "t8"."l_shipinstruct", - "t8"."l_shipmode", - "t8"."l_comment", - "t9"."s_suppkey", - "t9"."s_name", - "t9"."s_address", - "t9"."s_nationkey", - "t9"."s_phone", - "t9"."s_acctbal", - "t9"."s_comment", - "t10"."n_nationkey", - "t10"."n_name", - "t10"."n_regionkey", - "t10"."n_comment", - "t11"."r_regionkey", - "t11"."r_name", - "t11"."r_comment" - FROM "tpch"."customer" AS "t6" - INNER JOIN "tpch"."orders" AS "t7" - ON "t6"."c_custkey" = "t7"."o_custkey" - INNER JOIN "tpch"."lineitem" AS "t8" - ON "t8"."l_orderkey" = "t7"."o_orderkey" - INNER JOIN "tpch"."supplier" AS "t9" - ON "t8"."l_suppkey" = "t9"."s_suppkey" - INNER JOIN "tpch"."nation" AS "t10" - ON "t6"."c_nationkey" = "t9"."s_nationkey" - AND "t9"."s_nationkey" = "t10"."n_nationkey" - INNER JOIN "tpch"."region" AS "t11" - ON "t10"."n_regionkey" = "t11"."r_regionkey" - ) AS "t12" - WHERE - "t12"."r_name" = 'ASIA' - AND "t12"."o_orderdate" >= DATE_TRUNC('DAY', '1994-01-01') - AND "t12"."o_orderdate" < DATE_TRUNC('DAY', '1995-01-01') - ) AS "t13" - ) AS t13 - GROUP BY - "t13"."n_name" -) AS "t14" -ORDER BY - "t14"."revenue" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/duckdb/05.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/duckdb/05.sql deleted file mode 100644 index bb401f0af870..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/duckdb/05.sql +++ /dev/null @@ -1,83 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t13"."n_name", - SUM("t13"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t13"."l_discount" - )) AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."c_custkey", - "t6"."c_name", - "t6"."c_address", - "t6"."c_nationkey", - "t6"."c_phone", - "t6"."c_acctbal", - "t6"."c_mktsegment", - "t6"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderdate", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_shippriority", - "t7"."o_comment", - "t8"."l_orderkey", - "t8"."l_partkey", - "t8"."l_suppkey", - "t8"."l_linenumber", - "t8"."l_quantity", - "t8"."l_extendedprice", - "t8"."l_discount", - "t8"."l_tax", - "t8"."l_returnflag", - "t8"."l_linestatus", - "t8"."l_shipdate", - "t8"."l_commitdate", - "t8"."l_receiptdate", - "t8"."l_shipinstruct", - "t8"."l_shipmode", - "t8"."l_comment", - "t9"."s_suppkey", - "t9"."s_name", - "t9"."s_address", - "t9"."s_nationkey", - "t9"."s_phone", - "t9"."s_acctbal", - "t9"."s_comment", - "t10"."n_nationkey", - "t10"."n_name", - "t10"."n_regionkey", - "t10"."n_comment", - "t11"."r_regionkey", - "t11"."r_name", - "t11"."r_comment" - FROM "tpch"."customer" AS "t6" - INNER JOIN "tpch"."orders" AS "t7" - ON "t6"."c_custkey" = "t7"."o_custkey" - INNER JOIN "tpch"."lineitem" AS "t8" - ON "t8"."l_orderkey" = "t7"."o_orderkey" - INNER JOIN "tpch"."supplier" AS "t9" - ON "t8"."l_suppkey" = "t9"."s_suppkey" - INNER JOIN "tpch"."nation" AS "t10" - ON "t6"."c_nationkey" = "t9"."s_nationkey" - AND "t9"."s_nationkey" = "t10"."n_nationkey" - INNER JOIN "tpch"."region" AS "t11" - ON "t10"."n_regionkey" = "t11"."r_regionkey" - ) AS "t12" - WHERE - "t12"."r_name" = 'ASIA' - AND "t12"."o_orderdate" >= MAKE_DATE(1994, 1, 1) - AND "t12"."o_orderdate" < MAKE_DATE(1995, 1, 1) - ) AS "t13" - GROUP BY - 1 -) AS "t14" -ORDER BY - "t14"."revenue" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/snowflake/05.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/snowflake/05.sql deleted file mode 100644 index ff865b69a66d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/snowflake/05.sql +++ /dev/null @@ -1,148 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t19"."n_name", - SUM("t19"."l_extendedprice" * ( - 1 - "t19"."l_discount" - )) AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t12"."c_custkey", - "t12"."c_name", - "t12"."c_address", - "t12"."c_nationkey", - "t12"."c_phone", - "t12"."c_acctbal", - "t12"."c_mktsegment", - "t12"."c_comment", - "t13"."o_orderkey", - "t13"."o_custkey", - "t13"."o_orderstatus", - "t13"."o_totalprice", - "t13"."o_orderdate", - "t13"."o_orderpriority", - "t13"."o_clerk", - "t13"."o_shippriority", - "t13"."o_comment", - "t14"."l_orderkey", - "t14"."l_partkey", - "t14"."l_suppkey", - "t14"."l_linenumber", - "t14"."l_quantity", - "t14"."l_extendedprice", - "t14"."l_discount", - "t14"."l_tax", - "t14"."l_returnflag", - "t14"."l_linestatus", - "t14"."l_shipdate", - "t14"."l_commitdate", - "t14"."l_receiptdate", - "t14"."l_shipinstruct", - "t14"."l_shipmode", - "t14"."l_comment", - "t15"."s_suppkey", - "t15"."s_name", - "t15"."s_address", - "t15"."s_nationkey", - "t15"."s_phone", - "t15"."s_acctbal", - "t15"."s_comment", - "t16"."n_nationkey", - "t16"."n_name", - "t16"."n_regionkey", - "t16"."n_comment", - "t17"."r_regionkey", - "t17"."r_name", - "t17"."r_comment" - FROM ( - SELECT - "t0"."C_CUSTKEY" AS "c_custkey", - "t0"."C_NAME" AS "c_name", - "t0"."C_ADDRESS" AS "c_address", - "t0"."C_NATIONKEY" AS "c_nationkey", - "t0"."C_PHONE" AS "c_phone", - "t0"."C_ACCTBAL" AS "c_acctbal", - "t0"."C_MKTSEGMENT" AS "c_mktsegment", - "t0"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t0" - ) AS "t12" - INNER JOIN ( - SELECT - "t1"."O_ORDERKEY" AS "o_orderkey", - "t1"."O_CUSTKEY" AS "o_custkey", - "t1"."O_ORDERSTATUS" AS "o_orderstatus", - "t1"."O_TOTALPRICE" AS "o_totalprice", - "t1"."O_ORDERDATE" AS "o_orderdate", - "t1"."O_ORDERPRIORITY" AS "o_orderpriority", - "t1"."O_CLERK" AS "o_clerk", - "t1"."O_SHIPPRIORITY" AS "o_shippriority", - "t1"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t1" - ) AS "t13" - ON "t12"."c_custkey" = "t13"."o_custkey" - INNER JOIN ( - SELECT - "t2"."L_ORDERKEY" AS "l_orderkey", - "t2"."L_PARTKEY" AS "l_partkey", - "t2"."L_SUPPKEY" AS "l_suppkey", - "t2"."L_LINENUMBER" AS "l_linenumber", - "t2"."L_QUANTITY" AS "l_quantity", - "t2"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t2"."L_DISCOUNT" AS "l_discount", - "t2"."L_TAX" AS "l_tax", - "t2"."L_RETURNFLAG" AS "l_returnflag", - "t2"."L_LINESTATUS" AS "l_linestatus", - "t2"."L_SHIPDATE" AS "l_shipdate", - "t2"."L_COMMITDATE" AS "l_commitdate", - "t2"."L_RECEIPTDATE" AS "l_receiptdate", - "t2"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t2"."L_SHIPMODE" AS "l_shipmode", - "t2"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t2" - ) AS "t14" - ON "t14"."l_orderkey" = "t13"."o_orderkey" - INNER JOIN ( - SELECT - "t3"."S_SUPPKEY" AS "s_suppkey", - "t3"."S_NAME" AS "s_name", - "t3"."S_ADDRESS" AS "s_address", - "t3"."S_NATIONKEY" AS "s_nationkey", - "t3"."S_PHONE" AS "s_phone", - "t3"."S_ACCTBAL" AS "s_acctbal", - "t3"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t3" - ) AS "t15" - ON "t14"."l_suppkey" = "t15"."s_suppkey" - INNER JOIN ( - SELECT - "t4"."N_NATIONKEY" AS "n_nationkey", - "t4"."N_NAME" AS "n_name", - "t4"."N_REGIONKEY" AS "n_regionkey", - "t4"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t4" - ) AS "t16" - ON "t12"."c_nationkey" = "t15"."s_nationkey" - AND "t15"."s_nationkey" = "t16"."n_nationkey" - INNER JOIN ( - SELECT - "t5"."R_REGIONKEY" AS "r_regionkey", - "t5"."R_NAME" AS "r_name", - "t5"."R_COMMENT" AS "r_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."REGION" AS "t5" - ) AS "t17" - ON "t16"."n_regionkey" = "t17"."r_regionkey" - ) AS "t18" - WHERE - "t18"."r_name" = 'ASIA' - AND "t18"."o_orderdate" >= DATE_FROM_PARTS(1994, 1, 1) - AND "t18"."o_orderdate" < DATE_FROM_PARTS(1995, 1, 1) - ) AS "t19" - GROUP BY - 1 -) AS "t20" -ORDER BY - "t20"."revenue" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/trino/05.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/trino/05.sql deleted file mode 100644 index a5f8d07a7c7d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_05/trino/05.sql +++ /dev/null @@ -1,143 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t19"."n_name", - SUM("t19"."l_extendedprice" * ( - 1 - "t19"."l_discount" - )) AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t14"."c_custkey", - "t14"."c_name", - "t14"."c_address", - "t14"."c_nationkey", - "t14"."c_phone", - "t14"."c_acctbal", - "t14"."c_mktsegment", - "t14"."c_comment", - "t15"."o_orderkey", - "t15"."o_custkey", - "t15"."o_orderstatus", - "t15"."o_totalprice", - "t15"."o_orderdate", - "t15"."o_orderpriority", - "t15"."o_clerk", - "t15"."o_shippriority", - "t15"."o_comment", - "t16"."l_orderkey", - "t16"."l_partkey", - "t16"."l_suppkey", - "t16"."l_linenumber", - "t16"."l_quantity", - "t16"."l_extendedprice", - "t16"."l_discount", - "t16"."l_tax", - "t16"."l_returnflag", - "t16"."l_linestatus", - "t16"."l_shipdate", - "t16"."l_commitdate", - "t16"."l_receiptdate", - "t16"."l_shipinstruct", - "t16"."l_shipmode", - "t16"."l_comment", - "t17"."s_suppkey", - "t17"."s_name", - "t17"."s_address", - "t17"."s_nationkey", - "t17"."s_phone", - "t17"."s_acctbal", - "t17"."s_comment", - "t12"."n_nationkey", - "t12"."n_name", - "t12"."n_regionkey", - "t12"."n_comment", - "t13"."r_regionkey", - "t13"."r_name", - "t13"."r_comment" - FROM ( - SELECT - "t0"."c_custkey", - "t0"."c_name", - "t0"."c_address", - "t0"."c_nationkey", - "t0"."c_phone", - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t0"."c_mktsegment", - "t0"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t0" - ) AS "t14" - INNER JOIN ( - SELECT - "t1"."o_orderkey", - "t1"."o_custkey", - "t1"."o_orderstatus", - CAST("t1"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t1"."o_orderdate", - "t1"."o_orderpriority", - "t1"."o_clerk", - "t1"."o_shippriority", - "t1"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t1" - ) AS "t15" - ON "t14"."c_custkey" = "t15"."o_custkey" - INNER JOIN ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - CAST("t2"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t2"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t2"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t2"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t2" - ) AS "t16" - ON "t16"."l_orderkey" = "t15"."o_orderkey" - INNER JOIN ( - SELECT - "t3"."s_suppkey", - "t3"."s_name", - "t3"."s_address", - "t3"."s_nationkey", - "t3"."s_phone", - CAST("t3"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t3"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t3" - ) AS "t17" - ON "t16"."l_suppkey" = "t17"."s_suppkey" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t4" - ) AS "t12" - ON "t14"."c_nationkey" = "t17"."s_nationkey" - AND "t17"."s_nationkey" = "t12"."n_nationkey" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."region" AS "t5" - ) AS "t13" - ON "t12"."n_regionkey" = "t13"."r_regionkey" - ) AS "t18" - WHERE - "t18"."r_name" = 'ASIA' - AND "t18"."o_orderdate" >= FROM_ISO8601_DATE('1994-01-01') - AND "t18"."o_orderdate" < FROM_ISO8601_DATE('1995-01-01') - ) AS "t19" - GROUP BY - 1 -) AS "t20" -ORDER BY - "t20"."revenue" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/datafusion/06.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/datafusion/06.sql deleted file mode 100644 index 8ecb2ecd8b50..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/datafusion/06.sql +++ /dev/null @@ -1,12 +0,0 @@ -SELECT - SUM("t1"."l_extendedprice" * "t1"."l_discount") AS "revenue" -FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t0" - WHERE - "t0"."l_shipdate" >= DATE_TRUNC('DAY', '1994-01-01') - AND "t0"."l_shipdate" < DATE_TRUNC('DAY', '1995-01-01') - AND "t0"."l_discount" BETWEEN 0.05 AND 0.07 - AND "t0"."l_quantity" < 24 -) AS "t1" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/duckdb/06.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/duckdb/06.sql deleted file mode 100644 index f80fd1c26c5e..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/duckdb/06.sql +++ /dev/null @@ -1,12 +0,0 @@ -SELECT - SUM("t1"."l_extendedprice" * "t1"."l_discount") AS "revenue" -FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t0" - WHERE - "t0"."l_shipdate" >= MAKE_DATE(1994, 1, 1) - AND "t0"."l_shipdate" < MAKE_DATE(1995, 1, 1) - AND "t0"."l_discount" BETWEEN CAST(0.05 AS DOUBLE) AND CAST(0.07 AS DOUBLE) - AND "t0"."l_quantity" < CAST(24 AS TINYINT) -) AS "t1" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/snowflake/06.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/snowflake/06.sql deleted file mode 100644 index e2f8ef6be299..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/snowflake/06.sql +++ /dev/null @@ -1,27 +0,0 @@ -SELECT - SUM("t1"."l_extendedprice" * "t1"."l_discount") AS "revenue" -FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - WHERE - "t0"."L_SHIPDATE" >= DATE_FROM_PARTS(1994, 1, 1) - AND "t0"."L_SHIPDATE" < DATE_FROM_PARTS(1995, 1, 1) - AND "t0"."L_DISCOUNT" BETWEEN 0.05 AND 0.07 - AND "t0"."L_QUANTITY" < 24 -) AS "t1" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/trino/06.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/trino/06.sql deleted file mode 100644 index 6a305767d50f..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_06/trino/06.sql +++ /dev/null @@ -1,27 +0,0 @@ -SELECT - SUM("t1"."l_extendedprice" * "t1"."l_discount") AS "revenue" -FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - WHERE - "t0"."l_shipdate" >= FROM_ISO8601_DATE('1994-01-01') - AND "t0"."l_shipdate" < FROM_ISO8601_DATE('1995-01-01') - AND CAST("t0"."l_discount" AS DECIMAL(15, 2)) BETWEEN CAST(0.05 AS DOUBLE) AND CAST(0.07 AS DOUBLE) - AND CAST("t0"."l_quantity" AS DECIMAL(15, 2)) < 24 -) AS "t1" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/datafusion/07.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/datafusion/07.sql deleted file mode 100644 index d23de91bed33..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/datafusion/07.sql +++ /dev/null @@ -1,72 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t12"."supp_nation", - "t12"."cust_nation", - "t12"."l_year", - SUM("t12"."volume") AS "revenue" - FROM ( - SELECT - "t12"."l_shipdate", - "t12"."l_extendedprice", - "t12"."l_discount", - "t12"."volume", - "t12"."supp_nation", - "t12"."cust_nation", - "t12"."l_year" - FROM ( - SELECT - * - FROM ( - SELECT - "t9"."n_name" AS "supp_nation", - "t10"."n_name" AS "cust_nation", - "t6"."l_shipdate", - "t6"."l_extendedprice", - "t6"."l_discount", - DATE_PART('year', "t6"."l_shipdate") AS "l_year", - "t6"."l_extendedprice" * ( - 1 - "t6"."l_discount" - ) AS "volume" - FROM "tpch"."supplier" AS "t5" - INNER JOIN "tpch"."lineitem" AS "t6" - ON "t5"."s_suppkey" = "t6"."l_suppkey" - INNER JOIN "tpch"."orders" AS "t7" - ON "t7"."o_orderkey" = "t6"."l_orderkey" - INNER JOIN "tpch"."customer" AS "t8" - ON "t8"."c_custkey" = "t7"."o_custkey" - INNER JOIN "tpch"."nation" AS "t9" - ON "t5"."s_nationkey" = "t9"."n_nationkey" - INNER JOIN "tpch"."nation" AS "t10" - ON "t8"."c_nationkey" = "t10"."n_nationkey" - ) AS "t11" - WHERE - ( - ( - ( - "t11"."cust_nation" = 'FRANCE' - ) AND ( - "t11"."supp_nation" = 'GERMANY' - ) - ) - OR ( - ( - "t11"."cust_nation" = 'GERMANY' - ) AND ( - "t11"."supp_nation" = 'FRANCE' - ) - ) - ) - AND "t11"."l_shipdate" BETWEEN DATE_TRUNC('DAY', '1995-01-01') AND DATE_TRUNC('DAY', '1996-12-31') - ) AS "t12" - ) AS t12 - GROUP BY - "t12"."supp_nation", - "t12"."cust_nation", - "t12"."l_year" -) AS "t13" -ORDER BY - "t13"."supp_nation" ASC, - "t13"."cust_nation" ASC, - "t13"."l_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/duckdb/07.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/duckdb/07.sql deleted file mode 100644 index cbe4a48ea8f7..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/duckdb/07.sql +++ /dev/null @@ -1,62 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t12"."supp_nation", - "t12"."cust_nation", - "t12"."l_year", - SUM("t12"."volume") AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t9"."n_name" AS "supp_nation", - "t10"."n_name" AS "cust_nation", - "t6"."l_shipdate", - "t6"."l_extendedprice", - "t6"."l_discount", - EXTRACT(year FROM "t6"."l_shipdate") AS "l_year", - "t6"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t6"."l_discount" - ) AS "volume" - FROM "tpch"."supplier" AS "t5" - INNER JOIN "tpch"."lineitem" AS "t6" - ON "t5"."s_suppkey" = "t6"."l_suppkey" - INNER JOIN "tpch"."orders" AS "t7" - ON "t7"."o_orderkey" = "t6"."l_orderkey" - INNER JOIN "tpch"."customer" AS "t8" - ON "t8"."c_custkey" = "t7"."o_custkey" - INNER JOIN "tpch"."nation" AS "t9" - ON "t5"."s_nationkey" = "t9"."n_nationkey" - INNER JOIN "tpch"."nation" AS "t10" - ON "t8"."c_nationkey" = "t10"."n_nationkey" - ) AS "t11" - WHERE - ( - ( - ( - "t11"."cust_nation" = 'FRANCE' - ) AND ( - "t11"."supp_nation" = 'GERMANY' - ) - ) - OR ( - ( - "t11"."cust_nation" = 'GERMANY' - ) AND ( - "t11"."supp_nation" = 'FRANCE' - ) - ) - ) - AND "t11"."l_shipdate" BETWEEN MAKE_DATE(1995, 1, 1) AND MAKE_DATE(1996, 12, 31) - ) AS "t12" - GROUP BY - 1, - 2, - 3 -) AS "t13" -ORDER BY - "t13"."supp_nation" ASC, - "t13"."cust_nation" ASC, - "t13"."l_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/snowflake/07.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/snowflake/07.sql deleted file mode 100644 index 2b903346b874..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/snowflake/07.sql +++ /dev/null @@ -1,122 +0,0 @@ -WITH "t9" AS ( - SELECT - "t4"."N_NATIONKEY" AS "n_nationkey", - "t4"."N_NAME" AS "n_name", - "t4"."N_REGIONKEY" AS "n_regionkey", - "t4"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t4" -) -SELECT - * -FROM ( - SELECT - "t18"."supp_nation", - "t18"."cust_nation", - "t18"."l_year", - SUM("t18"."volume") AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t15"."n_name" AS "supp_nation", - "t16"."n_name" AS "cust_nation", - "t11"."l_shipdate", - "t11"."l_extendedprice", - "t11"."l_discount", - DATE_PART(year, "t11"."l_shipdate") AS "l_year", - "t11"."l_extendedprice" * ( - 1 - "t11"."l_discount" - ) AS "volume" - FROM ( - SELECT - "t0"."S_SUPPKEY" AS "s_suppkey", - "t0"."S_NAME" AS "s_name", - "t0"."S_ADDRESS" AS "s_address", - "t0"."S_NATIONKEY" AS "s_nationkey", - "t0"."S_PHONE" AS "s_phone", - "t0"."S_ACCTBAL" AS "s_acctbal", - "t0"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t0" - ) AS "t10" - INNER JOIN ( - SELECT - "t1"."L_ORDERKEY" AS "l_orderkey", - "t1"."L_PARTKEY" AS "l_partkey", - "t1"."L_SUPPKEY" AS "l_suppkey", - "t1"."L_LINENUMBER" AS "l_linenumber", - "t1"."L_QUANTITY" AS "l_quantity", - "t1"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t1"."L_DISCOUNT" AS "l_discount", - "t1"."L_TAX" AS "l_tax", - "t1"."L_RETURNFLAG" AS "l_returnflag", - "t1"."L_LINESTATUS" AS "l_linestatus", - "t1"."L_SHIPDATE" AS "l_shipdate", - "t1"."L_COMMITDATE" AS "l_commitdate", - "t1"."L_RECEIPTDATE" AS "l_receiptdate", - "t1"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t1"."L_SHIPMODE" AS "l_shipmode", - "t1"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t1" - ) AS "t11" - ON "t10"."s_suppkey" = "t11"."l_suppkey" - INNER JOIN ( - SELECT - "t2"."O_ORDERKEY" AS "o_orderkey", - "t2"."O_CUSTKEY" AS "o_custkey", - "t2"."O_ORDERSTATUS" AS "o_orderstatus", - "t2"."O_TOTALPRICE" AS "o_totalprice", - "t2"."O_ORDERDATE" AS "o_orderdate", - "t2"."O_ORDERPRIORITY" AS "o_orderpriority", - "t2"."O_CLERK" AS "o_clerk", - "t2"."O_SHIPPRIORITY" AS "o_shippriority", - "t2"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t2" - ) AS "t12" - ON "t12"."o_orderkey" = "t11"."l_orderkey" - INNER JOIN ( - SELECT - "t3"."C_CUSTKEY" AS "c_custkey", - "t3"."C_NAME" AS "c_name", - "t3"."C_ADDRESS" AS "c_address", - "t3"."C_NATIONKEY" AS "c_nationkey", - "t3"."C_PHONE" AS "c_phone", - "t3"."C_ACCTBAL" AS "c_acctbal", - "t3"."C_MKTSEGMENT" AS "c_mktsegment", - "t3"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t3" - ) AS "t13" - ON "t13"."c_custkey" = "t12"."o_custkey" - INNER JOIN "t9" AS "t15" - ON "t10"."s_nationkey" = "t15"."n_nationkey" - INNER JOIN "t9" AS "t16" - ON "t13"."c_nationkey" = "t16"."n_nationkey" - ) AS "t17" - WHERE - ( - ( - ( - "t17"."cust_nation" = 'FRANCE' - ) AND ( - "t17"."supp_nation" = 'GERMANY' - ) - ) - OR ( - ( - "t17"."cust_nation" = 'GERMANY' - ) AND ( - "t17"."supp_nation" = 'FRANCE' - ) - ) - ) - AND "t17"."l_shipdate" BETWEEN DATE_FROM_PARTS(1995, 1, 1) AND DATE_FROM_PARTS(1996, 12, 31) - ) AS "t18" - GROUP BY - 1, - 2, - 3 -) AS "t19" -ORDER BY - "t19"."supp_nation" ASC, - "t19"."cust_nation" ASC, - "t19"."l_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/trino/07.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/trino/07.sql deleted file mode 100644 index 61dc5d3ac0fd..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_07/trino/07.sql +++ /dev/null @@ -1,119 +0,0 @@ -WITH "t5" AS ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t4" -) -SELECT - * -FROM ( - SELECT - "t18"."supp_nation", - "t18"."cust_nation", - "t18"."l_year", - SUM("t18"."volume") AS "revenue" - FROM ( - SELECT - * - FROM ( - SELECT - "t15"."n_name" AS "supp_nation", - "t16"."n_name" AS "cust_nation", - "t12"."l_shipdate", - "t12"."l_extendedprice", - "t12"."l_discount", - EXTRACT(year FROM "t12"."l_shipdate") AS "l_year", - "t12"."l_extendedprice" * ( - 1 - "t12"."l_discount" - ) AS "volume" - FROM ( - SELECT - "t0"."s_suppkey", - "t0"."s_name", - "t0"."s_address", - "t0"."s_nationkey", - "t0"."s_phone", - CAST("t0"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t0"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t0" - ) AS "t11" - INNER JOIN ( - SELECT - "t1"."l_orderkey", - "t1"."l_partkey", - "t1"."l_suppkey", - "t1"."l_linenumber", - CAST("t1"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t1"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t1"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t1"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t1"."l_returnflag", - "t1"."l_linestatus", - "t1"."l_shipdate", - "t1"."l_commitdate", - "t1"."l_receiptdate", - "t1"."l_shipinstruct", - "t1"."l_shipmode", - "t1"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t1" - ) AS "t12" - ON "t11"."s_suppkey" = "t12"."l_suppkey" - INNER JOIN ( - SELECT - "t2"."o_orderkey", - "t2"."o_custkey", - "t2"."o_orderstatus", - CAST("t2"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t2"."o_orderdate", - "t2"."o_orderpriority", - "t2"."o_clerk", - "t2"."o_shippriority", - "t2"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t2" - ) AS "t13" - ON "t13"."o_orderkey" = "t12"."l_orderkey" - INNER JOIN ( - SELECT - "t3"."c_custkey", - "t3"."c_name", - "t3"."c_address", - "t3"."c_nationkey", - "t3"."c_phone", - CAST("t3"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t3"."c_mktsegment", - "t3"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t3" - ) AS "t14" - ON "t14"."c_custkey" = "t13"."o_custkey" - INNER JOIN "t5" AS "t15" - ON "t11"."s_nationkey" = "t15"."n_nationkey" - INNER JOIN "t5" AS "t16" - ON "t14"."c_nationkey" = "t16"."n_nationkey" - ) AS "t17" - WHERE - ( - ( - ( - "t17"."cust_nation" = 'FRANCE' - ) AND ( - "t17"."supp_nation" = 'GERMANY' - ) - ) - OR ( - ( - "t17"."cust_nation" = 'GERMANY' - ) AND ( - "t17"."supp_nation" = 'FRANCE' - ) - ) - ) - AND "t17"."l_shipdate" BETWEEN FROM_ISO8601_DATE('1995-01-01') AND FROM_ISO8601_DATE('1996-12-31') - ) AS "t18" - GROUP BY - 1, - 2, - 3 -) AS "t19" -ORDER BY - "t19"."supp_nation" ASC, - "t19"."cust_nation" ASC, - "t19"."l_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/datafusion/08.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/datafusion/08.sql deleted file mode 100644 index 9cd2fa79c246..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/datafusion/08.sql +++ /dev/null @@ -1,61 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t16"."o_year", - CAST(SUM("t16"."nation_volume") AS DOUBLE PRECISION) / SUM("t16"."volume") AS "mkt_share" - FROM ( - SELECT - "t16"."volume", - "t16"."nation", - "t16"."r_name", - "t16"."o_orderdate", - "t16"."p_type", - "t16"."nation_volume", - "t16"."o_year" - FROM ( - SELECT - "t15"."o_year", - "t15"."volume", - "t15"."nation", - "t15"."r_name", - "t15"."o_orderdate", - "t15"."p_type", - CASE WHEN "t15"."nation" = 'BRAZIL' THEN "t15"."volume" ELSE 0 END AS "nation_volume" - FROM ( - SELECT - DATE_PART('year', "t10"."o_orderdate") AS "o_year", - "t8"."l_extendedprice" * ( - 1 - "t8"."l_discount" - ) AS "volume", - "t13"."n_name" AS "nation", - "t14"."r_name", - "t10"."o_orderdate", - "t7"."p_type" - FROM "tpch"."part" AS "t7" - INNER JOIN "tpch"."lineitem" AS "t8" - ON "t7"."p_partkey" = "t8"."l_partkey" - INNER JOIN "tpch"."supplier" AS "t9" - ON "t9"."s_suppkey" = "t8"."l_suppkey" - INNER JOIN "tpch"."orders" AS "t10" - ON "t8"."l_orderkey" = "t10"."o_orderkey" - INNER JOIN "tpch"."customer" AS "t11" - ON "t10"."o_custkey" = "t11"."c_custkey" - INNER JOIN "tpch"."nation" AS "t12" - ON "t11"."c_nationkey" = "t12"."n_nationkey" - INNER JOIN "tpch"."region" AS "t14" - ON "t12"."n_regionkey" = "t14"."r_regionkey" - INNER JOIN "tpch"."nation" AS "t13" - ON "t9"."s_nationkey" = "t13"."n_nationkey" - ) AS "t15" - WHERE - "t15"."r_name" = 'AMERICA' - AND "t15"."o_orderdate" BETWEEN DATE_TRUNC('DAY', '1995-01-01') AND DATE_TRUNC('DAY', '1996-12-31') - AND "t15"."p_type" = 'ECONOMY ANODIZED STEEL' - ) AS "t16" - ) AS t16 - GROUP BY - "t16"."o_year" -) AS "t17" -ORDER BY - "t17"."o_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/duckdb/08.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/duckdb/08.sql deleted file mode 100644 index 89a8fd66aacb..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/duckdb/08.sql +++ /dev/null @@ -1,51 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t16"."o_year", - SUM("t16"."nation_volume") / SUM("t16"."volume") AS "mkt_share" - FROM ( - SELECT - "t15"."o_year", - "t15"."volume", - "t15"."nation", - "t15"."r_name", - "t15"."o_orderdate", - "t15"."p_type", - CASE WHEN "t15"."nation" = 'BRAZIL' THEN "t15"."volume" ELSE CAST(0 AS TINYINT) END AS "nation_volume" - FROM ( - SELECT - EXTRACT(year FROM "t10"."o_orderdate") AS "o_year", - "t8"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t8"."l_discount" - ) AS "volume", - "t13"."n_name" AS "nation", - "t14"."r_name", - "t10"."o_orderdate", - "t7"."p_type" - FROM "tpch"."part" AS "t7" - INNER JOIN "tpch"."lineitem" AS "t8" - ON "t7"."p_partkey" = "t8"."l_partkey" - INNER JOIN "tpch"."supplier" AS "t9" - ON "t9"."s_suppkey" = "t8"."l_suppkey" - INNER JOIN "tpch"."orders" AS "t10" - ON "t8"."l_orderkey" = "t10"."o_orderkey" - INNER JOIN "tpch"."customer" AS "t11" - ON "t10"."o_custkey" = "t11"."c_custkey" - INNER JOIN "tpch"."nation" AS "t12" - ON "t11"."c_nationkey" = "t12"."n_nationkey" - INNER JOIN "tpch"."region" AS "t14" - ON "t12"."n_regionkey" = "t14"."r_regionkey" - INNER JOIN "tpch"."nation" AS "t13" - ON "t9"."s_nationkey" = "t13"."n_nationkey" - ) AS "t15" - WHERE - "t15"."r_name" = 'AMERICA' - AND "t15"."o_orderdate" BETWEEN MAKE_DATE(1995, 1, 1) AND MAKE_DATE(1996, 12, 31) - AND "t15"."p_type" = 'ECONOMY ANODIZED STEEL' - ) AS "t16" - GROUP BY - 1 -) AS "t17" -ORDER BY - "t17"."o_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/snowflake/08.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/snowflake/08.sql deleted file mode 100644 index 898291b06e57..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/snowflake/08.sql +++ /dev/null @@ -1,129 +0,0 @@ -WITH "t13" AS ( - SELECT - "t6"."N_NATIONKEY" AS "n_nationkey", - "t6"."N_NAME" AS "n_name", - "t6"."N_REGIONKEY" AS "n_regionkey", - "t6"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t6" -) -SELECT - * -FROM ( - SELECT - "t24"."o_year", - SUM("t24"."nation_volume") / SUM("t24"."volume") AS "mkt_share" - FROM ( - SELECT - "t23"."o_year", - "t23"."volume", - "t23"."nation", - "t23"."r_name", - "t23"."o_orderdate", - "t23"."p_type", - CASE WHEN "t23"."nation" = 'BRAZIL' THEN "t23"."volume" ELSE 0 END AS "nation_volume" - FROM ( - SELECT - DATE_PART(year, "t17"."o_orderdate") AS "o_year", - "t15"."l_extendedprice" * ( - 1 - "t15"."l_discount" - ) AS "volume", - "t22"."n_name" AS "nation", - "t19"."r_name", - "t17"."o_orderdate", - "t14"."p_type" - FROM ( - SELECT - "t0"."P_PARTKEY" AS "p_partkey", - "t0"."P_NAME" AS "p_name", - "t0"."P_MFGR" AS "p_mfgr", - "t0"."P_BRAND" AS "p_brand", - "t0"."P_TYPE" AS "p_type", - "t0"."P_SIZE" AS "p_size", - "t0"."P_CONTAINER" AS "p_container", - "t0"."P_RETAILPRICE" AS "p_retailprice", - "t0"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t0" - ) AS "t14" - INNER JOIN ( - SELECT - "t1"."L_ORDERKEY" AS "l_orderkey", - "t1"."L_PARTKEY" AS "l_partkey", - "t1"."L_SUPPKEY" AS "l_suppkey", - "t1"."L_LINENUMBER" AS "l_linenumber", - "t1"."L_QUANTITY" AS "l_quantity", - "t1"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t1"."L_DISCOUNT" AS "l_discount", - "t1"."L_TAX" AS "l_tax", - "t1"."L_RETURNFLAG" AS "l_returnflag", - "t1"."L_LINESTATUS" AS "l_linestatus", - "t1"."L_SHIPDATE" AS "l_shipdate", - "t1"."L_COMMITDATE" AS "l_commitdate", - "t1"."L_RECEIPTDATE" AS "l_receiptdate", - "t1"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t1"."L_SHIPMODE" AS "l_shipmode", - "t1"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t1" - ) AS "t15" - ON "t14"."p_partkey" = "t15"."l_partkey" - INNER JOIN ( - SELECT - "t2"."S_SUPPKEY" AS "s_suppkey", - "t2"."S_NAME" AS "s_name", - "t2"."S_ADDRESS" AS "s_address", - "t2"."S_NATIONKEY" AS "s_nationkey", - "t2"."S_PHONE" AS "s_phone", - "t2"."S_ACCTBAL" AS "s_acctbal", - "t2"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t2" - ) AS "t16" - ON "t16"."s_suppkey" = "t15"."l_suppkey" - INNER JOIN ( - SELECT - "t3"."O_ORDERKEY" AS "o_orderkey", - "t3"."O_CUSTKEY" AS "o_custkey", - "t3"."O_ORDERSTATUS" AS "o_orderstatus", - "t3"."O_TOTALPRICE" AS "o_totalprice", - "t3"."O_ORDERDATE" AS "o_orderdate", - "t3"."O_ORDERPRIORITY" AS "o_orderpriority", - "t3"."O_CLERK" AS "o_clerk", - "t3"."O_SHIPPRIORITY" AS "o_shippriority", - "t3"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t3" - ) AS "t17" - ON "t15"."l_orderkey" = "t17"."o_orderkey" - INNER JOIN ( - SELECT - "t4"."C_CUSTKEY" AS "c_custkey", - "t4"."C_NAME" AS "c_name", - "t4"."C_ADDRESS" AS "c_address", - "t4"."C_NATIONKEY" AS "c_nationkey", - "t4"."C_PHONE" AS "c_phone", - "t4"."C_ACCTBAL" AS "c_acctbal", - "t4"."C_MKTSEGMENT" AS "c_mktsegment", - "t4"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t4" - ) AS "t18" - ON "t17"."o_custkey" = "t18"."c_custkey" - INNER JOIN "t13" AS "t21" - ON "t18"."c_nationkey" = "t21"."n_nationkey" - INNER JOIN ( - SELECT - "t5"."R_REGIONKEY" AS "r_regionkey", - "t5"."R_NAME" AS "r_name", - "t5"."R_COMMENT" AS "r_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."REGION" AS "t5" - ) AS "t19" - ON "t21"."n_regionkey" = "t19"."r_regionkey" - INNER JOIN "t13" AS "t22" - ON "t16"."s_nationkey" = "t22"."n_nationkey" - ) AS "t23" - WHERE - "t23"."r_name" = 'AMERICA' - AND "t23"."o_orderdate" BETWEEN DATE_FROM_PARTS(1995, 1, 1) AND DATE_FROM_PARTS(1996, 12, 31) - AND "t23"."p_type" = 'ECONOMY ANODIZED STEEL' - ) AS "t24" - GROUP BY - 1 -) AS "t25" -ORDER BY - "t25"."o_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/trino/08.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/trino/08.sql deleted file mode 100644 index e0b073d9232a..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_08/trino/08.sql +++ /dev/null @@ -1,124 +0,0 @@ -WITH "t8" AS ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t6" -) -SELECT - * -FROM ( - SELECT - "t24"."o_year", - CAST(SUM("t24"."nation_volume") AS DOUBLE) / SUM("t24"."volume") AS "mkt_share" - FROM ( - SELECT - "t23"."o_year", - "t23"."volume", - "t23"."nation", - "t23"."r_name", - "t23"."o_orderdate", - "t23"."p_type", - CASE WHEN "t23"."nation" = 'BRAZIL' THEN "t23"."volume" ELSE 0 END AS "nation_volume" - FROM ( - SELECT - EXTRACT(year FROM "t19"."o_orderdate") AS "o_year", - "t17"."l_extendedprice" * ( - 1 - "t17"."l_discount" - ) AS "volume", - "t22"."n_name" AS "nation", - "t14"."r_name", - "t19"."o_orderdate", - "t16"."p_type" - FROM ( - SELECT - "t0"."p_partkey", - "t0"."p_name", - "t0"."p_mfgr", - "t0"."p_brand", - "t0"."p_type", - "t0"."p_size", - "t0"."p_container", - CAST("t0"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t0"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t0" - ) AS "t16" - INNER JOIN ( - SELECT - "t1"."l_orderkey", - "t1"."l_partkey", - "t1"."l_suppkey", - "t1"."l_linenumber", - CAST("t1"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t1"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t1"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t1"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t1"."l_returnflag", - "t1"."l_linestatus", - "t1"."l_shipdate", - "t1"."l_commitdate", - "t1"."l_receiptdate", - "t1"."l_shipinstruct", - "t1"."l_shipmode", - "t1"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t1" - ) AS "t17" - ON "t16"."p_partkey" = "t17"."l_partkey" - INNER JOIN ( - SELECT - "t2"."s_suppkey", - "t2"."s_name", - "t2"."s_address", - "t2"."s_nationkey", - "t2"."s_phone", - CAST("t2"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t2"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t2" - ) AS "t18" - ON "t18"."s_suppkey" = "t17"."l_suppkey" - INNER JOIN ( - SELECT - "t3"."o_orderkey", - "t3"."o_custkey", - "t3"."o_orderstatus", - CAST("t3"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t3"."o_orderdate", - "t3"."o_orderpriority", - "t3"."o_clerk", - "t3"."o_shippriority", - "t3"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t3" - ) AS "t19" - ON "t17"."l_orderkey" = "t19"."o_orderkey" - INNER JOIN ( - SELECT - "t4"."c_custkey", - "t4"."c_name", - "t4"."c_address", - "t4"."c_nationkey", - "t4"."c_phone", - CAST("t4"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t4"."c_mktsegment", - "t4"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t4" - ) AS "t20" - ON "t19"."o_custkey" = "t20"."c_custkey" - INNER JOIN "t8" AS "t21" - ON "t20"."c_nationkey" = "t21"."n_nationkey" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."region" AS "t5" - ) AS "t14" - ON "t21"."n_regionkey" = "t14"."r_regionkey" - INNER JOIN "t8" AS "t22" - ON "t18"."s_nationkey" = "t22"."n_nationkey" - ) AS "t23" - WHERE - "t23"."r_name" = 'AMERICA' - AND "t23"."o_orderdate" BETWEEN FROM_ISO8601_DATE('1995-01-01') AND FROM_ISO8601_DATE('1996-12-31') - AND "t23"."p_type" = 'ECONOMY ANODIZED STEEL' - ) AS "t24" - GROUP BY - 1 -) AS "t25" -ORDER BY - "t25"."o_year" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/datafusion/09.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/datafusion/09.sql deleted file mode 100644 index 038f302421af..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/datafusion/09.sql +++ /dev/null @@ -1,51 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t13"."nation", - "t13"."o_year", - SUM("t13"."amount") AS "sum_profit" - FROM ( - SELECT - "t13"."amount", - "t13"."p_name", - "t13"."nation", - "t13"."o_year" - FROM ( - SELECT - * - FROM ( - SELECT - ( - "t6"."l_extendedprice" * ( - 1 - "t6"."l_discount" - ) - ) - ( - "t8"."ps_supplycost" * "t6"."l_quantity" - ) AS "amount", - DATE_PART('year', "t10"."o_orderdate") AS "o_year", - "t11"."n_name" AS "nation", - "t9"."p_name" - FROM "tpch"."lineitem" AS "t6" - INNER JOIN "tpch"."supplier" AS "t7" - ON "t7"."s_suppkey" = "t6"."l_suppkey" - INNER JOIN "tpch"."partsupp" AS "t8" - ON "t8"."ps_suppkey" = "t6"."l_suppkey" AND "t8"."ps_partkey" = "t6"."l_partkey" - INNER JOIN "tpch"."part" AS "t9" - ON "t9"."p_partkey" = "t6"."l_partkey" - INNER JOIN "tpch"."orders" AS "t10" - ON "t10"."o_orderkey" = "t6"."l_orderkey" - INNER JOIN "tpch"."nation" AS "t11" - ON "t7"."s_nationkey" = "t11"."n_nationkey" - ) AS "t12" - WHERE - "t12"."p_name" LIKE '%green%' - ) AS "t13" - ) AS t13 - GROUP BY - "t13"."nation", - "t13"."o_year" -) AS "t14" -ORDER BY - "t14"."nation" ASC, - "t14"."o_year" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/duckdb/09.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/duckdb/09.sql deleted file mode 100644 index dc1cabddcd8e..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/duckdb/09.sql +++ /dev/null @@ -1,44 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t13"."nation", - "t13"."o_year", - SUM("t13"."amount") AS "sum_profit" - FROM ( - SELECT - * - FROM ( - SELECT - ( - "t6"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t6"."l_discount" - ) - ) - ( - "t8"."ps_supplycost" * "t6"."l_quantity" - ) AS "amount", - EXTRACT(year FROM "t10"."o_orderdate") AS "o_year", - "t11"."n_name" AS "nation", - "t9"."p_name" - FROM "tpch"."lineitem" AS "t6" - INNER JOIN "tpch"."supplier" AS "t7" - ON "t7"."s_suppkey" = "t6"."l_suppkey" - INNER JOIN "tpch"."partsupp" AS "t8" - ON "t8"."ps_suppkey" = "t6"."l_suppkey" AND "t8"."ps_partkey" = "t6"."l_partkey" - INNER JOIN "tpch"."part" AS "t9" - ON "t9"."p_partkey" = "t6"."l_partkey" - INNER JOIN "tpch"."orders" AS "t10" - ON "t10"."o_orderkey" = "t6"."l_orderkey" - INNER JOIN "tpch"."nation" AS "t11" - ON "t7"."s_nationkey" = "t11"."n_nationkey" - ) AS "t12" - WHERE - "t12"."p_name" LIKE '%green%' - ) AS "t13" - GROUP BY - 1, - 2 -) AS "t14" -ORDER BY - "t14"."nation" ASC, - "t14"."o_year" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/snowflake/09.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/snowflake/09.sql deleted file mode 100644 index c160a887167d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/snowflake/09.sql +++ /dev/null @@ -1,112 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t19"."nation", - "t19"."o_year", - SUM("t19"."amount") AS "sum_profit" - FROM ( - SELECT - * - FROM ( - SELECT - ( - "t12"."l_extendedprice" * ( - 1 - "t12"."l_discount" - ) - ) - ( - "t14"."ps_supplycost" * "t12"."l_quantity" - ) AS "amount", - DATE_PART(year, "t16"."o_orderdate") AS "o_year", - "t17"."n_name" AS "nation", - "t15"."p_name" - FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - ) AS "t12" - INNER JOIN ( - SELECT - "t1"."S_SUPPKEY" AS "s_suppkey", - "t1"."S_NAME" AS "s_name", - "t1"."S_ADDRESS" AS "s_address", - "t1"."S_NATIONKEY" AS "s_nationkey", - "t1"."S_PHONE" AS "s_phone", - "t1"."S_ACCTBAL" AS "s_acctbal", - "t1"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t1" - ) AS "t13" - ON "t13"."s_suppkey" = "t12"."l_suppkey" - INNER JOIN ( - SELECT - "t2"."PS_PARTKEY" AS "ps_partkey", - "t2"."PS_SUPPKEY" AS "ps_suppkey", - "t2"."PS_AVAILQTY" AS "ps_availqty", - "t2"."PS_SUPPLYCOST" AS "ps_supplycost", - "t2"."PS_COMMENT" AS "ps_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PARTSUPP" AS "t2" - ) AS "t14" - ON "t14"."ps_suppkey" = "t12"."l_suppkey" AND "t14"."ps_partkey" = "t12"."l_partkey" - INNER JOIN ( - SELECT - "t3"."P_PARTKEY" AS "p_partkey", - "t3"."P_NAME" AS "p_name", - "t3"."P_MFGR" AS "p_mfgr", - "t3"."P_BRAND" AS "p_brand", - "t3"."P_TYPE" AS "p_type", - "t3"."P_SIZE" AS "p_size", - "t3"."P_CONTAINER" AS "p_container", - "t3"."P_RETAILPRICE" AS "p_retailprice", - "t3"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t3" - ) AS "t15" - ON "t15"."p_partkey" = "t12"."l_partkey" - INNER JOIN ( - SELECT - "t4"."O_ORDERKEY" AS "o_orderkey", - "t4"."O_CUSTKEY" AS "o_custkey", - "t4"."O_ORDERSTATUS" AS "o_orderstatus", - "t4"."O_TOTALPRICE" AS "o_totalprice", - "t4"."O_ORDERDATE" AS "o_orderdate", - "t4"."O_ORDERPRIORITY" AS "o_orderpriority", - "t4"."O_CLERK" AS "o_clerk", - "t4"."O_SHIPPRIORITY" AS "o_shippriority", - "t4"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t4" - ) AS "t16" - ON "t16"."o_orderkey" = "t12"."l_orderkey" - INNER JOIN ( - SELECT - "t5"."N_NATIONKEY" AS "n_nationkey", - "t5"."N_NAME" AS "n_name", - "t5"."N_REGIONKEY" AS "n_regionkey", - "t5"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t5" - ) AS "t17" - ON "t13"."s_nationkey" = "t17"."n_nationkey" - ) AS "t18" - WHERE - "t18"."p_name" LIKE '%green%' - ) AS "t19" - GROUP BY - 1, - 2 -) AS "t20" -ORDER BY - "t20"."nation" ASC, - "t20"."o_year" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/trino/09.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/trino/09.sql deleted file mode 100644 index 77cee554f951..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_09/trino/09.sql +++ /dev/null @@ -1,109 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t19"."nation", - "t19"."o_year", - SUM("t19"."amount") AS "sum_profit" - FROM ( - SELECT - * - FROM ( - SELECT - ( - "t13"."l_extendedprice" * ( - 1 - "t13"."l_discount" - ) - ) - ( - "t15"."ps_supplycost" * "t13"."l_quantity" - ) AS "amount", - EXTRACT(year FROM "t17"."o_orderdate") AS "o_year", - "t12"."n_name" AS "nation", - "t16"."p_name" - FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - ) AS "t13" - INNER JOIN ( - SELECT - "t1"."s_suppkey", - "t1"."s_name", - "t1"."s_address", - "t1"."s_nationkey", - "t1"."s_phone", - CAST("t1"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t1"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t1" - ) AS "t14" - ON "t14"."s_suppkey" = "t13"."l_suppkey" - INNER JOIN ( - SELECT - "t2"."ps_partkey", - "t2"."ps_suppkey", - "t2"."ps_availqty", - CAST("t2"."ps_supplycost" AS DECIMAL(15, 2)) AS "ps_supplycost", - "t2"."ps_comment" - FROM "hive"."ibis_tpch_sf1"."partsupp" AS "t2" - ) AS "t15" - ON "t15"."ps_suppkey" = "t13"."l_suppkey" AND "t15"."ps_partkey" = "t13"."l_partkey" - INNER JOIN ( - SELECT - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - CAST("t3"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t3"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t3" - ) AS "t16" - ON "t16"."p_partkey" = "t13"."l_partkey" - INNER JOIN ( - SELECT - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - CAST("t4"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t4" - ) AS "t17" - ON "t17"."o_orderkey" = "t13"."l_orderkey" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t5" - ) AS "t12" - ON "t14"."s_nationkey" = "t12"."n_nationkey" - ) AS "t18" - WHERE - "t18"."p_name" LIKE '%green%' - ) AS "t19" - GROUP BY - 1, - 2 -) AS "t20" -ORDER BY - "t20"."nation" ASC, - "t20"."o_year" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/datafusion/11.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/datafusion/11.sql deleted file mode 100644 index 7cc4ae7e48b0..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/datafusion/11.sql +++ /dev/null @@ -1,69 +0,0 @@ -WITH "t7" AS ( - SELECT - * - FROM ( - SELECT - "t3"."ps_partkey", - "t3"."ps_suppkey", - "t3"."ps_availqty", - "t3"."ps_supplycost", - "t3"."ps_comment", - "t4"."s_suppkey", - "t4"."s_name", - "t4"."s_address", - "t4"."s_nationkey", - "t4"."s_phone", - "t4"."s_acctbal", - "t4"."s_comment", - "t5"."n_nationkey", - "t5"."n_name", - "t5"."n_regionkey", - "t5"."n_comment" - FROM "tpch"."partsupp" AS "t3" - INNER JOIN "tpch"."supplier" AS "t4" - ON "t3"."ps_suppkey" = "t4"."s_suppkey" - INNER JOIN "tpch"."nation" AS "t5" - ON "t5"."n_nationkey" = "t4"."s_nationkey" - ) AS "t6" - WHERE - "t6"."n_name" = 'GERMANY' -) -SELECT - * -FROM ( - SELECT - "t8"."ps_partkey", - SUM("t8"."ps_supplycost" * "t8"."ps_availqty") AS "value" - FROM ( - SELECT - "t8"."ps_suppkey", - "t8"."ps_availqty", - "t8"."ps_supplycost", - "t8"."ps_comment", - "t8"."s_suppkey", - "t8"."s_name", - "t8"."s_address", - "t8"."s_nationkey", - "t8"."s_phone", - "t8"."s_acctbal", - "t8"."s_comment", - "t8"."n_nationkey", - "t8"."n_name", - "t8"."n_regionkey", - "t8"."n_comment", - "t8"."ps_partkey" - FROM "t7" AS "t8" - ) AS t8 - GROUP BY - "t8"."ps_partkey" -) AS "t9" -WHERE - "t9"."value" > ( - ( - SELECT - SUM("t8"."ps_supplycost" * "t8"."ps_availqty") AS "Sum(Multiply(ps_supplycost, ps_availqty))" - FROM "t7" AS "t8" - ) * 0.0001 - ) -ORDER BY - "t9"."value" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/duckdb/11.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/duckdb/11.sql deleted file mode 100644 index 38cc0cd9e8f3..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/duckdb/11.sql +++ /dev/null @@ -1,50 +0,0 @@ -WITH "t7" AS ( - SELECT - * - FROM ( - SELECT - "t3"."ps_partkey", - "t3"."ps_suppkey", - "t3"."ps_availqty", - "t3"."ps_supplycost", - "t3"."ps_comment", - "t4"."s_suppkey", - "t4"."s_name", - "t4"."s_address", - "t4"."s_nationkey", - "t4"."s_phone", - "t4"."s_acctbal", - "t4"."s_comment", - "t5"."n_nationkey", - "t5"."n_name", - "t5"."n_regionkey", - "t5"."n_comment" - FROM "tpch"."partsupp" AS "t3" - INNER JOIN "tpch"."supplier" AS "t4" - ON "t3"."ps_suppkey" = "t4"."s_suppkey" - INNER JOIN "tpch"."nation" AS "t5" - ON "t5"."n_nationkey" = "t4"."s_nationkey" - ) AS "t6" - WHERE - "t6"."n_name" = 'GERMANY' -) -SELECT - * -FROM ( - SELECT - "t8"."ps_partkey", - SUM("t8"."ps_supplycost" * "t8"."ps_availqty") AS "value" - FROM "t7" AS "t8" - GROUP BY - 1 -) AS "t9" -WHERE - "t9"."value" > ( - ( - SELECT - SUM("t8"."ps_supplycost" * "t8"."ps_availqty") AS "Sum(Multiply(ps_supplycost, ps_availqty))" - FROM "t7" AS "t8" - ) * CAST(0.0001 AS DOUBLE) - ) -ORDER BY - "t9"."value" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/snowflake/11.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/snowflake/11.sql deleted file mode 100644 index 1887de19892d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/snowflake/11.sql +++ /dev/null @@ -1,75 +0,0 @@ -WITH "t10" AS ( - SELECT - * - FROM ( - SELECT - "t6"."ps_partkey", - "t6"."ps_suppkey", - "t6"."ps_availqty", - "t6"."ps_supplycost", - "t6"."ps_comment", - "t7"."s_suppkey", - "t7"."s_name", - "t7"."s_address", - "t7"."s_nationkey", - "t7"."s_phone", - "t7"."s_acctbal", - "t7"."s_comment", - "t8"."n_nationkey", - "t8"."n_name", - "t8"."n_regionkey", - "t8"."n_comment" - FROM ( - SELECT - "t0"."PS_PARTKEY" AS "ps_partkey", - "t0"."PS_SUPPKEY" AS "ps_suppkey", - "t0"."PS_AVAILQTY" AS "ps_availqty", - "t0"."PS_SUPPLYCOST" AS "ps_supplycost", - "t0"."PS_COMMENT" AS "ps_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PARTSUPP" AS "t0" - ) AS "t6" - INNER JOIN ( - SELECT - "t1"."S_SUPPKEY" AS "s_suppkey", - "t1"."S_NAME" AS "s_name", - "t1"."S_ADDRESS" AS "s_address", - "t1"."S_NATIONKEY" AS "s_nationkey", - "t1"."S_PHONE" AS "s_phone", - "t1"."S_ACCTBAL" AS "s_acctbal", - "t1"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t1" - ) AS "t7" - ON "t6"."ps_suppkey" = "t7"."s_suppkey" - INNER JOIN ( - SELECT - "t2"."N_NATIONKEY" AS "n_nationkey", - "t2"."N_NAME" AS "n_name", - "t2"."N_REGIONKEY" AS "n_regionkey", - "t2"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t2" - ) AS "t8" - ON "t8"."n_nationkey" = "t7"."s_nationkey" - ) AS "t9" - WHERE - "t9"."n_name" = 'GERMANY' -) -SELECT - * -FROM ( - SELECT - "t11"."ps_partkey", - SUM("t11"."ps_supplycost" * "t11"."ps_availqty") AS "value" - FROM "t10" AS "t11" - GROUP BY - 1 -) AS "t12" -WHERE - "t12"."value" > ( - ( - SELECT - SUM("t11"."ps_supplycost" * "t11"."ps_availqty") AS "Sum(Multiply(ps_supplycost, ps_availqty))" - FROM "t10" AS "t11" - ) * 0.0001 - ) -ORDER BY - "t12"."value" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/trino/11.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/trino/11.sql deleted file mode 100644 index 823e24d8af9d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_11/trino/11.sql +++ /dev/null @@ -1,72 +0,0 @@ -WITH "t10" AS ( - SELECT - * - FROM ( - SELECT - "t7"."ps_partkey", - "t7"."ps_suppkey", - "t7"."ps_availqty", - "t7"."ps_supplycost", - "t7"."ps_comment", - "t8"."s_suppkey", - "t8"."s_name", - "t8"."s_address", - "t8"."s_nationkey", - "t8"."s_phone", - "t8"."s_acctbal", - "t8"."s_comment", - "t6"."n_nationkey", - "t6"."n_name", - "t6"."n_regionkey", - "t6"."n_comment" - FROM ( - SELECT - "t0"."ps_partkey", - "t0"."ps_suppkey", - "t0"."ps_availqty", - CAST("t0"."ps_supplycost" AS DECIMAL(15, 2)) AS "ps_supplycost", - "t0"."ps_comment" - FROM "hive"."ibis_tpch_sf1"."partsupp" AS "t0" - ) AS "t7" - INNER JOIN ( - SELECT - "t1"."s_suppkey", - "t1"."s_name", - "t1"."s_address", - "t1"."s_nationkey", - "t1"."s_phone", - CAST("t1"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t1"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t1" - ) AS "t8" - ON "t7"."ps_suppkey" = "t8"."s_suppkey" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t2" - ) AS "t6" - ON "t6"."n_nationkey" = "t8"."s_nationkey" - ) AS "t9" - WHERE - "t9"."n_name" = 'GERMANY' -) -SELECT - * -FROM ( - SELECT - "t11"."ps_partkey", - SUM("t11"."ps_supplycost" * "t11"."ps_availqty") AS "value" - FROM "t10" AS "t11" - GROUP BY - 1 -) AS "t12" -WHERE - "t12"."value" > ( - ( - SELECT - SUM("t11"."ps_supplycost" * "t11"."ps_availqty") AS "Sum(Multiply(ps_supplycost, ps_availqty))" - FROM "t10" AS "t11" - ) * CAST(0.0001 AS DOUBLE) - ) -ORDER BY - "t12"."value" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/datafusion/12.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/datafusion/12.sql deleted file mode 100644 index b9b4672c9023..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/datafusion/12.sql +++ /dev/null @@ -1,85 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t5"."l_shipmode", - SUM( - CASE "t5"."o_orderpriority" WHEN '1-URGENT' THEN 1 WHEN '2-HIGH' THEN 1 ELSE 0 END - ) AS "high_line_count", - SUM( - CASE "t5"."o_orderpriority" WHEN '1-URGENT' THEN 0 WHEN '2-HIGH' THEN 0 ELSE 1 END - ) AS "low_line_count" - FROM ( - SELECT - "t5"."o_orderkey", - "t5"."o_custkey", - "t5"."o_orderstatus", - "t5"."o_totalprice", - "t5"."o_orderdate", - "t5"."o_orderpriority", - "t5"."o_clerk", - "t5"."o_shippriority", - "t5"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_comment", - "t5"."l_shipmode" - FROM ( - SELECT - * - FROM ( - SELECT - "t2"."o_orderkey", - "t2"."o_custkey", - "t2"."o_orderstatus", - "t2"."o_totalprice", - "t2"."o_orderdate", - "t2"."o_orderpriority", - "t2"."o_clerk", - "t2"."o_shippriority", - "t2"."o_comment", - "t3"."l_orderkey", - "t3"."l_partkey", - "t3"."l_suppkey", - "t3"."l_linenumber", - "t3"."l_quantity", - "t3"."l_extendedprice", - "t3"."l_discount", - "t3"."l_tax", - "t3"."l_returnflag", - "t3"."l_linestatus", - "t3"."l_shipdate", - "t3"."l_commitdate", - "t3"."l_receiptdate", - "t3"."l_shipinstruct", - "t3"."l_shipmode", - "t3"."l_comment" - FROM "tpch"."orders" AS "t2" - INNER JOIN "tpch"."lineitem" AS "t3" - ON "t2"."o_orderkey" = "t3"."l_orderkey" - ) AS "t4" - WHERE - "t4"."l_shipmode" IN ('MAIL', 'SHIP') - AND "t4"."l_commitdate" < "t4"."l_receiptdate" - AND "t4"."l_shipdate" < "t4"."l_commitdate" - AND "t4"."l_receiptdate" >= DATE_TRUNC('DAY', '1994-01-01') - AND "t4"."l_receiptdate" < DATE_TRUNC('DAY', '1995-01-01') - ) AS "t5" - ) AS t5 - GROUP BY - "t5"."l_shipmode" -) AS "t6" -ORDER BY - "t6"."l_shipmode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/duckdb/12.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/duckdb/12.sql deleted file mode 100644 index ac8758b1887a..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/duckdb/12.sql +++ /dev/null @@ -1,69 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t5"."l_shipmode", - SUM( - CASE "t5"."o_orderpriority" - WHEN '1-URGENT' - THEN CAST(1 AS TINYINT) - WHEN '2-HIGH' - THEN CAST(1 AS TINYINT) - ELSE CAST(0 AS TINYINT) - END - ) AS "high_line_count", - SUM( - CASE "t5"."o_orderpriority" - WHEN '1-URGENT' - THEN CAST(0 AS TINYINT) - WHEN '2-HIGH' - THEN CAST(0 AS TINYINT) - ELSE CAST(1 AS TINYINT) - END - ) AS "low_line_count" - FROM ( - SELECT - * - FROM ( - SELECT - "t2"."o_orderkey", - "t2"."o_custkey", - "t2"."o_orderstatus", - "t2"."o_totalprice", - "t2"."o_orderdate", - "t2"."o_orderpriority", - "t2"."o_clerk", - "t2"."o_shippriority", - "t2"."o_comment", - "t3"."l_orderkey", - "t3"."l_partkey", - "t3"."l_suppkey", - "t3"."l_linenumber", - "t3"."l_quantity", - "t3"."l_extendedprice", - "t3"."l_discount", - "t3"."l_tax", - "t3"."l_returnflag", - "t3"."l_linestatus", - "t3"."l_shipdate", - "t3"."l_commitdate", - "t3"."l_receiptdate", - "t3"."l_shipinstruct", - "t3"."l_shipmode", - "t3"."l_comment" - FROM "tpch"."orders" AS "t2" - INNER JOIN "tpch"."lineitem" AS "t3" - ON "t2"."o_orderkey" = "t3"."l_orderkey" - ) AS "t4" - WHERE - "t4"."l_shipmode" IN ('MAIL', 'SHIP') - AND "t4"."l_commitdate" < "t4"."l_receiptdate" - AND "t4"."l_shipdate" < "t4"."l_commitdate" - AND "t4"."l_receiptdate" >= MAKE_DATE(1994, 1, 1) - AND "t4"."l_receiptdate" < MAKE_DATE(1995, 1, 1) - ) AS "t5" - GROUP BY - 1 -) AS "t6" -ORDER BY - "t6"."l_shipmode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/snowflake/12.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/snowflake/12.sql deleted file mode 100644 index fa5b593d4125..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/snowflake/12.sql +++ /dev/null @@ -1,88 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."l_shipmode", - SUM( - CASE "t7"."o_orderpriority" WHEN '1-URGENT' THEN 1 WHEN '2-HIGH' THEN 1 ELSE 0 END - ) AS "high_line_count", - SUM( - CASE "t7"."o_orderpriority" WHEN '1-URGENT' THEN 0 WHEN '2-HIGH' THEN 0 ELSE 1 END - ) AS "low_line_count" - FROM ( - SELECT - * - FROM ( - SELECT - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_shipmode", - "t5"."l_comment" - FROM ( - SELECT - "t0"."O_ORDERKEY" AS "o_orderkey", - "t0"."O_CUSTKEY" AS "o_custkey", - "t0"."O_ORDERSTATUS" AS "o_orderstatus", - "t0"."O_TOTALPRICE" AS "o_totalprice", - "t0"."O_ORDERDATE" AS "o_orderdate", - "t0"."O_ORDERPRIORITY" AS "o_orderpriority", - "t0"."O_CLERK" AS "o_clerk", - "t0"."O_SHIPPRIORITY" AS "o_shippriority", - "t0"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."L_ORDERKEY" AS "l_orderkey", - "t1"."L_PARTKEY" AS "l_partkey", - "t1"."L_SUPPKEY" AS "l_suppkey", - "t1"."L_LINENUMBER" AS "l_linenumber", - "t1"."L_QUANTITY" AS "l_quantity", - "t1"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t1"."L_DISCOUNT" AS "l_discount", - "t1"."L_TAX" AS "l_tax", - "t1"."L_RETURNFLAG" AS "l_returnflag", - "t1"."L_LINESTATUS" AS "l_linestatus", - "t1"."L_SHIPDATE" AS "l_shipdate", - "t1"."L_COMMITDATE" AS "l_commitdate", - "t1"."L_RECEIPTDATE" AS "l_receiptdate", - "t1"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t1"."L_SHIPMODE" AS "l_shipmode", - "t1"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t1" - ) AS "t5" - ON "t4"."o_orderkey" = "t5"."l_orderkey" - ) AS "t6" - WHERE - "t6"."l_shipmode" IN ('MAIL', 'SHIP') - AND "t6"."l_commitdate" < "t6"."l_receiptdate" - AND "t6"."l_shipdate" < "t6"."l_commitdate" - AND "t6"."l_receiptdate" >= DATE_FROM_PARTS(1994, 1, 1) - AND "t6"."l_receiptdate" < DATE_FROM_PARTS(1995, 1, 1) - ) AS "t7" - GROUP BY - 1 -) AS "t8" -ORDER BY - "t8"."l_shipmode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/trino/12.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/trino/12.sql deleted file mode 100644 index 71893f30c2f3..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_12/trino/12.sql +++ /dev/null @@ -1,88 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."l_shipmode", - SUM( - CASE "t7"."o_orderpriority" WHEN '1-URGENT' THEN 1 WHEN '2-HIGH' THEN 1 ELSE 0 END - ) AS "high_line_count", - SUM( - CASE "t7"."o_orderpriority" WHEN '1-URGENT' THEN 0 WHEN '2-HIGH' THEN 0 ELSE 1 END - ) AS "low_line_count" - FROM ( - SELECT - * - FROM ( - SELECT - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_shipmode", - "t5"."l_comment" - FROM ( - SELECT - "t0"."o_orderkey", - "t0"."o_custkey", - "t0"."o_orderstatus", - CAST("t0"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t0"."o_orderdate", - "t0"."o_orderpriority", - "t0"."o_clerk", - "t0"."o_shippriority", - "t0"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."l_orderkey", - "t1"."l_partkey", - "t1"."l_suppkey", - "t1"."l_linenumber", - CAST("t1"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t1"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t1"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t1"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t1"."l_returnflag", - "t1"."l_linestatus", - "t1"."l_shipdate", - "t1"."l_commitdate", - "t1"."l_receiptdate", - "t1"."l_shipinstruct", - "t1"."l_shipmode", - "t1"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t1" - ) AS "t5" - ON "t4"."o_orderkey" = "t5"."l_orderkey" - ) AS "t6" - WHERE - "t6"."l_shipmode" IN ('MAIL', 'SHIP') - AND "t6"."l_commitdate" < "t6"."l_receiptdate" - AND "t6"."l_shipdate" < "t6"."l_commitdate" - AND "t6"."l_receiptdate" >= FROM_ISO8601_DATE('1994-01-01') - AND "t6"."l_receiptdate" < FROM_ISO8601_DATE('1995-01-01') - ) AS "t7" - GROUP BY - 1 -) AS "t8" -ORDER BY - "t8"."l_shipmode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/datafusion/13.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/datafusion/13.sql deleted file mode 100644 index e5febd552ea4..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/datafusion/13.sql +++ /dev/null @@ -1,70 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t5"."c_count", - COUNT(*) AS "custdist" - FROM ( - SELECT - "t5"."c_custkey", - "t5"."c_count" - FROM ( - SELECT - "t4"."c_custkey", - COUNT("t4"."o_orderkey") AS "c_count" - FROM ( - SELECT - "t4"."c_name", - "t4"."c_address", - "t4"."c_nationkey", - "t4"."c_phone", - "t4"."c_acctbal", - "t4"."c_mktsegment", - "t4"."c_comment", - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t4"."c_custkey" - FROM ( - SELECT - "t2"."c_custkey", - "t2"."c_name", - "t2"."c_address", - "t2"."c_nationkey", - "t2"."c_phone", - "t2"."c_acctbal", - "t2"."c_mktsegment", - "t2"."c_comment", - "t3"."o_orderkey", - "t3"."o_custkey", - "t3"."o_orderstatus", - "t3"."o_totalprice", - "t3"."o_orderdate", - "t3"."o_orderpriority", - "t3"."o_clerk", - "t3"."o_shippriority", - "t3"."o_comment" - FROM "tpch"."customer" AS "t2" - LEFT OUTER JOIN "tpch"."orders" AS "t3" - ON "t2"."c_custkey" = "t3"."o_custkey" - AND NOT ( - "t3"."o_comment" LIKE '%special%requests%' - ) - ) AS "t4" - ) AS t4 - GROUP BY - "t4"."c_custkey" - ) AS "t5" - ) AS t5 - GROUP BY - "t5"."c_count" -) AS "t6" -ORDER BY - "t6"."custdist" DESC NULLS LAST, - "t6"."c_count" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/duckdb/13.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/duckdb/13.sql deleted file mode 100644 index a569f408499e..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/duckdb/13.sql +++ /dev/null @@ -1,45 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t5"."c_count", - COUNT(*) AS "custdist" - FROM ( - SELECT - "t4"."c_custkey", - COUNT("t4"."o_orderkey") AS "c_count" - FROM ( - SELECT - "t2"."c_custkey", - "t2"."c_name", - "t2"."c_address", - "t2"."c_nationkey", - "t2"."c_phone", - "t2"."c_acctbal", - "t2"."c_mktsegment", - "t2"."c_comment", - "t3"."o_orderkey", - "t3"."o_custkey", - "t3"."o_orderstatus", - "t3"."o_totalprice", - "t3"."o_orderdate", - "t3"."o_orderpriority", - "t3"."o_clerk", - "t3"."o_shippriority", - "t3"."o_comment" - FROM "tpch"."customer" AS "t2" - LEFT OUTER JOIN "tpch"."orders" AS "t3" - ON "t2"."c_custkey" = "t3"."o_custkey" - AND NOT ( - "t3"."o_comment" LIKE '%special%requests%' - ) - ) AS "t4" - GROUP BY - 1 - ) AS "t5" - GROUP BY - 1 -) AS "t6" -ORDER BY - "t6"."custdist" DESC, - "t6"."c_count" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/snowflake/13.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/snowflake/13.sql deleted file mode 100644 index 3c052ecd0da8..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/snowflake/13.sql +++ /dev/null @@ -1,68 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."c_count", - COUNT(*) AS "custdist" - FROM ( - SELECT - "t6"."c_custkey", - COUNT("t6"."o_orderkey") AS "c_count" - FROM ( - SELECT - "t4"."c_custkey", - "t4"."c_name", - "t4"."c_address", - "t4"."c_nationkey", - "t4"."c_phone", - "t4"."c_acctbal", - "t4"."c_mktsegment", - "t4"."c_comment", - "t5"."o_orderkey", - "t5"."o_custkey", - "t5"."o_orderstatus", - "t5"."o_totalprice", - "t5"."o_orderdate", - "t5"."o_orderpriority", - "t5"."o_clerk", - "t5"."o_shippriority", - "t5"."o_comment" - FROM ( - SELECT - "t0"."C_CUSTKEY" AS "c_custkey", - "t0"."C_NAME" AS "c_name", - "t0"."C_ADDRESS" AS "c_address", - "t0"."C_NATIONKEY" AS "c_nationkey", - "t0"."C_PHONE" AS "c_phone", - "t0"."C_ACCTBAL" AS "c_acctbal", - "t0"."C_MKTSEGMENT" AS "c_mktsegment", - "t0"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t0" - ) AS "t4" - LEFT OUTER JOIN ( - SELECT - "t1"."O_ORDERKEY" AS "o_orderkey", - "t1"."O_CUSTKEY" AS "o_custkey", - "t1"."O_ORDERSTATUS" AS "o_orderstatus", - "t1"."O_TOTALPRICE" AS "o_totalprice", - "t1"."O_ORDERDATE" AS "o_orderdate", - "t1"."O_ORDERPRIORITY" AS "o_orderpriority", - "t1"."O_CLERK" AS "o_clerk", - "t1"."O_SHIPPRIORITY" AS "o_shippriority", - "t1"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t1" - ) AS "t5" - ON "t4"."c_custkey" = "t5"."o_custkey" - AND NOT ( - "t5"."o_comment" LIKE '%special%requests%' - ) - ) AS "t6" - GROUP BY - 1 - ) AS "t7" - GROUP BY - 1 -) AS "t8" -ORDER BY - "t8"."custdist" DESC NULLS LAST, - "t8"."c_count" DESC NULLS LAST \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/trino/13.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/trino/13.sql deleted file mode 100644 index 9d77f4c47910..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_13/trino/13.sql +++ /dev/null @@ -1,68 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."c_count", - COUNT(*) AS "custdist" - FROM ( - SELECT - "t6"."c_custkey", - COUNT("t6"."o_orderkey") AS "c_count" - FROM ( - SELECT - "t4"."c_custkey", - "t4"."c_name", - "t4"."c_address", - "t4"."c_nationkey", - "t4"."c_phone", - "t4"."c_acctbal", - "t4"."c_mktsegment", - "t4"."c_comment", - "t5"."o_orderkey", - "t5"."o_custkey", - "t5"."o_orderstatus", - "t5"."o_totalprice", - "t5"."o_orderdate", - "t5"."o_orderpriority", - "t5"."o_clerk", - "t5"."o_shippriority", - "t5"."o_comment" - FROM ( - SELECT - "t0"."c_custkey", - "t0"."c_name", - "t0"."c_address", - "t0"."c_nationkey", - "t0"."c_phone", - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t0"."c_mktsegment", - "t0"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t0" - ) AS "t4" - LEFT OUTER JOIN ( - SELECT - "t1"."o_orderkey", - "t1"."o_custkey", - "t1"."o_orderstatus", - CAST("t1"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t1"."o_orderdate", - "t1"."o_orderpriority", - "t1"."o_clerk", - "t1"."o_shippriority", - "t1"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t1" - ) AS "t5" - ON "t4"."c_custkey" = "t5"."o_custkey" - AND NOT ( - "t5"."o_comment" LIKE '%special%requests%' - ) - ) AS "t6" - GROUP BY - 1 - ) AS "t7" - GROUP BY - 1 -) AS "t8" -ORDER BY - "t8"."custdist" DESC, - "t8"."c_count" DESC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/datafusion/14.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/datafusion/14.sql deleted file mode 100644 index 98b13e37be08..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/datafusion/14.sql +++ /dev/null @@ -1,52 +0,0 @@ -SELECT - CAST(( - SUM( - CASE - WHEN "t5"."p_type" LIKE 'PROMO%' - THEN "t5"."l_extendedprice" * ( - 1 - "t5"."l_discount" - ) - ELSE 0 - END - ) * 100 - ) AS DOUBLE PRECISION) / SUM("t5"."l_extendedprice" * ( - 1 - "t5"."l_discount" - )) AS "promo_revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - "t3"."p_retailprice", - "t3"."p_comment" - FROM "tpch"."lineitem" AS "t2" - INNER JOIN "tpch"."part" AS "t3" - ON "t2"."l_partkey" = "t3"."p_partkey" - ) AS "t4" - WHERE - "t4"."l_shipdate" >= DATE_TRUNC('DAY', '1995-09-01') - AND "t4"."l_shipdate" < DATE_TRUNC('DAY', '1995-10-01') -) AS "t5" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/duckdb/14.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/duckdb/14.sql deleted file mode 100644 index fa5b2f6303f4..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/duckdb/14.sql +++ /dev/null @@ -1,52 +0,0 @@ -SELECT - ( - SUM( - CASE - WHEN "t5"."p_type" LIKE 'PROMO%' - THEN "t5"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t5"."l_discount" - ) - ELSE CAST(0 AS TINYINT) - END - ) * CAST(100 AS TINYINT) - ) / SUM("t5"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t5"."l_discount" - )) AS "promo_revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - "t3"."p_retailprice", - "t3"."p_comment" - FROM "tpch"."lineitem" AS "t2" - INNER JOIN "tpch"."part" AS "t3" - ON "t2"."l_partkey" = "t3"."p_partkey" - ) AS "t4" - WHERE - "t4"."l_shipdate" >= MAKE_DATE(1995, 9, 1) - AND "t4"."l_shipdate" < MAKE_DATE(1995, 10, 1) -) AS "t5" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/snowflake/14.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/snowflake/14.sql deleted file mode 100644 index 6f2aa9cbdb05..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/snowflake/14.sql +++ /dev/null @@ -1,79 +0,0 @@ -SELECT - ( - SUM( - IFF("t7"."p_type" LIKE 'PROMO%', "t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - ), 0) - ) * 100 - ) / SUM("t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - )) AS "promo_revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - "t4"."l_quantity", - "t4"."l_extendedprice", - "t4"."l_discount", - "t4"."l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment", - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment" - FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."P_PARTKEY" AS "p_partkey", - "t1"."P_NAME" AS "p_name", - "t1"."P_MFGR" AS "p_mfgr", - "t1"."P_BRAND" AS "p_brand", - "t1"."P_TYPE" AS "p_type", - "t1"."P_SIZE" AS "p_size", - "t1"."P_CONTAINER" AS "p_container", - "t1"."P_RETAILPRICE" AS "p_retailprice", - "t1"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t1" - ) AS "t5" - ON "t4"."l_partkey" = "t5"."p_partkey" - ) AS "t6" - WHERE - "t6"."l_shipdate" >= DATE_FROM_PARTS(1995, 9, 1) - AND "t6"."l_shipdate" < DATE_FROM_PARTS(1995, 10, 1) -) AS "t7" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/trino/14.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/trino/14.sql deleted file mode 100644 index 32d5b3c55073..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_14/trino/14.sql +++ /dev/null @@ -1,79 +0,0 @@ -SELECT - CAST(( - SUM( - IF("t7"."p_type" LIKE 'PROMO%', "t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - ), 0) - ) * 100 - ) AS DOUBLE) / SUM("t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - )) AS "promo_revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - "t4"."l_quantity", - "t4"."l_extendedprice", - "t4"."l_discount", - "t4"."l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment", - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment" - FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."p_partkey", - "t1"."p_name", - "t1"."p_mfgr", - "t1"."p_brand", - "t1"."p_type", - "t1"."p_size", - "t1"."p_container", - CAST("t1"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t1"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t1" - ) AS "t5" - ON "t4"."l_partkey" = "t5"."p_partkey" - ) AS "t6" - WHERE - "t6"."l_shipdate" >= FROM_ISO8601_DATE('1995-09-01') - AND "t6"."l_shipdate" < FROM_ISO8601_DATE('1995-10-01') -) AS "t7" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/datafusion/15.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/datafusion/15.sql deleted file mode 100644 index 869c62e8e9ff..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/datafusion/15.sql +++ /dev/null @@ -1,65 +0,0 @@ -WITH "t6" AS ( - SELECT - "t2"."s_suppkey", - "t2"."s_name", - "t2"."s_address", - "t2"."s_nationkey", - "t2"."s_phone", - "t2"."s_acctbal", - "t2"."s_comment", - "t5"."l_suppkey", - "t5"."total_revenue" - FROM "tpch"."supplier" AS "t2" - INNER JOIN ( - SELECT - "t3"."l_suppkey", - SUM("t3"."l_extendedprice" * ( - 1 - "t3"."l_discount" - )) AS "total_revenue" - FROM ( - SELECT - "t3"."l_orderkey", - "t3"."l_partkey", - "t3"."l_linenumber", - "t3"."l_quantity", - "t3"."l_extendedprice", - "t3"."l_discount", - "t3"."l_tax", - "t3"."l_returnflag", - "t3"."l_linestatus", - "t3"."l_shipdate", - "t3"."l_commitdate", - "t3"."l_receiptdate", - "t3"."l_shipinstruct", - "t3"."l_shipmode", - "t3"."l_comment", - "t3"."l_suppkey" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t1" - WHERE - "t1"."l_shipdate" >= DATE_TRUNC('DAY', '1996-01-01') - AND "t1"."l_shipdate" < DATE_TRUNC('DAY', '1996-04-01') - ) AS "t3" - ) AS t3 - GROUP BY - "t3"."l_suppkey" - ) AS "t5" - ON "t2"."s_suppkey" = "t5"."l_suppkey" -) -SELECT - "t7"."s_suppkey", - "t7"."s_name", - "t7"."s_address", - "t7"."s_phone", - "t7"."total_revenue" -FROM "t6" AS "t7" -WHERE - "t7"."total_revenue" = ( - SELECT - MAX("t7"."total_revenue") AS "Max(total_revenue)" - FROM "t6" AS "t7" - ) -ORDER BY - "t7"."s_suppkey" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/duckdb/15.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/duckdb/15.sql deleted file mode 100644 index 6ae1b2174209..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/duckdb/15.sql +++ /dev/null @@ -1,46 +0,0 @@ -WITH "t6" AS ( - SELECT - "t2"."s_suppkey", - "t2"."s_name", - "t2"."s_address", - "t2"."s_nationkey", - "t2"."s_phone", - "t2"."s_acctbal", - "t2"."s_comment", - "t5"."l_suppkey", - "t5"."total_revenue" - FROM "tpch"."supplier" AS "t2" - INNER JOIN ( - SELECT - "t3"."l_suppkey", - SUM("t3"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t3"."l_discount" - )) AS "total_revenue" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t1" - WHERE - "t1"."l_shipdate" >= MAKE_DATE(1996, 1, 1) - AND "t1"."l_shipdate" < MAKE_DATE(1996, 4, 1) - ) AS "t3" - GROUP BY - 1 - ) AS "t5" - ON "t2"."s_suppkey" = "t5"."l_suppkey" -) -SELECT - "t7"."s_suppkey", - "t7"."s_name", - "t7"."s_address", - "t7"."s_phone", - "t7"."total_revenue" -FROM "t6" AS "t7" -WHERE - "t7"."total_revenue" = ( - SELECT - MAX("t7"."total_revenue") AS "Max(total_revenue)" - FROM "t6" AS "t7" - ) -ORDER BY - "t7"."s_suppkey" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/snowflake/15.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/snowflake/15.sql deleted file mode 100644 index d780374b3a5f..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_15/snowflake/15.sql +++ /dev/null @@ -1,71 +0,0 @@ -WITH "t7" AS ( - SELECT - "t3"."s_suppkey", - "t3"."s_name", - "t3"."s_address", - "t3"."s_nationkey", - "t3"."s_phone", - "t3"."s_acctbal", - "t3"."s_comment", - "t6"."l_suppkey", - "t6"."total_revenue" - FROM ( - SELECT - "t0"."S_SUPPKEY" AS "s_suppkey", - "t0"."S_NAME" AS "s_name", - "t0"."S_ADDRESS" AS "s_address", - "t0"."S_NATIONKEY" AS "s_nationkey", - "t0"."S_PHONE" AS "s_phone", - "t0"."S_ACCTBAL" AS "s_acctbal", - "t0"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t0" - ) AS "t3" - INNER JOIN ( - SELECT - "t4"."l_suppkey", - SUM("t4"."l_extendedprice" * ( - 1 - "t4"."l_discount" - )) AS "total_revenue" - FROM ( - SELECT - "t1"."L_ORDERKEY" AS "l_orderkey", - "t1"."L_PARTKEY" AS "l_partkey", - "t1"."L_SUPPKEY" AS "l_suppkey", - "t1"."L_LINENUMBER" AS "l_linenumber", - "t1"."L_QUANTITY" AS "l_quantity", - "t1"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t1"."L_DISCOUNT" AS "l_discount", - "t1"."L_TAX" AS "l_tax", - "t1"."L_RETURNFLAG" AS "l_returnflag", - "t1"."L_LINESTATUS" AS "l_linestatus", - "t1"."L_SHIPDATE" AS "l_shipdate", - "t1"."L_COMMITDATE" AS "l_commitdate", - "t1"."L_RECEIPTDATE" AS "l_receiptdate", - "t1"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t1"."L_SHIPMODE" AS "l_shipmode", - "t1"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t1" - WHERE - "t1"."L_SHIPDATE" >= DATE_FROM_PARTS(1996, 1, 1) - AND "t1"."L_SHIPDATE" < DATE_FROM_PARTS(1996, 4, 1) - ) AS "t4" - GROUP BY - 1 - ) AS "t6" - ON "t3"."s_suppkey" = "t6"."l_suppkey" -) -SELECT - "t8"."s_suppkey", - "t8"."s_name", - "t8"."s_address", - "t8"."s_phone", - "t8"."total_revenue" -FROM "t7" AS "t8" -WHERE - "t8"."total_revenue" = ( - SELECT - MAX("t8"."total_revenue") AS "Max(total_revenue)" - FROM "t7" AS "t8" - ) -ORDER BY - "t8"."s_suppkey" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/duckdb/16.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/duckdb/16.sql deleted file mode 100644 index d2b708184ca3..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/duckdb/16.sql +++ /dev/null @@ -1,57 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."p_brand", - "t7"."p_type", - "t7"."p_size", - COUNT(DISTINCT "t7"."ps_suppkey") AS "supplier_cnt" - FROM ( - SELECT - * - FROM ( - SELECT - "t3"."ps_partkey", - "t3"."ps_suppkey", - "t3"."ps_availqty", - "t3"."ps_supplycost", - "t3"."ps_comment", - "t4"."p_partkey", - "t4"."p_name", - "t4"."p_mfgr", - "t4"."p_brand", - "t4"."p_type", - "t4"."p_size", - "t4"."p_container", - "t4"."p_retailprice", - "t4"."p_comment" - FROM "tpch"."partsupp" AS "t3" - INNER JOIN "tpch"."part" AS "t4" - ON "t4"."p_partkey" = "t3"."ps_partkey" - ) AS "t6" - WHERE - "t6"."p_brand" <> 'Brand#45' - AND NOT ( - "t6"."p_type" LIKE 'MEDIUM POLISHED%' - ) - AND "t6"."p_size" IN (CAST(49 AS TINYINT), CAST(14 AS TINYINT), CAST(23 AS TINYINT), CAST(45 AS TINYINT), CAST(19 AS TINYINT), CAST(3 AS TINYINT), CAST(36 AS TINYINT), CAST(9 AS TINYINT)) - AND NOT ( - "t6"."ps_suppkey" IN ( - SELECT - "t2"."s_suppkey" - FROM "tpch"."supplier" AS "t2" - WHERE - "t2"."s_comment" LIKE '%Customer%Complaints%' - ) - ) - ) AS "t7" - GROUP BY - 1, - 2, - 3 -) AS "t8" -ORDER BY - "t8"."supplier_cnt" DESC, - "t8"."p_brand" ASC, - "t8"."p_type" ASC, - "t8"."p_size" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/snowflake/16.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/snowflake/16.sql deleted file mode 100644 index 9eb111dcf7fd..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/snowflake/16.sql +++ /dev/null @@ -1,77 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t9"."p_brand", - "t9"."p_type", - "t9"."p_size", - COUNT(DISTINCT "t9"."ps_suppkey") AS "supplier_cnt" - FROM ( - SELECT - * - FROM ( - SELECT - "t5"."ps_partkey", - "t5"."ps_suppkey", - "t5"."ps_availqty", - "t5"."ps_supplycost", - "t5"."ps_comment", - "t7"."p_partkey", - "t7"."p_name", - "t7"."p_mfgr", - "t7"."p_brand", - "t7"."p_type", - "t7"."p_size", - "t7"."p_container", - "t7"."p_retailprice", - "t7"."p_comment" - FROM ( - SELECT - "t0"."PS_PARTKEY" AS "ps_partkey", - "t0"."PS_SUPPKEY" AS "ps_suppkey", - "t0"."PS_AVAILQTY" AS "ps_availqty", - "t0"."PS_SUPPLYCOST" AS "ps_supplycost", - "t0"."PS_COMMENT" AS "ps_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PARTSUPP" AS "t0" - ) AS "t5" - INNER JOIN ( - SELECT - "t2"."P_PARTKEY" AS "p_partkey", - "t2"."P_NAME" AS "p_name", - "t2"."P_MFGR" AS "p_mfgr", - "t2"."P_BRAND" AS "p_brand", - "t2"."P_TYPE" AS "p_type", - "t2"."P_SIZE" AS "p_size", - "t2"."P_CONTAINER" AS "p_container", - "t2"."P_RETAILPRICE" AS "p_retailprice", - "t2"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t2" - ) AS "t7" - ON "t7"."p_partkey" = "t5"."ps_partkey" - ) AS "t8" - WHERE - "t8"."p_brand" <> 'Brand#45' - AND NOT ( - "t8"."p_type" LIKE 'MEDIUM POLISHED%' - ) - AND "t8"."p_size" IN (49, 14, 23, 45, 19, 3, 36, 9) - AND NOT ( - "t8"."ps_suppkey" IN ( - SELECT - "t1"."S_SUPPKEY" AS "s_suppkey" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t1" - WHERE - "t1"."S_COMMENT" LIKE '%Customer%Complaints%' - ) - ) - ) AS "t9" - GROUP BY - 1, - 2, - 3 -) AS "t10" -ORDER BY - "t10"."supplier_cnt" DESC NULLS LAST, - "t10"."p_brand" ASC, - "t10"."p_type" ASC, - "t10"."p_size" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/trino/16.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/trino/16.sql deleted file mode 100644 index 90cbe3a4da7d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_16/trino/16.sql +++ /dev/null @@ -1,77 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t9"."p_brand", - "t9"."p_type", - "t9"."p_size", - COUNT(DISTINCT "t9"."ps_suppkey") AS "supplier_cnt" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."ps_partkey", - "t6"."ps_suppkey", - "t6"."ps_availqty", - "t6"."ps_supplycost", - "t6"."ps_comment", - "t7"."p_partkey", - "t7"."p_name", - "t7"."p_mfgr", - "t7"."p_brand", - "t7"."p_type", - "t7"."p_size", - "t7"."p_container", - "t7"."p_retailprice", - "t7"."p_comment" - FROM ( - SELECT - "t0"."ps_partkey", - "t0"."ps_suppkey", - "t0"."ps_availqty", - CAST("t0"."ps_supplycost" AS DECIMAL(15, 2)) AS "ps_supplycost", - "t0"."ps_comment" - FROM "hive"."ibis_tpch_sf1"."partsupp" AS "t0" - ) AS "t6" - INNER JOIN ( - SELECT - "t2"."p_partkey", - "t2"."p_name", - "t2"."p_mfgr", - "t2"."p_brand", - "t2"."p_type", - "t2"."p_size", - "t2"."p_container", - CAST("t2"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t2"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t2" - ) AS "t7" - ON "t7"."p_partkey" = "t6"."ps_partkey" - ) AS "t8" - WHERE - "t8"."p_brand" <> 'Brand#45' - AND NOT ( - "t8"."p_type" LIKE 'MEDIUM POLISHED%' - ) - AND "t8"."p_size" IN (49, 14, 23, 45, 19, 3, 36, 9) - AND NOT ( - "t8"."ps_suppkey" IN ( - SELECT - "t1"."s_suppkey" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t1" - WHERE - "t1"."s_comment" LIKE '%Customer%Complaints%' - ) - ) - ) AS "t9" - GROUP BY - 1, - 2, - 3 -) AS "t10" -ORDER BY - "t10"."supplier_cnt" DESC, - "t10"."p_brand" ASC, - "t10"."p_type" ASC, - "t10"."p_size" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/datafusion/17.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/datafusion/17.sql deleted file mode 100644 index f7d37a80034d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/datafusion/17.sql +++ /dev/null @@ -1,53 +0,0 @@ -SELECT - CAST(SUM("t7"."l_extendedprice") AS DOUBLE PRECISION) / 7.0 AS "avg_yearly" -FROM ( - SELECT - * - FROM ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - "t3"."p_retailprice", - "t3"."p_comment" - FROM "tpch"."lineitem" AS "t2" - INNER JOIN "tpch"."part" AS "t3" - ON "t3"."p_partkey" = "t2"."l_partkey" - ) AS "t4" - WHERE - "t4"."p_brand" = 'Brand#23' - AND "t4"."p_container" = 'MED BOX' - AND "t4"."l_quantity" < ( - ( - SELECT - AVG("t5"."l_quantity") AS "Mean(l_quantity)" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t0" - WHERE - "t0"."l_partkey" = "t4"."p_partkey" - ) AS "t5" - ) * 0.2 - ) -) AS "t7" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/duckdb/17.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/duckdb/17.sql deleted file mode 100644 index 810ce31504eb..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/duckdb/17.sql +++ /dev/null @@ -1,53 +0,0 @@ -SELECT - SUM("t7"."l_extendedprice") / CAST(7.0 AS DOUBLE) AS "avg_yearly" -FROM ( - SELECT - * - FROM ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - "t3"."p_retailprice", - "t3"."p_comment" - FROM "tpch"."lineitem" AS "t2" - INNER JOIN "tpch"."part" AS "t3" - ON "t3"."p_partkey" = "t2"."l_partkey" - ) AS "t4" - WHERE - "t4"."p_brand" = 'Brand#23' - AND "t4"."p_container" = 'MED BOX' - AND "t4"."l_quantity" < ( - ( - SELECT - AVG("t5"."l_quantity") AS "Mean(l_quantity)" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t0" - WHERE - "t0"."l_partkey" = "t4"."p_partkey" - ) AS "t5" - ) * CAST(0.2 AS DOUBLE) - ) -) AS "t7" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/snowflake/17.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/snowflake/17.sql deleted file mode 100644 index e3eeb4e1617c..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/snowflake/17.sql +++ /dev/null @@ -1,99 +0,0 @@ -SELECT - SUM("t9"."l_extendedprice") / 7.0 AS "avg_yearly" -FROM ( - SELECT - * - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - "t4"."l_quantity", - "t4"."l_extendedprice", - "t4"."l_discount", - "t4"."l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment", - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment" - FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."P_PARTKEY" AS "p_partkey", - "t1"."P_NAME" AS "p_name", - "t1"."P_MFGR" AS "p_mfgr", - "t1"."P_BRAND" AS "p_brand", - "t1"."P_TYPE" AS "p_type", - "t1"."P_SIZE" AS "p_size", - "t1"."P_CONTAINER" AS "p_container", - "t1"."P_RETAILPRICE" AS "p_retailprice", - "t1"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t1" - ) AS "t5" - ON "t5"."p_partkey" = "t4"."l_partkey" - ) AS "t6" - WHERE - "t6"."p_brand" = 'Brand#23' - AND "t6"."p_container" = 'MED BOX' - AND "t6"."l_quantity" < ( - ( - SELECT - AVG("t7"."l_quantity") AS "Mean(l_quantity)" - FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - WHERE - "t0"."L_PARTKEY" = "t6"."p_partkey" - ) AS "t7" - ) * 0.2 - ) -) AS "t9" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/trino/17.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/trino/17.sql deleted file mode 100644 index d6c19873b9f4..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_17/trino/17.sql +++ /dev/null @@ -1,99 +0,0 @@ -SELECT - SUM("t9"."l_extendedprice") / CAST(7.0 AS DOUBLE) AS "avg_yearly" -FROM ( - SELECT - * - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - "t4"."l_quantity", - "t4"."l_extendedprice", - "t4"."l_discount", - "t4"."l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment", - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment" - FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."p_partkey", - "t1"."p_name", - "t1"."p_mfgr", - "t1"."p_brand", - "t1"."p_type", - "t1"."p_size", - "t1"."p_container", - CAST("t1"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t1"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t1" - ) AS "t5" - ON "t5"."p_partkey" = "t4"."l_partkey" - ) AS "t6" - WHERE - "t6"."p_brand" = 'Brand#23' - AND "t6"."p_container" = 'MED BOX' - AND "t6"."l_quantity" < ( - ( - SELECT - AVG("t7"."l_quantity") AS "Mean(l_quantity)" - FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - WHERE - "t0"."l_partkey" = "t6"."p_partkey" - ) AS "t7" - ) * CAST(0.2 AS DOUBLE) - ) -) AS "t9" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/datafusion/18.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/datafusion/18.sql deleted file mode 100644 index 2c252acd783e..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/datafusion/18.sql +++ /dev/null @@ -1,136 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t9"."c_name", - "t9"."c_custkey", - "t9"."o_orderkey", - "t9"."o_orderdate", - "t9"."o_totalprice", - SUM("t9"."l_quantity") AS "sum_qty" - FROM ( - SELECT - "t9"."c_address", - "t9"."c_nationkey", - "t9"."c_phone", - "t9"."c_acctbal", - "t9"."c_mktsegment", - "t9"."c_comment", - "t9"."o_custkey", - "t9"."o_orderstatus", - "t9"."o_orderpriority", - "t9"."o_clerk", - "t9"."o_shippriority", - "t9"."o_comment", - "t9"."l_orderkey", - "t9"."l_partkey", - "t9"."l_suppkey", - "t9"."l_linenumber", - "t9"."l_quantity", - "t9"."l_extendedprice", - "t9"."l_discount", - "t9"."l_tax", - "t9"."l_returnflag", - "t9"."l_linestatus", - "t9"."l_shipdate", - "t9"."l_commitdate", - "t9"."l_receiptdate", - "t9"."l_shipinstruct", - "t9"."l_shipmode", - "t9"."l_comment", - "t9"."c_name", - "t9"."c_custkey", - "t9"."o_orderkey", - "t9"."o_orderdate", - "t9"."o_totalprice" - FROM ( - SELECT - * - FROM ( - SELECT - "t3"."c_custkey", - "t3"."c_name", - "t3"."c_address", - "t3"."c_nationkey", - "t3"."c_phone", - "t3"."c_acctbal", - "t3"."c_mktsegment", - "t3"."c_comment", - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_shipmode", - "t5"."l_comment" - FROM "tpch"."customer" AS "t3" - INNER JOIN "tpch"."orders" AS "t4" - ON "t3"."c_custkey" = "t4"."o_custkey" - INNER JOIN "tpch"."lineitem" AS "t5" - ON "t4"."o_orderkey" = "t5"."l_orderkey" - ) AS "t7" - WHERE - "t7"."o_orderkey" IN ( - SELECT - "t6"."l_orderkey" - FROM ( - SELECT - "t2"."l_orderkey", - SUM("t2"."l_quantity") AS "qty_sum" - FROM ( - SELECT - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t2"."l_orderkey" - FROM "tpch"."lineitem" AS "t2" - ) AS t2 - GROUP BY - "t2"."l_orderkey" - ) AS "t6" - WHERE - "t6"."qty_sum" > 300 - ) - ) AS "t9" - ) AS t9 - GROUP BY - "t9"."c_name", - "t9"."c_custkey", - "t9"."o_orderkey", - "t9"."o_orderdate", - "t9"."o_totalprice" -) AS "t10" -ORDER BY - "t10"."o_totalprice" DESC NULLS LAST, - "t10"."o_orderdate" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/duckdb/18.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/duckdb/18.sql deleted file mode 100644 index 3e2b3d7e3f9c..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/duckdb/18.sql +++ /dev/null @@ -1,81 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t9"."c_name", - "t9"."c_custkey", - "t9"."o_orderkey", - "t9"."o_orderdate", - "t9"."o_totalprice", - SUM("t9"."l_quantity") AS "sum_qty" - FROM ( - SELECT - * - FROM ( - SELECT - "t3"."c_custkey", - "t3"."c_name", - "t3"."c_address", - "t3"."c_nationkey", - "t3"."c_phone", - "t3"."c_acctbal", - "t3"."c_mktsegment", - "t3"."c_comment", - "t4"."o_orderkey", - "t4"."o_custkey", - "t4"."o_orderstatus", - "t4"."o_totalprice", - "t4"."o_orderdate", - "t4"."o_orderpriority", - "t4"."o_clerk", - "t4"."o_shippriority", - "t4"."o_comment", - "t5"."l_orderkey", - "t5"."l_partkey", - "t5"."l_suppkey", - "t5"."l_linenumber", - "t5"."l_quantity", - "t5"."l_extendedprice", - "t5"."l_discount", - "t5"."l_tax", - "t5"."l_returnflag", - "t5"."l_linestatus", - "t5"."l_shipdate", - "t5"."l_commitdate", - "t5"."l_receiptdate", - "t5"."l_shipinstruct", - "t5"."l_shipmode", - "t5"."l_comment" - FROM "tpch"."customer" AS "t3" - INNER JOIN "tpch"."orders" AS "t4" - ON "t3"."c_custkey" = "t4"."o_custkey" - INNER JOIN "tpch"."lineitem" AS "t5" - ON "t4"."o_orderkey" = "t5"."l_orderkey" - ) AS "t7" - WHERE - "t7"."o_orderkey" IN ( - SELECT - "t6"."l_orderkey" - FROM ( - SELECT - "t2"."l_orderkey", - SUM("t2"."l_quantity") AS "qty_sum" - FROM "tpch"."lineitem" AS "t2" - GROUP BY - 1 - ) AS "t6" - WHERE - "t6"."qty_sum" > CAST(300 AS SMALLINT) - ) - ) AS "t9" - GROUP BY - 1, - 2, - 3, - 4, - 5 -) AS "t10" -ORDER BY - "t10"."o_totalprice" DESC, - "t10"."o_orderdate" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/snowflake/18.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/snowflake/18.sql deleted file mode 100644 index aea04a3d5e75..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/snowflake/18.sql +++ /dev/null @@ -1,124 +0,0 @@ -WITH "t5" AS ( - SELECT - "t2"."L_ORDERKEY" AS "l_orderkey", - "t2"."L_PARTKEY" AS "l_partkey", - "t2"."L_SUPPKEY" AS "l_suppkey", - "t2"."L_LINENUMBER" AS "l_linenumber", - "t2"."L_QUANTITY" AS "l_quantity", - "t2"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t2"."L_DISCOUNT" AS "l_discount", - "t2"."L_TAX" AS "l_tax", - "t2"."L_RETURNFLAG" AS "l_returnflag", - "t2"."L_LINESTATUS" AS "l_linestatus", - "t2"."L_SHIPDATE" AS "l_shipdate", - "t2"."L_COMMITDATE" AS "l_commitdate", - "t2"."L_RECEIPTDATE" AS "l_receiptdate", - "t2"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t2"."L_SHIPMODE" AS "l_shipmode", - "t2"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t2" -) -SELECT - * -FROM ( - SELECT - "t13"."c_name", - "t13"."c_custkey", - "t13"."o_orderkey", - "t13"."o_orderdate", - "t13"."o_totalprice", - SUM("t13"."l_quantity") AS "sum_qty" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."c_custkey", - "t6"."c_name", - "t6"."c_address", - "t6"."c_nationkey", - "t6"."c_phone", - "t6"."c_acctbal", - "t6"."c_mktsegment", - "t6"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderdate", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_shippriority", - "t7"."o_comment", - "t9"."l_orderkey", - "t9"."l_partkey", - "t9"."l_suppkey", - "t9"."l_linenumber", - "t9"."l_quantity", - "t9"."l_extendedprice", - "t9"."l_discount", - "t9"."l_tax", - "t9"."l_returnflag", - "t9"."l_linestatus", - "t9"."l_shipdate", - "t9"."l_commitdate", - "t9"."l_receiptdate", - "t9"."l_shipinstruct", - "t9"."l_shipmode", - "t9"."l_comment" - FROM ( - SELECT - "t0"."C_CUSTKEY" AS "c_custkey", - "t0"."C_NAME" AS "c_name", - "t0"."C_ADDRESS" AS "c_address", - "t0"."C_NATIONKEY" AS "c_nationkey", - "t0"."C_PHONE" AS "c_phone", - "t0"."C_ACCTBAL" AS "c_acctbal", - "t0"."C_MKTSEGMENT" AS "c_mktsegment", - "t0"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t0" - ) AS "t6" - INNER JOIN ( - SELECT - "t1"."O_ORDERKEY" AS "o_orderkey", - "t1"."O_CUSTKEY" AS "o_custkey", - "t1"."O_ORDERSTATUS" AS "o_orderstatus", - "t1"."O_TOTALPRICE" AS "o_totalprice", - "t1"."O_ORDERDATE" AS "o_orderdate", - "t1"."O_ORDERPRIORITY" AS "o_orderpriority", - "t1"."O_CLERK" AS "o_clerk", - "t1"."O_SHIPPRIORITY" AS "o_shippriority", - "t1"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t1" - ) AS "t7" - ON "t6"."c_custkey" = "t7"."o_custkey" - INNER JOIN "t5" AS "t9" - ON "t7"."o_orderkey" = "t9"."l_orderkey" - ) AS "t11" - WHERE - "t11"."o_orderkey" IN ( - SELECT - "t10"."l_orderkey" - FROM ( - SELECT - "t8"."l_orderkey", - SUM("t8"."l_quantity") AS "qty_sum" - FROM "t5" AS "t8" - GROUP BY - 1 - ) AS "t10" - WHERE - "t10"."qty_sum" > 300 - ) - ) AS "t13" - GROUP BY - 1, - 2, - 3, - 4, - 5 -) AS "t14" -ORDER BY - "t14"."o_totalprice" DESC NULLS LAST, - "t14"."o_orderdate" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/trino/18.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/trino/18.sql deleted file mode 100644 index d0630d6ecc02..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_18/trino/18.sql +++ /dev/null @@ -1,124 +0,0 @@ -WITH "t5" AS ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - CAST("t2"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t2"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t2"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t2"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t2" -) -SELECT - * -FROM ( - SELECT - "t13"."c_name", - "t13"."c_custkey", - "t13"."o_orderkey", - "t13"."o_orderdate", - "t13"."o_totalprice", - SUM("t13"."l_quantity") AS "sum_qty" - FROM ( - SELECT - * - FROM ( - SELECT - "t6"."c_custkey", - "t6"."c_name", - "t6"."c_address", - "t6"."c_nationkey", - "t6"."c_phone", - "t6"."c_acctbal", - "t6"."c_mktsegment", - "t6"."c_comment", - "t7"."o_orderkey", - "t7"."o_custkey", - "t7"."o_orderstatus", - "t7"."o_totalprice", - "t7"."o_orderdate", - "t7"."o_orderpriority", - "t7"."o_clerk", - "t7"."o_shippriority", - "t7"."o_comment", - "t9"."l_orderkey", - "t9"."l_partkey", - "t9"."l_suppkey", - "t9"."l_linenumber", - "t9"."l_quantity", - "t9"."l_extendedprice", - "t9"."l_discount", - "t9"."l_tax", - "t9"."l_returnflag", - "t9"."l_linestatus", - "t9"."l_shipdate", - "t9"."l_commitdate", - "t9"."l_receiptdate", - "t9"."l_shipinstruct", - "t9"."l_shipmode", - "t9"."l_comment" - FROM ( - SELECT - "t0"."c_custkey", - "t0"."c_name", - "t0"."c_address", - "t0"."c_nationkey", - "t0"."c_phone", - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t0"."c_mktsegment", - "t0"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t0" - ) AS "t6" - INNER JOIN ( - SELECT - "t1"."o_orderkey", - "t1"."o_custkey", - "t1"."o_orderstatus", - CAST("t1"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t1"."o_orderdate", - "t1"."o_orderpriority", - "t1"."o_clerk", - "t1"."o_shippriority", - "t1"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t1" - ) AS "t7" - ON "t6"."c_custkey" = "t7"."o_custkey" - INNER JOIN "t5" AS "t9" - ON "t7"."o_orderkey" = "t9"."l_orderkey" - ) AS "t11" - WHERE - "t11"."o_orderkey" IN ( - SELECT - "t10"."l_orderkey" - FROM ( - SELECT - "t8"."l_orderkey", - SUM("t8"."l_quantity") AS "qty_sum" - FROM "t5" AS "t8" - GROUP BY - 1 - ) AS "t10" - WHERE - "t10"."qty_sum" > 300 - ) - ) AS "t13" - GROUP BY - 1, - 2, - 3, - 4, - 5 -) AS "t14" -ORDER BY - "t14"."o_totalprice" DESC, - "t14"."o_orderdate" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/datafusion/19.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/datafusion/19.sql deleted file mode 100644 index 0859881dc5db..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/datafusion/19.sql +++ /dev/null @@ -1,123 +0,0 @@ -SELECT - SUM("t5"."l_extendedprice" * ( - 1 - "t5"."l_discount" - )) AS "revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - "t3"."p_retailprice", - "t3"."p_comment" - FROM "tpch"."lineitem" AS "t2" - INNER JOIN "tpch"."part" AS "t3" - ON "t3"."p_partkey" = "t2"."l_partkey" - ) AS "t4" - WHERE - ( - ( - ( - ( - ( - ( - ( - ( - "t4"."p_brand" = 'Brand#12' - ) - AND "t4"."p_container" IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - ) - AND ( - "t4"."l_quantity" >= 1 - ) - ) - AND ( - "t4"."l_quantity" <= 11 - ) - ) - AND "t4"."p_size" BETWEEN 1 AND 5 - ) - AND "t4"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t4"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t4"."p_brand" = 'Brand#23' - ) - AND "t4"."p_container" IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - ) - AND ( - "t4"."l_quantity" >= 10 - ) - ) - AND ( - "t4"."l_quantity" <= 20 - ) - ) - AND "t4"."p_size" BETWEEN 1 AND 10 - ) - AND "t4"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t4"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t4"."p_brand" = 'Brand#34' - ) - AND "t4"."p_container" IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - ) - AND ( - "t4"."l_quantity" >= 20 - ) - ) - AND ( - "t4"."l_quantity" <= 30 - ) - ) - AND "t4"."p_size" BETWEEN 1 AND 15 - ) - AND "t4"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t4"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) -) AS "t5" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/duckdb/19.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/duckdb/19.sql deleted file mode 100644 index ee0f902626fd..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/duckdb/19.sql +++ /dev/null @@ -1,123 +0,0 @@ -SELECT - SUM("t5"."l_extendedprice" * ( - CAST(1 AS TINYINT) - "t5"."l_discount" - )) AS "revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t2"."l_orderkey", - "t2"."l_partkey", - "t2"."l_suppkey", - "t2"."l_linenumber", - "t2"."l_quantity", - "t2"."l_extendedprice", - "t2"."l_discount", - "t2"."l_tax", - "t2"."l_returnflag", - "t2"."l_linestatus", - "t2"."l_shipdate", - "t2"."l_commitdate", - "t2"."l_receiptdate", - "t2"."l_shipinstruct", - "t2"."l_shipmode", - "t2"."l_comment", - "t3"."p_partkey", - "t3"."p_name", - "t3"."p_mfgr", - "t3"."p_brand", - "t3"."p_type", - "t3"."p_size", - "t3"."p_container", - "t3"."p_retailprice", - "t3"."p_comment" - FROM "tpch"."lineitem" AS "t2" - INNER JOIN "tpch"."part" AS "t3" - ON "t3"."p_partkey" = "t2"."l_partkey" - ) AS "t4" - WHERE - ( - ( - ( - ( - ( - ( - ( - ( - "t4"."p_brand" = 'Brand#12' - ) - AND "t4"."p_container" IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - ) - AND ( - "t4"."l_quantity" >= CAST(1 AS TINYINT) - ) - ) - AND ( - "t4"."l_quantity" <= CAST(11 AS TINYINT) - ) - ) - AND "t4"."p_size" BETWEEN CAST(1 AS TINYINT) AND CAST(5 AS TINYINT) - ) - AND "t4"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t4"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t4"."p_brand" = 'Brand#23' - ) - AND "t4"."p_container" IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - ) - AND ( - "t4"."l_quantity" >= CAST(10 AS TINYINT) - ) - ) - AND ( - "t4"."l_quantity" <= CAST(20 AS TINYINT) - ) - ) - AND "t4"."p_size" BETWEEN CAST(1 AS TINYINT) AND CAST(10 AS TINYINT) - ) - AND "t4"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t4"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t4"."p_brand" = 'Brand#34' - ) - AND "t4"."p_container" IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - ) - AND ( - "t4"."l_quantity" >= CAST(20 AS TINYINT) - ) - ) - AND ( - "t4"."l_quantity" <= CAST(30 AS TINYINT) - ) - ) - AND "t4"."p_size" BETWEEN CAST(1 AS TINYINT) AND CAST(15 AS TINYINT) - ) - AND "t4"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t4"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) -) AS "t5" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/snowflake/19.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/snowflake/19.sql deleted file mode 100644 index dda2bdf4517c..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/snowflake/19.sql +++ /dev/null @@ -1,154 +0,0 @@ -SELECT - SUM("t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - )) AS "revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - "t4"."l_quantity", - "t4"."l_extendedprice", - "t4"."l_discount", - "t4"."l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment", - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment" - FROM ( - SELECT - "t0"."L_ORDERKEY" AS "l_orderkey", - "t0"."L_PARTKEY" AS "l_partkey", - "t0"."L_SUPPKEY" AS "l_suppkey", - "t0"."L_LINENUMBER" AS "l_linenumber", - "t0"."L_QUANTITY" AS "l_quantity", - "t0"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t0"."L_DISCOUNT" AS "l_discount", - "t0"."L_TAX" AS "l_tax", - "t0"."L_RETURNFLAG" AS "l_returnflag", - "t0"."L_LINESTATUS" AS "l_linestatus", - "t0"."L_SHIPDATE" AS "l_shipdate", - "t0"."L_COMMITDATE" AS "l_commitdate", - "t0"."L_RECEIPTDATE" AS "l_receiptdate", - "t0"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t0"."L_SHIPMODE" AS "l_shipmode", - "t0"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."P_PARTKEY" AS "p_partkey", - "t1"."P_NAME" AS "p_name", - "t1"."P_MFGR" AS "p_mfgr", - "t1"."P_BRAND" AS "p_brand", - "t1"."P_TYPE" AS "p_type", - "t1"."P_SIZE" AS "p_size", - "t1"."P_CONTAINER" AS "p_container", - "t1"."P_RETAILPRICE" AS "p_retailprice", - "t1"."P_COMMENT" AS "p_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t1" - ) AS "t5" - ON "t5"."p_partkey" = "t4"."l_partkey" - ) AS "t6" - WHERE - ( - ( - ( - ( - ( - ( - ( - ( - "t6"."p_brand" = 'Brand#12' - ) - AND "t6"."p_container" IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - ) - AND ( - "t6"."l_quantity" >= 1 - ) - ) - AND ( - "t6"."l_quantity" <= 11 - ) - ) - AND "t6"."p_size" BETWEEN 1 AND 5 - ) - AND "t6"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t6"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t6"."p_brand" = 'Brand#23' - ) - AND "t6"."p_container" IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - ) - AND ( - "t6"."l_quantity" >= 10 - ) - ) - AND ( - "t6"."l_quantity" <= 20 - ) - ) - AND "t6"."p_size" BETWEEN 1 AND 10 - ) - AND "t6"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t6"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t6"."p_brand" = 'Brand#34' - ) - AND "t6"."p_container" IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - ) - AND ( - "t6"."l_quantity" >= 20 - ) - ) - AND ( - "t6"."l_quantity" <= 30 - ) - ) - AND "t6"."p_size" BETWEEN 1 AND 15 - ) - AND "t6"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t6"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) -) AS "t7" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/trino/19.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/trino/19.sql deleted file mode 100644 index 7952ed60b799..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_19/trino/19.sql +++ /dev/null @@ -1,154 +0,0 @@ -SELECT - SUM("t7"."l_extendedprice" * ( - 1 - "t7"."l_discount" - )) AS "revenue" -FROM ( - SELECT - * - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - "t4"."l_quantity", - "t4"."l_extendedprice", - "t4"."l_discount", - "t4"."l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment", - "t5"."p_partkey", - "t5"."p_name", - "t5"."p_mfgr", - "t5"."p_brand", - "t5"."p_type", - "t5"."p_size", - "t5"."p_container", - "t5"."p_retailprice", - "t5"."p_comment" - FROM ( - SELECT - "t0"."l_orderkey", - "t0"."l_partkey", - "t0"."l_suppkey", - "t0"."l_linenumber", - CAST("t0"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t0"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t0"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t0"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t0"."l_returnflag", - "t0"."l_linestatus", - "t0"."l_shipdate", - "t0"."l_commitdate", - "t0"."l_receiptdate", - "t0"."l_shipinstruct", - "t0"."l_shipmode", - "t0"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t0" - ) AS "t4" - INNER JOIN ( - SELECT - "t1"."p_partkey", - "t1"."p_name", - "t1"."p_mfgr", - "t1"."p_brand", - "t1"."p_type", - "t1"."p_size", - "t1"."p_container", - CAST("t1"."p_retailprice" AS DECIMAL(15, 2)) AS "p_retailprice", - "t1"."p_comment" - FROM "hive"."ibis_tpch_sf1"."part" AS "t1" - ) AS "t5" - ON "t5"."p_partkey" = "t4"."l_partkey" - ) AS "t6" - WHERE - ( - ( - ( - ( - ( - ( - ( - ( - "t6"."p_brand" = 'Brand#12' - ) - AND "t6"."p_container" IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') - ) - AND ( - "t6"."l_quantity" >= 1 - ) - ) - AND ( - "t6"."l_quantity" <= 11 - ) - ) - AND "t6"."p_size" BETWEEN 1 AND 5 - ) - AND "t6"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t6"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t6"."p_brand" = 'Brand#23' - ) - AND "t6"."p_container" IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') - ) - AND ( - "t6"."l_quantity" >= 10 - ) - ) - AND ( - "t6"."l_quantity" <= 20 - ) - ) - AND "t6"."p_size" BETWEEN 1 AND 10 - ) - AND "t6"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t6"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) - ) - OR ( - ( - ( - ( - ( - ( - ( - "t6"."p_brand" = 'Brand#34' - ) - AND "t6"."p_container" IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') - ) - AND ( - "t6"."l_quantity" >= 20 - ) - ) - AND ( - "t6"."l_quantity" <= 30 - ) - ) - AND "t6"."p_size" BETWEEN 1 AND 15 - ) - AND "t6"."l_shipmode" IN ('AIR', 'AIR REG') - ) - AND ( - "t6"."l_shipinstruct" = 'DELIVER IN PERSON' - ) - ) -) AS "t7" \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/datafusion/20.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/datafusion/20.sql deleted file mode 100644 index d6975916c033..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/datafusion/20.sql +++ /dev/null @@ -1,61 +0,0 @@ -SELECT - "t13"."s_name", - "t13"."s_address" -FROM ( - SELECT - * - FROM ( - SELECT - "t5"."s_suppkey", - "t5"."s_name", - "t5"."s_address", - "t5"."s_nationkey", - "t5"."s_phone", - "t5"."s_acctbal", - "t5"."s_comment", - "t6"."n_nationkey", - "t6"."n_name", - "t6"."n_regionkey", - "t6"."n_comment" - FROM "tpch"."supplier" AS "t5" - INNER JOIN "tpch"."nation" AS "t6" - ON "t5"."s_nationkey" = "t6"."n_nationkey" - ) AS "t9" - WHERE - "t9"."n_name" = 'CANADA' - AND "t9"."s_suppkey" IN ( - SELECT - "t11"."ps_suppkey" - FROM ( - SELECT - * - FROM "tpch"."partsupp" AS "t2" - WHERE - "t2"."ps_partkey" IN ( - SELECT - "t3"."p_partkey" - FROM "tpch"."part" AS "t3" - WHERE - "t3"."p_name" LIKE 'forest%' - ) - AND "t2"."ps_availqty" > ( - ( - SELECT - SUM("t8"."l_quantity") AS "Sum(l_quantity)" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t4" - WHERE - "t4"."l_partkey" = "t2"."ps_partkey" - AND "t4"."l_suppkey" = "t2"."ps_suppkey" - AND "t4"."l_shipdate" >= DATE_TRUNC('DAY', '1994-01-01') - AND "t4"."l_shipdate" < DATE_TRUNC('DAY', '1995-01-01') - ) AS "t8" - ) * 0.5 - ) - ) AS "t11" - ) -) AS "t13" -ORDER BY - "t13"."s_name" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/duckdb/20.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/duckdb/20.sql deleted file mode 100644 index ec09cde03690..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/duckdb/20.sql +++ /dev/null @@ -1,61 +0,0 @@ -SELECT - "t13"."s_name", - "t13"."s_address" -FROM ( - SELECT - * - FROM ( - SELECT - "t5"."s_suppkey", - "t5"."s_name", - "t5"."s_address", - "t5"."s_nationkey", - "t5"."s_phone", - "t5"."s_acctbal", - "t5"."s_comment", - "t6"."n_nationkey", - "t6"."n_name", - "t6"."n_regionkey", - "t6"."n_comment" - FROM "tpch"."supplier" AS "t5" - INNER JOIN "tpch"."nation" AS "t6" - ON "t5"."s_nationkey" = "t6"."n_nationkey" - ) AS "t9" - WHERE - "t9"."n_name" = 'CANADA' - AND "t9"."s_suppkey" IN ( - SELECT - "t11"."ps_suppkey" - FROM ( - SELECT - * - FROM "tpch"."partsupp" AS "t2" - WHERE - "t2"."ps_partkey" IN ( - SELECT - "t3"."p_partkey" - FROM "tpch"."part" AS "t3" - WHERE - "t3"."p_name" LIKE 'forest%' - ) - AND "t2"."ps_availqty" > ( - ( - SELECT - SUM("t8"."l_quantity") AS "Sum(l_quantity)" - FROM ( - SELECT - * - FROM "tpch"."lineitem" AS "t4" - WHERE - "t4"."l_partkey" = "t2"."ps_partkey" - AND "t4"."l_suppkey" = "t2"."ps_suppkey" - AND "t4"."l_shipdate" >= MAKE_DATE(1994, 1, 1) - AND "t4"."l_shipdate" < MAKE_DATE(1995, 1, 1) - ) AS "t8" - ) * CAST(0.5 AS DOUBLE) - ) - ) AS "t11" - ) -) AS "t13" -ORDER BY - "t13"."s_name" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/snowflake/20.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/snowflake/20.sql deleted file mode 100644 index 6aa57d1ab26e..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/snowflake/20.sql +++ /dev/null @@ -1,101 +0,0 @@ -SELECT - "t16"."s_name", - "t16"."s_address" -FROM ( - SELECT - * - FROM ( - SELECT - "t8"."s_suppkey", - "t8"."s_name", - "t8"."s_address", - "t8"."s_nationkey", - "t8"."s_phone", - "t8"."s_acctbal", - "t8"."s_comment", - "t9"."n_nationkey", - "t9"."n_name", - "t9"."n_regionkey", - "t9"."n_comment" - FROM ( - SELECT - "t0"."S_SUPPKEY" AS "s_suppkey", - "t0"."S_NAME" AS "s_name", - "t0"."S_ADDRESS" AS "s_address", - "t0"."S_NATIONKEY" AS "s_nationkey", - "t0"."S_PHONE" AS "s_phone", - "t0"."S_ACCTBAL" AS "s_acctbal", - "t0"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t0" - ) AS "t8" - INNER JOIN ( - SELECT - "t1"."N_NATIONKEY" AS "n_nationkey", - "t1"."N_NAME" AS "n_name", - "t1"."N_REGIONKEY" AS "n_regionkey", - "t1"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t1" - ) AS "t9" - ON "t8"."s_nationkey" = "t9"."n_nationkey" - ) AS "t12" - WHERE - "t12"."n_name" = 'CANADA' - AND "t12"."s_suppkey" IN ( - SELECT - "t14"."ps_suppkey" - FROM ( - SELECT - * - FROM ( - SELECT - "t2"."PS_PARTKEY" AS "ps_partkey", - "t2"."PS_SUPPKEY" AS "ps_suppkey", - "t2"."PS_AVAILQTY" AS "ps_availqty", - "t2"."PS_SUPPLYCOST" AS "ps_supplycost", - "t2"."PS_COMMENT" AS "ps_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PARTSUPP" AS "t2" - ) AS "t7" - WHERE - "t7"."ps_partkey" IN ( - SELECT - "t3"."P_PARTKEY" AS "p_partkey" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."PART" AS "t3" - WHERE - "t3"."P_NAME" LIKE 'forest%' - ) - AND "t7"."ps_availqty" > ( - ( - SELECT - SUM("t11"."l_quantity") AS "Sum(l_quantity)" - FROM ( - SELECT - "t4"."L_ORDERKEY" AS "l_orderkey", - "t4"."L_PARTKEY" AS "l_partkey", - "t4"."L_SUPPKEY" AS "l_suppkey", - "t4"."L_LINENUMBER" AS "l_linenumber", - "t4"."L_QUANTITY" AS "l_quantity", - "t4"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t4"."L_DISCOUNT" AS "l_discount", - "t4"."L_TAX" AS "l_tax", - "t4"."L_RETURNFLAG" AS "l_returnflag", - "t4"."L_LINESTATUS" AS "l_linestatus", - "t4"."L_SHIPDATE" AS "l_shipdate", - "t4"."L_COMMITDATE" AS "l_commitdate", - "t4"."L_RECEIPTDATE" AS "l_receiptdate", - "t4"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t4"."L_SHIPMODE" AS "l_shipmode", - "t4"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t4" - WHERE - "t4"."L_PARTKEY" = "t7"."ps_partkey" - AND "t4"."L_SUPPKEY" = "t7"."ps_suppkey" - AND "t4"."L_SHIPDATE" >= DATE_FROM_PARTS(1994, 1, 1) - AND "t4"."L_SHIPDATE" < DATE_FROM_PARTS(1995, 1, 1) - ) AS "t11" - ) * 0.5 - ) - ) AS "t14" - ) -) AS "t16" -ORDER BY - "t16"."s_name" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/trino/20.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/trino/20.sql deleted file mode 100644 index 12c56cf9f36c..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_20/trino/20.sql +++ /dev/null @@ -1,98 +0,0 @@ -SELECT - "t16"."s_name", - "t16"."s_address" -FROM ( - SELECT - * - FROM ( - SELECT - "t10"."s_suppkey", - "t10"."s_name", - "t10"."s_address", - "t10"."s_nationkey", - "t10"."s_phone", - "t10"."s_acctbal", - "t10"."s_comment", - "t7"."n_nationkey", - "t7"."n_name", - "t7"."n_regionkey", - "t7"."n_comment" - FROM ( - SELECT - "t0"."s_suppkey", - "t0"."s_name", - "t0"."s_address", - "t0"."s_nationkey", - "t0"."s_phone", - CAST("t0"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t0"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t0" - ) AS "t10" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t1" - ) AS "t7" - ON "t10"."s_nationkey" = "t7"."n_nationkey" - ) AS "t12" - WHERE - "t12"."n_name" = 'CANADA' - AND "t12"."s_suppkey" IN ( - SELECT - "t14"."ps_suppkey" - FROM ( - SELECT - * - FROM ( - SELECT - "t2"."ps_partkey", - "t2"."ps_suppkey", - "t2"."ps_availqty", - CAST("t2"."ps_supplycost" AS DECIMAL(15, 2)) AS "ps_supplycost", - "t2"."ps_comment" - FROM "hive"."ibis_tpch_sf1"."partsupp" AS "t2" - ) AS "t8" - WHERE - "t8"."ps_partkey" IN ( - SELECT - "t3"."p_partkey" - FROM "hive"."ibis_tpch_sf1"."part" AS "t3" - WHERE - "t3"."p_name" LIKE 'forest%' - ) - AND "t8"."ps_availqty" > ( - ( - SELECT - SUM("t11"."l_quantity") AS "Sum(l_quantity)" - FROM ( - SELECT - "t4"."l_orderkey", - "t4"."l_partkey", - "t4"."l_suppkey", - "t4"."l_linenumber", - CAST("t4"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t4"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t4"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t4"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t4"."l_returnflag", - "t4"."l_linestatus", - "t4"."l_shipdate", - "t4"."l_commitdate", - "t4"."l_receiptdate", - "t4"."l_shipinstruct", - "t4"."l_shipmode", - "t4"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t4" - WHERE - "t4"."l_partkey" = "t8"."ps_partkey" - AND "t4"."l_suppkey" = "t8"."ps_suppkey" - AND "t4"."l_shipdate" >= FROM_ISO8601_DATE('1994-01-01') - AND "t4"."l_shipdate" < FROM_ISO8601_DATE('1995-01-01') - ) AS "t11" - ) * CAST(0.5 AS DOUBLE) - ) - ) AS "t14" - ) -) AS "t16" -ORDER BY - "t16"."s_name" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/duckdb/21.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/duckdb/21.sql deleted file mode 100644 index f4b123e8debd..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/duckdb/21.sql +++ /dev/null @@ -1,69 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t13"."s_name", - COUNT(*) AS "numwait" - FROM ( - SELECT - * - FROM ( - SELECT - "t5"."l_orderkey" AS "l1_orderkey", - "t8"."o_orderstatus", - "t5"."l_receiptdate", - "t5"."l_commitdate", - "t5"."l_suppkey" AS "l1_suppkey", - "t4"."s_name", - "t9"."n_name" - FROM "tpch"."supplier" AS "t4" - INNER JOIN "tpch"."lineitem" AS "t5" - ON "t4"."s_suppkey" = "t5"."l_suppkey" - INNER JOIN "tpch"."orders" AS "t8" - ON "t8"."o_orderkey" = "t5"."l_orderkey" - INNER JOIN "tpch"."nation" AS "t9" - ON "t4"."s_nationkey" = "t9"."n_nationkey" - ) AS "t10" - WHERE - "t10"."o_orderstatus" = 'F' - AND "t10"."l_receiptdate" > "t10"."l_commitdate" - AND "t10"."n_name" = 'SAUDI ARABIA' - AND EXISTS( - SELECT - 1 - FROM "tpch"."lineitem" AS "t6" - WHERE - ( - "t6"."l_orderkey" = "t10"."l1_orderkey" - ) - AND ( - "t6"."l_suppkey" <> "t10"."l1_suppkey" - ) - ) - AND NOT ( - EXISTS( - SELECT - 1 - FROM "tpch"."lineitem" AS "t7" - WHERE - ( - ( - "t7"."l_orderkey" = "t10"."l1_orderkey" - ) - AND ( - "t7"."l_suppkey" <> "t10"."l1_suppkey" - ) - ) - AND ( - "t7"."l_receiptdate" > "t7"."l_commitdate" - ) - ) - ) - ) AS "t13" - GROUP BY - 1 -) AS "t14" -ORDER BY - "t14"."numwait" DESC, - "t14"."s_name" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/snowflake/21.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/snowflake/21.sql deleted file mode 100644 index 69a4d1532a2c..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/snowflake/21.sql +++ /dev/null @@ -1,118 +0,0 @@ -WITH "t7" AS ( - SELECT - "t3"."L_ORDERKEY" AS "l_orderkey", - "t3"."L_PARTKEY" AS "l_partkey", - "t3"."L_SUPPKEY" AS "l_suppkey", - "t3"."L_LINENUMBER" AS "l_linenumber", - "t3"."L_QUANTITY" AS "l_quantity", - "t3"."L_EXTENDEDPRICE" AS "l_extendedprice", - "t3"."L_DISCOUNT" AS "l_discount", - "t3"."L_TAX" AS "l_tax", - "t3"."L_RETURNFLAG" AS "l_returnflag", - "t3"."L_LINESTATUS" AS "l_linestatus", - "t3"."L_SHIPDATE" AS "l_shipdate", - "t3"."L_COMMITDATE" AS "l_commitdate", - "t3"."L_RECEIPTDATE" AS "l_receiptdate", - "t3"."L_SHIPINSTRUCT" AS "l_shipinstruct", - "t3"."L_SHIPMODE" AS "l_shipmode", - "t3"."L_COMMENT" AS "l_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."LINEITEM" AS "t3" -) -SELECT - * -FROM ( - SELECT - "t18"."s_name", - COUNT(*) AS "numwait" - FROM ( - SELECT - * - FROM ( - SELECT - "t12"."l_orderkey" AS "l1_orderkey", - "t9"."o_orderstatus", - "t12"."l_receiptdate", - "t12"."l_commitdate", - "t12"."l_suppkey" AS "l1_suppkey", - "t8"."s_name", - "t10"."n_name" - FROM ( - SELECT - "t0"."S_SUPPKEY" AS "s_suppkey", - "t0"."S_NAME" AS "s_name", - "t0"."S_ADDRESS" AS "s_address", - "t0"."S_NATIONKEY" AS "s_nationkey", - "t0"."S_PHONE" AS "s_phone", - "t0"."S_ACCTBAL" AS "s_acctbal", - "t0"."S_COMMENT" AS "s_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."SUPPLIER" AS "t0" - ) AS "t8" - INNER JOIN "t7" AS "t12" - ON "t8"."s_suppkey" = "t12"."l_suppkey" - INNER JOIN ( - SELECT - "t1"."O_ORDERKEY" AS "o_orderkey", - "t1"."O_CUSTKEY" AS "o_custkey", - "t1"."O_ORDERSTATUS" AS "o_orderstatus", - "t1"."O_TOTALPRICE" AS "o_totalprice", - "t1"."O_ORDERDATE" AS "o_orderdate", - "t1"."O_ORDERPRIORITY" AS "o_orderpriority", - "t1"."O_CLERK" AS "o_clerk", - "t1"."O_SHIPPRIORITY" AS "o_shippriority", - "t1"."O_COMMENT" AS "o_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t1" - ) AS "t9" - ON "t9"."o_orderkey" = "t12"."l_orderkey" - INNER JOIN ( - SELECT - "t2"."N_NATIONKEY" AS "n_nationkey", - "t2"."N_NAME" AS "n_name", - "t2"."N_REGIONKEY" AS "n_regionkey", - "t2"."N_COMMENT" AS "n_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."NATION" AS "t2" - ) AS "t10" - ON "t8"."s_nationkey" = "t10"."n_nationkey" - ) AS "t15" - WHERE - "t15"."o_orderstatus" = 'F' - AND "t15"."l_receiptdate" > "t15"."l_commitdate" - AND "t15"."n_name" = 'SAUDI ARABIA' - AND EXISTS( - SELECT - 1 - FROM "t7" AS "t13" - WHERE - ( - "t13"."l_orderkey" = "t15"."l1_orderkey" - ) - AND ( - "t13"."l_suppkey" <> "t15"."l1_suppkey" - ) - ) - AND NOT ( - EXISTS( - SELECT - 1 - FROM "t7" AS "t14" - WHERE - ( - ( - "t14"."l_orderkey" = "t15"."l1_orderkey" - ) - AND ( - "t14"."l_suppkey" <> "t15"."l1_suppkey" - ) - ) - AND ( - "t14"."l_receiptdate" > "t14"."l_commitdate" - ) - ) - ) - ) AS "t18" - GROUP BY - 1 -) AS "t19" -ORDER BY - "t19"."numwait" DESC NULLS LAST, - "t19"."s_name" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/trino/21.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/trino/21.sql deleted file mode 100644 index 39d9f604a292..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_21/trino/21.sql +++ /dev/null @@ -1,115 +0,0 @@ -WITH "t8" AS ( - SELECT - "t3"."l_orderkey", - "t3"."l_partkey", - "t3"."l_suppkey", - "t3"."l_linenumber", - CAST("t3"."l_quantity" AS DECIMAL(15, 2)) AS "l_quantity", - CAST("t3"."l_extendedprice" AS DECIMAL(15, 2)) AS "l_extendedprice", - CAST("t3"."l_discount" AS DECIMAL(15, 2)) AS "l_discount", - CAST("t3"."l_tax" AS DECIMAL(15, 2)) AS "l_tax", - "t3"."l_returnflag", - "t3"."l_linestatus", - "t3"."l_shipdate", - "t3"."l_commitdate", - "t3"."l_receiptdate", - "t3"."l_shipinstruct", - "t3"."l_shipmode", - "t3"."l_comment" - FROM "hive"."ibis_tpch_sf1"."lineitem" AS "t3" -) -SELECT - * -FROM ( - SELECT - "t18"."s_name", - COUNT(*) AS "numwait" - FROM ( - SELECT - * - FROM ( - SELECT - "t12"."l_orderkey" AS "l1_orderkey", - "t10"."o_orderstatus", - "t12"."l_receiptdate", - "t12"."l_commitdate", - "t12"."l_suppkey" AS "l1_suppkey", - "t9"."s_name", - "t7"."n_name" - FROM ( - SELECT - "t0"."s_suppkey", - "t0"."s_name", - "t0"."s_address", - "t0"."s_nationkey", - "t0"."s_phone", - CAST("t0"."s_acctbal" AS DECIMAL(15, 2)) AS "s_acctbal", - "t0"."s_comment" - FROM "hive"."ibis_tpch_sf1"."supplier" AS "t0" - ) AS "t9" - INNER JOIN "t8" AS "t12" - ON "t9"."s_suppkey" = "t12"."l_suppkey" - INNER JOIN ( - SELECT - "t1"."o_orderkey", - "t1"."o_custkey", - "t1"."o_orderstatus", - CAST("t1"."o_totalprice" AS DECIMAL(15, 2)) AS "o_totalprice", - "t1"."o_orderdate", - "t1"."o_orderpriority", - "t1"."o_clerk", - "t1"."o_shippriority", - "t1"."o_comment" - FROM "hive"."ibis_tpch_sf1"."orders" AS "t1" - ) AS "t10" - ON "t10"."o_orderkey" = "t12"."l_orderkey" - INNER JOIN ( - SELECT - * - FROM "hive"."ibis_tpch_sf1"."nation" AS "t2" - ) AS "t7" - ON "t9"."s_nationkey" = "t7"."n_nationkey" - ) AS "t15" - WHERE - "t15"."o_orderstatus" = 'F' - AND "t15"."l_receiptdate" > "t15"."l_commitdate" - AND "t15"."n_name" = 'SAUDI ARABIA' - AND EXISTS( - SELECT - 1 - FROM "t8" AS "t13" - WHERE - ( - "t13"."l_orderkey" = "t15"."l1_orderkey" - ) - AND ( - "t13"."l_suppkey" <> "t15"."l1_suppkey" - ) - ) - AND NOT ( - EXISTS( - SELECT - 1 - FROM "t8" AS "t14" - WHERE - ( - ( - "t14"."l_orderkey" = "t15"."l1_orderkey" - ) - AND ( - "t14"."l_suppkey" <> "t15"."l1_suppkey" - ) - ) - AND ( - "t14"."l_receiptdate" > "t14"."l_commitdate" - ) - ) - ) - ) AS "t18" - GROUP BY - 1 -) AS "t19" -ORDER BY - "t19"."numwait" DESC, - "t19"."s_name" ASC -LIMIT 100 \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/duckdb/22.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/duckdb/22.sql deleted file mode 100644 index 1a9bc3827d2d..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/duckdb/22.sql +++ /dev/null @@ -1,75 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t6"."cntrycode", - COUNT(*) AS "numcust", - SUM("t6"."c_acctbal") AS "totacctbal" - FROM ( - SELECT - SUBSTRING( - "t5"."c_phone", - CASE - WHEN ( - CAST(0 AS TINYINT) + 1 - ) >= 1 - THEN CAST(0 AS TINYINT) + 1 - ELSE CAST(0 AS TINYINT) + 1 + LENGTH("t5"."c_phone") - END, - CAST(2 AS TINYINT) - ) AS "cntrycode", - "t5"."c_acctbal" - FROM ( - SELECT - * - FROM "tpch"."customer" AS "t0" - WHERE - SUBSTRING( - "t0"."c_phone", - CASE - WHEN ( - CAST(0 AS TINYINT) + 1 - ) >= 1 - THEN CAST(0 AS TINYINT) + 1 - ELSE CAST(0 AS TINYINT) + 1 + LENGTH("t0"."c_phone") - END, - CAST(2 AS TINYINT) - ) IN ('13', '31', '23', '29', '30', '18', '17') - AND "t0"."c_acctbal" > ( - SELECT - AVG("t3"."c_acctbal") AS "Mean(c_acctbal)" - FROM ( - SELECT - * - FROM "tpch"."customer" AS "t0" - WHERE - "t0"."c_acctbal" > CAST(0.0 AS DOUBLE) - AND SUBSTRING( - "t0"."c_phone", - CASE - WHEN ( - CAST(0 AS TINYINT) + 1 - ) >= 1 - THEN CAST(0 AS TINYINT) + 1 - ELSE CAST(0 AS TINYINT) + 1 + LENGTH("t0"."c_phone") - END, - CAST(2 AS TINYINT) - ) IN ('13', '31', '23', '29', '30', '18', '17') - ) AS "t3" - ) - AND NOT ( - EXISTS( - SELECT - 1 - FROM "tpch"."orders" AS "t1" - WHERE - "t1"."o_custkey" = "t0"."c_custkey" - ) - ) - ) AS "t5" - ) AS "t6" - GROUP BY - 1 -) AS "t7" -ORDER BY - "t7"."cntrycode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/snowflake/22.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/snowflake/22.sql deleted file mode 100644 index 2cc830bc6d23..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/snowflake/22.sql +++ /dev/null @@ -1,69 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."cntrycode", - COUNT(*) AS "numcust", - SUM("t7"."c_acctbal") AS "totacctbal" - FROM ( - SELECT - SUBSTRING("t6"."c_phone", IFF(( - 0 + 1 - ) >= 1, 0 + 1, 0 + 1 + LENGTH("t6"."c_phone")), 2) AS "cntrycode", - "t6"."c_acctbal" - FROM ( - SELECT - * - FROM ( - SELECT - "t0"."C_CUSTKEY" AS "c_custkey", - "t0"."C_NAME" AS "c_name", - "t0"."C_ADDRESS" AS "c_address", - "t0"."C_NATIONKEY" AS "c_nationkey", - "t0"."C_PHONE" AS "c_phone", - "t0"."C_ACCTBAL" AS "c_acctbal", - "t0"."C_MKTSEGMENT" AS "c_mktsegment", - "t0"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t0" - ) AS "t2" - WHERE - SUBSTRING("t2"."c_phone", IFF(( - 0 + 1 - ) >= 1, 0 + 1, 0 + 1 + LENGTH("t2"."c_phone")), 2) IN ('13', '31', '23', '29', '30', '18', '17') - AND "t2"."c_acctbal" > ( - SELECT - AVG("t3"."c_acctbal") AS "Mean(c_acctbal)" - FROM ( - SELECT - "t0"."C_CUSTKEY" AS "c_custkey", - "t0"."C_NAME" AS "c_name", - "t0"."C_ADDRESS" AS "c_address", - "t0"."C_NATIONKEY" AS "c_nationkey", - "t0"."C_PHONE" AS "c_phone", - "t0"."C_ACCTBAL" AS "c_acctbal", - "t0"."C_MKTSEGMENT" AS "c_mktsegment", - "t0"."C_COMMENT" AS "c_comment" - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."CUSTOMER" AS "t0" - WHERE - "t0"."C_ACCTBAL" > 0.0 - AND SUBSTRING("t0"."C_PHONE", IFF(( - 0 + 1 - ) >= 1, 0 + 1, 0 + 1 + LENGTH("t0"."C_PHONE")), 2) IN ('13', '31', '23', '29', '30', '18', '17') - ) AS "t3" - ) - AND NOT ( - EXISTS( - SELECT - 1 - FROM "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1"."ORDERS" AS "t1" - WHERE - "t1"."O_CUSTKEY" = "t2"."c_custkey" - ) - ) - ) AS "t6" - ) AS "t7" - GROUP BY - 1 -) AS "t8" -ORDER BY - "t8"."cntrycode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/trino/22.sql b/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/trino/22.sql deleted file mode 100644 index 2610eb41a477..000000000000 --- a/ibis/backends/tests/tpc/h/snapshots/test_queries/test_22/trino/22.sql +++ /dev/null @@ -1,69 +0,0 @@ -SELECT - * -FROM ( - SELECT - "t7"."cntrycode", - COUNT(*) AS "numcust", - SUM("t7"."c_acctbal") AS "totacctbal" - FROM ( - SELECT - SUBSTRING("t6"."c_phone", IF(( - 0 + 1 - ) >= 1, 0 + 1, 0 + 1 + LENGTH("t6"."c_phone")), 2) AS "cntrycode", - "t6"."c_acctbal" - FROM ( - SELECT - * - FROM ( - SELECT - "t0"."c_custkey", - "t0"."c_name", - "t0"."c_address", - "t0"."c_nationkey", - "t0"."c_phone", - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t0"."c_mktsegment", - "t0"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t0" - ) AS "t2" - WHERE - SUBSTRING("t2"."c_phone", IF(( - 0 + 1 - ) >= 1, 0 + 1, 0 + 1 + LENGTH("t2"."c_phone")), 2) IN ('13', '31', '23', '29', '30', '18', '17') - AND "t2"."c_acctbal" > ( - SELECT - AVG("t3"."c_acctbal") AS "Mean(c_acctbal)" - FROM ( - SELECT - "t0"."c_custkey", - "t0"."c_name", - "t0"."c_address", - "t0"."c_nationkey", - "t0"."c_phone", - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) AS "c_acctbal", - "t0"."c_mktsegment", - "t0"."c_comment" - FROM "hive"."ibis_tpch_sf1"."customer" AS "t0" - WHERE - CAST("t0"."c_acctbal" AS DECIMAL(15, 2)) > CAST(0.0 AS DOUBLE) - AND SUBSTRING("t0"."c_phone", IF(( - 0 + 1 - ) >= 1, 0 + 1, 0 + 1 + LENGTH("t0"."c_phone")), 2) IN ('13', '31', '23', '29', '30', '18', '17') - ) AS "t3" - ) - AND NOT ( - EXISTS( - SELECT - 1 - FROM "hive"."ibis_tpch_sf1"."orders" AS "t1" - WHERE - "t1"."o_custkey" = "t2"."c_custkey" - ) - ) - ) AS "t6" - ) AS "t7" - GROUP BY - 1 -) AS "t8" -ORDER BY - "t8"."cntrycode" ASC \ No newline at end of file diff --git a/ibis/backends/tests/tpc/queries/duckdb/ds/01.sql b/ibis/backends/tests/tpc/queries/duckdb/ds/01.sql index 39f5eac26f06..30562aa94646 100644 --- a/ibis/backends/tests/tpc/queries/duckdb/ds/01.sql +++ b/ibis/backends/tests/tpc/queries/duckdb/ds/01.sql @@ -20,4 +20,4 @@ WHERE ctr1.ctr_total_return > AND s_state = 'TN' AND ctr1.ctr_customer_sk = c_customer_sk ORDER BY c_customer_id -LIMIT 100 +LIMIT 100; diff --git a/ibis/backends/tests/tpc/queries/duckdb/ds/05.sql b/ibis/backends/tests/tpc/queries/duckdb/ds/05.sql index 583957df54a6..7c9342dce4c5 100644 --- a/ibis/backends/tests/tpc/queries/duckdb/ds/05.sql +++ b/ibis/backends/tests/tpc/queries/duckdb/ds/05.sql @@ -5,12 +5,17 @@ WITH ssr AS sum(return_amt) AS returns_, sum(net_loss) AS profit_loss FROM - (SELECT ss_sold_date_sk AS date_sk, + (SELECT ss_store_sk AS store_sk, + ss_sold_date_sk AS date_sk, ss_ext_sales_price AS sales_price, - ss_net_profit AS profit + ss_net_profit AS profit, + cast(0 AS decimal(7,2)) AS return_amt, + cast(0 AS decimal(7,2)) AS net_loss FROM store_sales UNION ALL SELECT sr_store_sk AS store_sk, sr_returned_date_sk AS date_sk, + cast(0 AS decimal(7,2)) AS sales_price, + cast(0 AS decimal(7,2)) AS profit, sr_return_amt AS return_amt, sr_net_loss AS net_loss FROM store_returns ) salesreturns, @@ -27,12 +32,17 @@ WITH ssr AS sum(return_amt) AS returns_, sum(net_loss) AS profit_loss FROM - (SELECT cs_sold_date_sk AS date_sk, + (SELECT cs_catalog_page_sk AS page_sk, + cs_sold_date_sk AS date_sk, cs_ext_sales_price AS sales_price, - cs_net_profit AS profit + cs_net_profit AS profit, + cast(0 AS decimal(7,2)) AS return_amt, + cast(0 AS decimal(7,2)) AS net_loss FROM catalog_sales UNION ALL SELECT cr_catalog_page_sk AS page_sk, cr_returned_date_sk AS date_sk, + cast(0 AS decimal(7,2)) AS sales_price, + cast(0 AS decimal(7,2)) AS profit, cr_return_amount AS return_amt, cr_net_loss AS net_loss FROM catalog_returns ) salesreturns, @@ -49,7 +59,8 @@ WITH ssr AS sum(return_amt) AS returns_, sum(net_loss) AS profit_loss FROM - (SELECT ws_sold_date_sk AS date_sk, + (SELECT ws_web_site_sk AS wsr_web_site_sk, + ws_sold_date_sk AS date_sk, ws_ext_sales_price AS sales_price, ws_net_profit AS profit, cast(0 AS decimal(7,2)) AS return_amt, diff --git a/ibis/backends/tests/tpc/queries/duckdb/ds/14.sql b/ibis/backends/tests/tpc/queries/duckdb/ds/14.sql index 6e125642e8a4..0a4667d9edf1 100644 --- a/ibis/backends/tests/tpc/queries/duckdb/ds/14.sql +++ b/ibis/backends/tests/tpc/queries/duckdb/ds/14.sql @@ -15,8 +15,7 @@ WITH cross_items AS ics.i_category_id FROM catalog_sales, item ics, - date_dim d2 - WHERE cs_item_sk = ics.i_item_sk + date_dim d2 WHERE cs_item_sk = ics.i_item_sk AND cs_sold_date_sk = d2.d_date_sk AND d2.d_year BETWEEN 1999 AND 1999 + 2 INTERSECT SELECT iws.i_brand_id, @@ -24,8 +23,7 @@ WITH cross_items AS iws.i_category_id FROM web_sales, item iws, - date_dim d3 - WHERE ws_item_sk = iws.i_item_sk + date_dim d3 WHERE ws_item_sk = iws.i_item_sk AND ws_sold_date_sk = d3.d_date_sk AND d3.d_year BETWEEN 1999 AND 1999 + 2) sq1 WHERE i_brand_id = brand_id diff --git a/ibis/backends/tests/tpc/queries/duckdb/ds/16.sql b/ibis/backends/tests/tpc/queries/duckdb/ds/16.sql index 585419a842eb..34f4d3e8f618 100644 --- a/ibis/backends/tests/tpc/queries/duckdb/ds/16.sql +++ b/ibis/backends/tests/tpc/queries/duckdb/ds/16.sql @@ -5,7 +5,7 @@ FROM catalog_sales cs1, date_dim, customer_address, call_center -WHERE d_date BETWEEN '2002-02-01' AND cast('2002-04-02' AS date) +WHERE d_date BETWEEN cast('2002-02-01' AS date) AND cast('2002-04-02' AS date) AND cs1.cs_ship_date_sk = d_date_sk AND cs1.cs_ship_addr_sk = ca_address_sk AND ca_state = 'GA' diff --git a/ibis/backends/tests/tpc/queries/duckdb/ds/44.sql b/ibis/backends/tests/tpc/queries/duckdb/ds/44.sql index 1c64983a1877..b10ed2e52530 100644 --- a/ibis/backends/tests/tpc/queries/duckdb/ds/44.sql +++ b/ibis/backends/tests/tpc/queries/duckdb/ds/44.sql @@ -1,4 +1,4 @@ -SELECT ascending.rnk, +SELECT asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing FROM @@ -19,7 +19,7 @@ FROM WHERE ss_store_sk = 4 AND ss_addr_sk IS NULL GROUP BY ss_store_sk))V1)V11 - WHERE rnk < 11) ascending, + WHERE rnk < 11) asceding, (SELECT * FROM (SELECT item_sk, @@ -40,8 +40,8 @@ FROM WHERE rnk < 11) descending, item i1, item i2 -WHERE ascending.rnk = descending.rnk - AND i1.i_item_sk=ascending.item_sk +WHERE asceding.rnk = descending.rnk + AND i1.i_item_sk=asceding.item_sk AND i2.i_item_sk=descending.item_sk -ORDER BY ascending.rnk +ORDER BY asceding.rnk LIMIT 100; diff --git a/ibis/backends/trino/tests/conftest.py b/ibis/backends/trino/tests/conftest.py index f8b06bb62ad9..2b4f67ebe437 100644 --- a/ibis/backends/trino/tests/conftest.py +++ b/ibis/backends/trino/tests/conftest.py @@ -9,8 +9,7 @@ import sqlglot.expressions as sge import ibis -import ibis.expr.datatypes as dt -import ibis.selectors as s +import ibis.expr.schema as sch from ibis.backends.conftest import TEST_TABLES from ibis.backends.tests.base import ServiceBackendTest @@ -43,15 +42,44 @@ class TestConf(ServiceBackendTest): supports_structs = True supports_map = True supports_tpch = True + supports_tpcds = True deps = ("trino",) def preload(self): # copy files to the minio host super().preload() + for suite in ["tpch", "tpcds"]: + for path in self.data_dir.joinpath(suite).rglob("*.parquet"): + subprocess.run( + [ + "docker", + "compose", + "cp", + str(path), + f"{self.service_name}:{self.data_volume}/{suite}_{path.name}", + ], + check=False, + ) + + dirname = path.with_suffix("").name + subprocess.run( + [ + "docker", + "compose", + "exec", + self.service_name, + "mc", + "cp", + f"{self.data_volume}/{suite}_{path.name}", + f"data/trino/{suite}/{dirname}/", + ], + check=True, + ) + for path in self.test_files: # minio doesn't allow underscores in bucket names - dirname = path.with_suffix("").name.replace("_", "-") + dirname = path.with_suffix("").name # copy from minio container to trino minio host subprocess.run( [ @@ -62,23 +90,19 @@ def preload(self): "mc", "cp", f"{self.data_volume}/{path.name}", - f"data/trino/{dirname}/{path.name}", + f"data/trino/{dirname}/", ], check=True, ) def _tpc_table(self, name: str, benchmark: Literal["h", "ds"]): - if not getattr(self, f"supports_tpc{benchmark}"): - pytest.skip( - f"{self.name()} backend does not support testing TPC-{benchmark.upper()}" - ) - return self.connection.table(name, database=f"hive.ibis_tpc{benchmark}_sf1") + return self.connection.table(name, database=f"hive.tpc{benchmark}") - def _transform_tpch_sql(self, parsed): + def _transform_tpc_sql(self, parsed, *, suite, leaves): def add_catalog_and_schema(node): - if isinstance(node, sg.exp.Table): + if isinstance(node, sg.exp.Table) and node.name in leaves: catalog = "hive" - db = "ibis_tpch_sf1" + db = f"tpc{suite}" return node.__class__( db=db, catalog=catalog, @@ -91,53 +115,20 @@ def add_catalog_and_schema(node): result = parsed.transform(add_catalog_and_schema) return result - def load_tpch(self) -> None: + def _load_tpc(self, *, suite, **_) -> None: """Create views of data in the TPC-H catalog that ships with Trino. This method create relations that have column names prefixed with the first one (or two in the case of partsupp -> ps) character table name to match the DuckDB TPC-H query conventions. """ - con = self.connection - catalog = "hive" - database = "ibis_tpch_sf1" - - tables = con.list_tables(database=("tpch", "tiny")) - con.create_database(database, catalog=catalog, force=True) - - prefixes = {"partsupp": "ps"} - - # this is the type duckdb uses for numeric columns in TPC-H data - decimal_type = dt.Decimal(15, 2) - - with con.begin() as c: - for table in tables: - prefix = prefixes.get(table, table[0]) - - t = ( - con.table(table, database=("tpch", "tiny")) - .rename(f"{prefix}_{{}}".format) - # https://github.com/trinodb/trino/issues/19477 - .mutate( - s.across(s.of_type(dt.float64), lambda c: c.cast(decimal_type)) - ) - ) - - sql = sge.Create( - kind="VIEW", - this=sg.table(table, db=database, catalog=catalog), - expression=self.connection._to_sqlglot(t), - replace=True, - ).sql("trino", pretty=True) - - c.execute(sql) - - def h(self, name: str): - from ibis import _ - - table = self.connection.table(name, database=("hive", "ibis_tpch_sf1")) - table = table.mutate(s.across(s.of_type("double"), _.cast("decimal(15, 2)"))) - return table + suite_name = f"tpc{suite}" + sqls = generate_tpc_tables(suite_name, data_dir=self.data_dir) + with self.connection.begin() as con: + con.execute(f"CREATE SCHEMA IF NOT EXISTS hive.{suite_name}") + for stmt in sqls: + raw_sql = stmt.sql("trino", pretty=True) + con.execute(raw_sql) @property def test_files(self) -> Iterable[Path]: @@ -206,3 +197,41 @@ def translate(): context = Backend.compiler.make_context() return lambda expr: (Backend.compiler.translator_class(expr, context).get_result()) + + +def generate_tpc_tables(suite_name, *, data_dir): + import pyarrow.parquet as pq + + tables = { + path.with_suffix("").name: sch.from_pyarrow_schema( + pq.read_metadata(path).schema.to_arrow_schema() + ) + for path in (data_dir / suite_name).rglob("*.parquet") + } + type_mapper = ibis.backends.trino.compiler.TrinoCompiler.type_mapper + return ( + sge.Create( + kind="TABLE", + exists=True, + this=sge.Schema( + this=sg.table(name, db=suite_name, catalog="hive", quoted=True), + expressions=[ + sge.ColumnDef( + this=sg.to_identifier(col, quoted=True), + kind=type_mapper.from_ibis(dtype), + ) + for col, dtype in schema.items() + ], + ), + properties=sge.Properties( + expressions=[ + sge.Property( + this="external_location", + value=sge.convert(f"s3a://trino/{suite_name}/{name}"), + ), + sge.Property(this="format", value=sge.convert("PARQUET")), + ] + ), + ) + for name, schema in tables.items() + )