Repository: narwhals-dev/narwhals
Pull request #877 (2024-08-30 10:30:44)

Test dask wih npartitions
<!--
# Thanks for contributing a pull request! 
## Please make sure you see our contribution guidelines: https://github.com/narwhals-dev/narwhals/blob/main/CONTRIBUTING.md
-->

## What type of PR is this? (check all applicable)

- [ ] 💾 Refactor
- [ ] ✨ Feature
- [ ] 🐛 Bug Fix
- [ ] 🔧 Optimization
- [ ] 📝 Documentation
- [x] ✅ Test
- [ ] 🐳 Other

## Related issues 

- Related issue # 
- Closes #

## Checklist

- [x] Code follows style guide (ruff)
- [ ] Tests added 
- [ ] Documented the changes

## If you have comments or can explain your changes, please do so below.




Patch:
diff --git a/.gitignore b/.gitignore
index d6edf57e..1a25d2b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ site/
 .coverage.*
 .nox
 *.lock
+tpch/data/*
 
 docs/api-completeness/*.md
 !docs/api-completeness/index.md
\ No newline at end of file
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4914e7e1..57e766f5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,7 +13,7 @@ repos:
   hooks:
     - id: mypy
       additional_dependencies: ['polars==1.4.1', 'pytest==8.3.2']
-      exclude: utils|tpch
+      files: ^(narwhals|tests)/
 - repo: https://github.com/codespell-project/codespell
   rev: 'v2.3.0'
   hooks:
diff --git a/docs/installation.md b/docs/installation.md
index 04625c68..2ac5f7e4 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -11,6 +11,6 @@ Then, if you start the Python REPL and see the following:
 ```python
 >>> import narwhals
 >>> narwhals.__version__
-'1.5.5'
+'1.6.0'
 ```
 then installation worked correctly!
diff --git a/narwhals/__init__.py b/narwhals/__init__.py
index 0977e716..fa7a23d3 100644
--- a/narwhals/__init__.py
+++ b/narwhals/__init__.py
@@ -53,7 +53,7 @@ from narwhals.utils import maybe_convert_dtypes
 from narwhals.utils import maybe_get_index
 from narwhals.utils import maybe_set_index
 
-__version__ = "1.5.5"
+__version__ = "1.6.0"
 
 __all__ = [
     "dependencies",
diff --git a/narwhals/_arrow/dataframe.py b/narwhals/_arrow/dataframe.py
index 20e50716..f6cb4710 100644
--- a/narwhals/_arrow/dataframe.py
+++ b/narwhals/_arrow/dataframe.py
@@ -21,6 +21,7 @@ from narwhals.utils import parse_columns_to_drop
 
 if TYPE_CHECKING:
     import numpy as np
+    import pyarrow as pa
     from typing_extensions import Self
 
     from narwhals._arrow.group_by import ArrowGroupBy
@@ -33,7 +34,7 @@ if TYPE_CHECKING:
 class ArrowDataFrame:
     # --- not in the spec ---
     def __init__(
-        self, native_dataframe: Any, *, backend_version: tuple[int, ...]
+        self, native_dataframe: pa.Table, *, backend_version: tuple[int, ...]
     ) -> None:
         self._native_frame = native_dataframe
         self._implementation = Implementation.PYARROW
diff --git a/narwhals/_arrow/expr.py b/narwhals/_arrow/expr.py
index ca9293b8..593e73eb 100644
--- a/narwhals/_arrow/expr.py
+++ b/narwhals/_arrow/expr.py
@@ -15,6 +15,7 @@ if TYPE_CHECKING:
     from narwhals._arrow.dataframe import ArrowDataFrame
     from narwhals._arrow.namespace import ArrowNamespace
     from narwhals._arrow.series import ArrowSeries
+    from narwhals._arrow.typing import IntoArrowExpr
     from narwhals.dtypes import DType
 
 
@@ -157,7 +158,7 @@ class ArrowExpr:
     def len(self) -> Self:
         return reuse_series_implementation(self, "len", returns_scalar=True)
 
-    def filter(self, *predicates: Any) -> Self:
+    def filter(self, *predicates: IntoArrowExpr) -> Self:
         plx = self.__narwhals_namespace__()
         expr = plx.all_horizontal(*predicates)
         return reuse_series_implementation(self, "filter", other=expr)
@@ -228,7 +229,7 @@ class ArrowExpr:
     def is_null(self) -> Self:
         return reuse_series_implementation(self, "is_null")
 
-    def is_between(self, lower_bound: Any, upper_bound: Any, closed: str) -> Any:
+    def is_between(self, lower_bound: Any, upper_bound: Any, closed: str) -> Self:
         return reuse_series_implementation(
             self, "is_between", lower_bound, upper_bound, closed
         )
diff --git a/narwhals/_arrow/series.py b/narwhals/_arrow/series.py
index 1e9e4a08..9d3d690d 100644
--- a/narwhals/_arrow/series.py
+++ b/narwhals/_arrow/series.py
@@ -18,6 +18,7 @@ from narwhals.utils import Implementation
 from narwhals.utils import generate_unique_token
 
 if TYPE_CHECKING:
+    import pyarrow as pa
     from typing_extensions import Self
 
     from narwhals._arrow.dataframe import ArrowDataFrame
@@ -26,7 +27,11 @@ if TYPE_CHECKING:
 
 class ArrowSeries:
     def __init__(
-        self, native_series: Any, *, name: str, backend_version: tuple[int, ...]
+        self,
+        native_series: pa.ChunkedArray,
+        *,
+        name: str,
+        backend_version: tuple[int, ...],
     ) -> None:
         self._name = name
         self._native_series = native_series
@@ -366,7 +371,9 @@ class ArrowSeries:
 
         return pc.all(self._native_series)  # type: ignore[no-any-return]
 
-    def is_between(self, lower_bound: Any, upper_bound: Any, closed: str = "both") -> Any:
+    def is_between(
+        self, lower_bound: Any, upper_bound: Any, closed: str = "both"
+    ) -> Self:
         import pyarrow.compute as pc  # ignore-banned-import()
 
         ser = self._native_series
@@ -657,7 +664,7 @@ class ArrowSeries:
 
         return self._from_native_series(arr)
 
-    def to_arrow(self: Self) -> Any:
+    def to_arrow(self: Self) -> pa.Array:
         return self._native_series.combine_chunks()
 
     @property
diff --git a/narwhals/dataframe.py b/narwhals/dataframe.py
index 64df5913..878ef2c4 100644
--- a/narwhals/dataframe.py
+++ b/narwhals/dataframe.py
@@ -190,7 +190,7 @@ class BaseFrame(Generic[FrameT]):
         _supported_joins = ("inner", "left", "cross", "anti", "semi")
 
         if how not in _supported_joins:
-            msg = f"Only the following join stragies are supported: {_supported_joins}; found '{how}'."
+            msg = f"Only the following join strategies are supported: {_supported_joins}; found '{how}'."
             raise NotImplementedError(msg)
 
         if how == "cross" and (left_on or right_on):
diff --git a/pyproject.toml b/pyproject.toml
index 2aa6c800..ab7ff24a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
 
 [project]
 name = "narwhals"
-version = "1.5.5"
+version = "1.6.0"
 authors = [
   { name="Marco Gorelli", email="33491632+MarcoGorelli@users.noreply.github.com" },
 ]
@@ -23,6 +23,12 @@ exclude = [
   "/docs",
   "/tests",
   "/tpch",
+  "/utils",
+  ".gitignore",
+  "CONTRIBUTING.md",
+  "mkdocs.yml",
+  "noxfile.py",
+  "requirements-dev.txt",
 ]
 
 [project.optional-dependencies]
@@ -71,6 +77,7 @@ lint.ignore = [
 [tool.ruff.lint.per-file-ignores]
 "tests/*" = ["S101"]
 "utils/*" = ["S311", "PTH123"]
+"tpch/execute/*" = ["T201"]
 
 [tool.ruff.lint.pydocstyle]
 convention = "google"
diff --git a/tpch/README.md b/tpch/README.md
new file mode 100644
index 00000000..3ae09b72
--- /dev/null
+++ b/tpch/README.md
@@ -0,0 +1,17 @@
+# Narwhals TPC-H queries
+
+Utilities for running the TPC-H queries via Narwhals.
+
+Before getting started, make sure you've followed the instructions in
+`CONTRIBUTING.MD`.
+
+## Generate data
+
+Run `python generate_data.py` from this folder.
+
+## Run queries
+
+To run Q1, you can run `python -m execute.q1` from this folder.
+
+Please add query definitions in `queries`, and scripts to execute them
+in `execute` (see `queries/q1.py` and `execute/q1.py` for examples).
diff --git a/tpch/execute/__init__.py b/tpch/execute/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tpch/execute/q1.py b/tpch/execute/q1.py
new file mode 100644
index 00000000..dd839b29
--- /dev/null
+++ b/tpch/execute/q1.py
@@ -0,0 +1,28 @@
+from pathlib import Path
+
+import dask.dataframe as dd
+import pandas as pd
+import polars as pl
+import pyarrow.parquet as pq
+from queries import q1
+
+pd.options.mode.copy_on_write = True
+pd.options.future.infer_string = True
+
+lineitem = Path("data") / "lineitem.parquet"
+
+IO_FUNCS = {
+    "pandas": lambda x: pd.read_parquet(x, engine="pyarrow"),
+    "pandas[pyarrow]": lambda x: pd.read_parquet(
+        x, engine="pyarrow", dtype_backend="pyarrow"
+    ),
+    "polars[eager]": lambda x: pl.read_parquet(x),
+    "polars[lazy]": lambda x: pl.scan_parquet(x),
+    "pyarrow": lambda x: pq.read_table(x),
+    "dask": lambda x: dd.read_parquet(x, engine="pyarrow", dtype_backend="pyarrow"),
+}
+
+print(q1.query(IO_FUNCS["pandas[pyarrow]"](lineitem)))
+print(q1.query(IO_FUNCS["polars[lazy]"](lineitem)).collect())
+print(q1.query(IO_FUNCS["pyarrow"](lineitem)))
+print(q1.query(IO_FUNCS["dask"](lineitem)).compute())
diff --git a/tpch/execute/q10.py b/tpch/execute/q10.py
new file mode 100644
index 00000000..19e2e7ce
--- /dev/null
+++ b/tpch/execute/q10.py
@@ -0,0 +1,38 @@
+from pathlib import Path
+
+import pandas as pd
+import polars as pl
+from queries import q10
+
+pd.options.mode.copy_on_write = True
+pd.options.future.infer_string = True
+
+customer = Path("data") / "customer.parquet"
+nation = Path("data") / "nation.parquet"
+lineitem = Path("data") / "lineitem.parquet"
+orders = Path("data") / "orders.parquet"
+
+IO_FUNCS = {
+    "pandas": lambda x: pd.read_parquet(x, engine="pyarrow"),
+    "pandas[pyarrow]": lambda x: pd.read_parquet(
+        x, engine="pyarrow", dtype_backend="pyarrow"
+    ),
+    "polars[eager]": lambda x: pl.read_parquet(x),
+    "polars[lazy]": lambda x: pl.scan_parquet(x),
+}
+
+tool = "pandas"
+fn = IO_FUNCS[tool]
+print(q10.query(fn(customer), fn(nation), fn(lineitem), fn(orders)))
+
+tool = "pandas[pyarrow]"
+fn = IO_FUNCS[tool]
+print(q10.query(fn(customer), fn(nation), fn(lineitem), fn(orders)))
+
+tool = "polars[eager]"
+fn = IO_FUNCS[tool]
+print(q10.query(fn(customer), fn(nation), fn(lineitem), fn(orders)))
+
+tool = "polars[lazy]"
+fn = IO_FUNCS[tool]
+print(q10.query(fn(customer), fn(nation), fn(lineitem), fn(orders)).collect())
diff --git a/tpch/execute/q2.py b/tpch/execute/q2.py
new file mode 100644
index 00000000..22a7f431
--- /dev/null
+++ b/tpch/execute/q2.py
@@ -0,0 +1,73 @@
+from pathlib import Path
+
+import dask.dataframe as dd
+import pandas as pd
+import polars as pl
+import pyarrow.parquet as pq
+from queries import q2
+
+pd.options.mode.copy_on_write = True
+pd.options.future.infer_string = True
+
+region = Path("data") / "region.parquet"
+nation = Path("data") / "nation.parquet"
+supplier = Path("data") / "supplier.parquet"
+part = Path("data") / "part.parquet"
+partsupp = Path("data") / "partsupp.parquet"
+
+IO_FUNCS = {
+    "pandas": lambda x: pd.read_parquet(x, engine="pyarrow"),
+    "pandas[pyarrow]": lambda x: pd.read_parquet(
+        x, engine="pyarrow", dtype_backend="pyarrow"
+    ),
+    "polars[eager]": lambda x: pl.read_parquet(x),
+    "polars[lazy]": lambda x: pl.scan_parquet(x),
+    "pyarrow": lambda x: pq.read_table(x),
+    "dask": lambda x: dd.read_parquet(x, engine="pyarrow", dtype_backend="pyarrow"),
+}
+
+
+tool = "pandas[pyarrow]"
+fn = IO_FUNCS[tool]
+print(
+    q2.query(
+        fn(region),
+        fn(nation),
+        fn(supplier),
+        fn(part),
+        fn(partsupp),
+    )
+)
+tool = "polars[lazy]"
+fn = IO_FUNCS[tool]
+print(
+    q2.query(
+        fn(region),
+        fn(nation),
+        fn(supplier),
+        fn(part),
+        fn(partsupp),
+    ).collect()
+)
+tool = "pyarrow"
+fn = IO_FUNCS[tool]
+print(
+    q2.query(
+        fn(region),
+        fn(nation),
+        fn(supplier),
+        fn(part),
+        fn(partsupp),
+    )
+)
+tool = "dask"
+fn = IO_FUNCS[tool]
+print(
+    q2.query(
+        fn(region),
+        fn(nation),
+        fn(supplier),
+        fn(part),
+        fn(partsupp),
+    ).compute()
+)
diff --git a/tpch/generate_data.py b/tpch/generate_data.py
new file mode 100644
index 00000000..9ae7c321
--- /dev/null
+++ b/tpch/generate_data.py
@@ -0,0 +1,36 @@
+from pathlib import Path
+
+import duckdb
+import pyarrow as pa
+import pyarrow.parquet as pq
+import tqdm
+
+if not Path("data").exists():
+    Path("data").mkdir()
+
+con = duckdb.connect(database=":memory:")
+con.execute("INSTALL tpch; LOAD tpch")
+con.execute("CALL dbgen(sf=1)")
+tables = [
+    "lineitem",
+    "customer",
+    "nation",
+    "orders",
+    "part",
+    "partsupp",
+    "region",
+    "supplier",
+]
+for t in tqdm.tqdm(tables):
+    res = con.query("SELECT * FROM " + t)  # noqa: S608
+    res_arrow = res.to_arrow_table()
+    new_schema = []
+    for field in res_arrow.schema:
+        if isinstance(field.type, type(pa.decimal128(1))):
+            new_schema.append(pa.field(field.name, pa.float64()))
+        elif field.type == pa.date32():
+            new_schema.append(pa.field(field.name, pa.timestamp("ns")))
+        else:
+            new_schema.append(field)
+    res_arrow = res_arrow.cast(pa.schema(new_schema))
+    pq.write_table(res_arrow, Path("data") / f"{t}.parquet")
diff --git a/tpch/notebooks/gpu/execute.ipynb b/tpch/notebooks/gpu/execute.ipynb
deleted file mode 100755
index a117c918..00000000
--- a/tpch/notebooks/gpu/execute.ipynb
+++ /dev/null
@@ -1,616 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "0",
-   "metadata": {
-    "papermill": {
-     "duration": 13.50746,
-     "end_time": "2024-03-23T16:07:02.428026",
-     "exception": false,
-     "start_time": "2024-03-23T16:06:48.920566",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "!pip install -U narwhals>=0.7.2"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "1",
-   "metadata": {
-    "papermill": {
-     "duration": 276.933638,
-     "end_time": "2024-03-23T16:11:39.366857",
-     "exception": false,
-     "start_time": "2024-03-23T16:07:02.433219",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "# Remove all conda packages\n",
-    "!find /opt/conda \\( -name \"cudf*\" -o -name \"libcudf*\" -o -name \"cuml*\" -o -name \"libcuml*\" \\\n",
-    "                   -o -name \"cugraph*\" -o -name \"libcugraph*\" -o -name \"raft*\" -o -name \"libraft*\" \\\n",
-    "                   -o -name \"pylibraft*\" -o -name \"libkvikio*\" -o -name \"*dask*\" -o -name \"rmm*\"\\\n",
-    "                   -o -name \"librmm*\" \\) -exec rm -rf {} \\; 2>/dev/null\n",
-    "\n",
-    "# pip uninstall, just incase there are packages lying around\n",
-    "!pip uninstall cudf cuml dask-cudf cuml cugraph cupy cupy-cuda12x --y\n",
-    "\n",
-    "\n",
-    "!pip install \\\n",
-    "    --extra-index-url=https://pypi.nvidia.com \\\n",
-    "    cudf-cu12==24.2.* \\\n",
-    "    dask-cudf-cu12==24.2.* \\\n",
-    "    cuml-cu12==24.2.* \\\n",
-    "    cugraph-cu12==24.2.*\n",
-    "\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "2",
-   "metadata": {
-    "papermill": {
-     "duration": 4.147764,
-     "end_time": "2024-03-23T16:11:43.699466",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:39.551702",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import cudf"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "3",
-   "metadata": {
-    "papermill": {
-     "duration": 0.148115,
-     "end_time": "2024-03-23T16:11:44.003370",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:43.855255",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": []
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "4",
-   "metadata": {
-    "papermill": {
-     "duration": 0.186887,
-     "end_time": "2024-03-23T16:11:44.341982",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:44.155095",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "from typing import Any\n",
-    "from datetime import datetime\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q1(df_raw: Any) -> Any:\n",
-    "    var_1 = datetime(1998, 9, 2)\n",
-    "    df = nw.from_native(df_raw)\n",
-    "    result = (\n",
-    "        df.filter(nw.col(\"l_shipdate\") <= var_1)\n",
-    "        .with_columns(\n",
-    "            disc_price=nw.col(\"l_extendedprice\") * (1 - nw.col(\"l_discount\")),\n",
-    "            charge=(\n",
-    "                nw.col(\"l_extendedprice\")\n",
-    "                * (1.0 - nw.col(\"l_discount\"))\n",
-    "                * (1.0 + nw.col(\"l_tax\"))\n",
-    "            ),\n",
-    "        )\n",
-    "        .group_by([\"l_returnflag\", \"l_linestatus\"])\n",
-    "        .agg(\n",
-    "            [\n",
-    "                nw.sum(\"l_quantity\").alias(\"sum_qty\"),\n",
-    "                nw.sum(\"l_extendedprice\").alias(\"sum_base_price\"),\n",
-    "                nw.sum(\"disc_price\").alias(\"sum_disc_price\"),\n",
-    "                nw.col(\"charge\").sum().alias(\"sum_charge\"),\n",
-    "                nw.mean(\"l_quantity\").alias(\"avg_qty\"),\n",
-    "                nw.mean(\"l_extendedprice\").alias(\"avg_price\"),\n",
-    "                nw.mean(\"l_discount\").alias(\"avg_disc\"),\n",
-    "                nw.len().alias(\"count_order\"),\n",
-    "            ],\n",
-    "        )\n",
-    "        .sort([\"l_returnflag\", \"l_linestatus\"])\n",
-    "    )\n",
-    "    return nw.to_native(result)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "5",
-   "metadata": {
-    "papermill": {
-     "duration": 0.158162,
-     "end_time": "2024-03-23T16:11:44.671154",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:44.512992",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "\n",
-    "\n",
-    "from typing import Any\n",
-    "from datetime import datetime\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q2(\n",
-    "    region_ds_raw: Any,\n",
-    "    nation_ds_raw: Any,\n",
-    "    supplier_ds_raw: Any,\n",
-    "    part_ds_raw: Any,\n",
-    "    part_supp_ds_raw: Any,\n",
-    ") -> Any:\n",
-    "    var_1 = 15\n",
-    "    var_2 = \"BRASS\"\n",
-    "    var_3 = \"EUROPE\"\n",
-    "\n",
-    "    region_ds = nw.from_native(region_ds_raw)\n",
-    "    nation_ds = nw.from_native(nation_ds_raw)\n",
-    "    supplier_ds = nw.from_native(supplier_ds_raw)\n",
-    "    part_ds = nw.from_native(part_ds_raw)\n",
-    "    part_supp_ds = nw.from_native(part_supp_ds_raw)\n",
-    "\n",
-    "    result_q2 = (\n",
-    "        part_ds.join(part_supp_ds, left_on=\"p_partkey\", right_on=\"ps_partkey\")\n",
-    "        .join(supplier_ds, left_on=\"ps_suppkey\", right_on=\"s_suppkey\")\n",
-    "        .join(nation_ds, left_on=\"s_nationkey\", right_on=\"n_nationkey\")\n",
-    "        .join(region_ds, left_on=\"n_regionkey\", right_on=\"r_regionkey\")\n",
-    "        .filter(nw.col(\"p_size\") == var_1)\n",
-    "        .filter(nw.col(\"p_type\").str.ends_with(var_2))\n",
-    "        .filter(nw.col(\"r_name\") == var_3)\n",
-    "    )\n",
-    "\n",
-    "    final_cols = [\n",
-    "        \"s_acctbal\",\n",
-    "        \"s_name\",\n",
-    "        \"n_name\",\n",
-    "        \"p_partkey\",\n",
-    "        \"p_mfgr\",\n",
-    "        \"s_address\",\n",
-    "        \"s_phone\",\n",
-    "        \"s_comment\",\n",
-    "    ]\n",
-    "\n",
-    "    q_final = (\n",
-    "        result_q2.group_by(\"p_partkey\")\n",
-    "        .agg(nw.min(\"ps_supplycost\").alias(\"ps_supplycost\"))\n",
-    "        .join(\n",
-    "            result_q2,\n",
-    "            left_on=[\"p_partkey\", \"ps_supplycost\"],\n",
-    "            right_on=[\"p_partkey\", \"ps_supplycost\"],\n",
-    "        )\n",
-    "        .select(final_cols)\n",
-    "        .sort(\n",
-    "            by=[\"s_acctbal\", \"n_name\", \"s_name\", \"p_partkey\"],\n",
-    "            descending=[True, False, False, False],\n",
-    "        )\n",
-    "        .head(100)\n",
-    "    )\n",
-    "\n",
-    "    return nw.to_native(q_final)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "6",
-   "metadata": {
-    "papermill": {
-     "duration": 0.153978,
-     "end_time": "2024-03-23T16:11:44.967693",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:44.813715",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "from typing import Any\n",
-    "from datetime import datetime\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q3(\n",
-    "    customer_ds_raw: Any,\n",
-    "    line_item_ds_raw: Any,\n",
-    "    orders_ds_raw: Any,\n",
-    ") -> Any:\n",
-    "    var_1 = var_2 = datetime(1995, 3, 15)\n",
-    "    var_3 = \"BUILDING\"\n",
-    "\n",
-    "    customer_ds = nw.from_native(customer_ds_raw)\n",
-    "    line_item_ds = nw.from_native(line_item_ds_raw)\n",
-    "    orders_ds = nw.from_native(orders_ds_raw)\n",
-    "\n",
-    "    q_final = (\n",
-    "        customer_ds.filter(nw.col(\"c_mktsegment\") == var_3)\n",
-    "        .join(orders_ds, left_on=\"c_custkey\", right_on=\"o_custkey\")\n",
-    "        .join(line_item_ds, left_on=\"o_orderkey\", right_on=\"l_orderkey\")\n",
-    "        .filter(nw.col(\"o_orderdate\") < var_2)\n",
-    "        .filter(nw.col(\"l_shipdate\") > var_1)\n",
-    "        .with_columns(\n",
-    "            (nw.col(\"l_extendedprice\") * (1 - nw.col(\"l_discount\"))).alias(\"revenue\")\n",
-    "        )\n",
-    "        .group_by([\"o_orderkey\", \"o_orderdate\", \"o_shippriority\"])\n",
-    "        .agg([nw.sum(\"revenue\")])\n",
-    "        .select(\n",
-    "            [\n",
-    "                nw.col(\"o_orderkey\").alias(\"l_orderkey\"),\n",
-    "                \"revenue\",\n",
-    "                \"o_orderdate\",\n",
-    "                \"o_shippriority\",\n",
-    "            ]\n",
-    "        )\n",
-    "        .sort(by=[\"revenue\", \"o_orderdate\"], descending=[True, False])\n",
-    "        .head(10)\n",
-    "    )\n",
-    "\n",
-    "    return nw.to_native(q_final)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "7",
-   "metadata": {
-    "papermill": {
-     "duration": 0.153799,
-     "end_time": "2024-03-23T16:11:45.265846",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:45.112047",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "\n",
-    "\n",
-    "from typing import Any\n",
-    "from datetime import datetime\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q4(\n",
-    "    lineitem_ds_raw: Any,\n",
-    "    orders_ds_raw: Any,\n",
-    ") -> Any:\n",
-    "    var_1 = datetime(1993, 7, 1)\n",
-    "    var_2 = datetime(1993, 10, 1)\n",
-    "\n",
-    "    line_item_ds = nw.from_native(lineitem_ds_raw)\n",
-    "    orders_ds = nw.from_native(orders_ds_raw)\n",
-    "\n",
-    "    result = (\n",
-    "        line_item_ds.join(orders_ds, left_on=\"l_orderkey\", right_on=\"o_orderkey\")\n",
-    "        .filter(nw.col(\"o_orderdate\").is_between(var_1, var_2, closed=\"left\"))\n",
-    "        .filter(nw.col(\"l_commitdate\") < nw.col(\"l_receiptdate\"))\n",
-    "        .unique(subset=[\"o_orderpriority\", \"l_orderkey\"])\n",
-    "        .group_by(\"o_orderpriority\")\n",
-    "        .agg(nw.len().alias(\"order_count\"))\n",
-    "        .sort(by=\"o_orderpriority\")\n",
-    "        .with_columns(nw.col(\"order_count\").cast(nw.Int64))\n",
-    "    )\n",
-    "\n",
-    "    return nw.to_native(result)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "8",
-   "metadata": {
-    "papermill": {
-     "duration": 0.159087,
-     "end_time": "2024-03-23T16:11:45.567586",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:45.408499",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "from typing import Any\n",
-    "from datetime import datetime\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q5(\n",
-    "    region_ds_raw: Any,\n",
-    "    nation_ds_raw: Any,\n",
-    "    customer_ds_raw: Any,\n",
-    "    lineitem_ds_raw: Any,\n",
-    "    orders_ds_raw: Any,\n",
-    "    supplier_ds_raw: Any,\n",
-    ") -> Any:\n",
-    "    var_1 = \"ASIA\"\n",
-    "    var_2 = datetime(1994, 1, 1)\n",
-    "    var_3 = datetime(1995, 1, 1)\n",
-    "\n",
-    "    region_ds = nw.from_native(region_ds_raw)\n",
-    "    nation_ds = nw.from_native(nation_ds_raw)\n",
-    "    customer_ds = nw.from_native(customer_ds_raw)\n",
-    "    line_item_ds = nw.from_native(lineitem_ds_raw)\n",
-    "    orders_ds = nw.from_native(orders_ds_raw)\n",
-    "    supplier_ds = nw.from_native(supplier_ds_raw)\n",
-    "\n",
-    "    result = (\n",
-    "        region_ds.join(nation_ds, left_on=\"r_regionkey\", right_on=\"n_regionkey\")\n",
-    "        .join(customer_ds, left_on=\"n_nationkey\", right_on=\"c_nationkey\")\n",
-    "        .join(orders_ds, left_on=\"c_custkey\", right_on=\"o_custkey\")\n",
-    "        .join(line_item_ds, left_on=\"o_orderkey\", right_on=\"l_orderkey\")\n",
-    "        .join(\n",
-    "            supplier_ds,\n",
-    "            left_on=[\"l_suppkey\", \"n_nationkey\"],\n",
-    "            right_on=[\"s_suppkey\", \"s_nationkey\"],\n",
-    "        )\n",
-    "        .filter(\n",
-    "            nw.col(\"r_name\") == var_1,\n",
-    "            nw.col(\"o_orderdate\").is_between(var_2, var_3, closed=\"left\")\n",
-    "        )\n",
-    "        .with_columns(\n",
-    "            (nw.col(\"l_extendedprice\") * (1 - nw.col(\"l_discount\"))).alias(\"revenue\")\n",
-    "        )\n",
-    "        .group_by(\"n_name\")\n",
-    "        .agg([nw.sum(\"revenue\")])\n",
-    "        .sort(by=\"revenue\", descending=True)\n",
-    "    )\n",
-    "\n",
-    "    return nw.to_native(result)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "9",
-   "metadata": {
-    "papermill": {
-     "duration": 0.154065,
-     "end_time": "2024-03-23T16:11:45.865878",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:45.711813",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "dir_ = \"/kaggle/input/tpc-h-data-parquet-s-2/\"\n",
-    "region = dir_ + 'region.parquet'\n",
-    "nation = dir_ + 'nation.parquet'\n",
-    "customer = dir_ + 'customer.parquet'\n",
-    "lineitem = dir_ + 'lineitem.parquet'\n",
-    "orders = dir_ + 'orders.parquet'\n",
-    "supplier = dir_ + 'supplier.parquet'\n",
-    "part = dir_ + 'part.parquet'\n",
-    "partsupp = dir_ + 'partsupp.parquet'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "10",
-   "metadata": {
-    "papermill": {
-     "duration": 0.149554,
-     "end_time": "2024-03-23T16:11:46.157770",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:46.008216",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "results = {}"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "11",
-   "metadata": {
-    "papermill": {
-     "duration": 112.394193,
-     "end_time": "2024-03-23T16:13:38.694589",
-     "exception": false,
-     "start_time": "2024-03-23T16:11:46.300396",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import cudf\n",
-    "fn = cudf.read_parquet\n",
-    "timings = %timeit -o -q q1(fn(lineitem))\n",
-    "results['q1'] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "12",
-   "metadata": {
-    "papermill": {
-     "duration": 7.722805,
-     "end_time": "2024-03-23T16:13:46.572524",
-     "exception": false,
-     "start_time": "2024-03-23T16:13:38.849719",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import cudf\n",
-    "fn = cudf.read_parquet\n",
-    "timings = %timeit -o -q q2(fn(region), fn(nation), fn(supplier), fn(part), fn(partsupp))\n",
-    "results['q2'] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "13",
-   "metadata": {
-    "papermill": {
-     "duration": 8.745438,
-     "end_time": "2024-03-23T16:13:55.465888",
-     "exception": false,
-     "start_time": "2024-03-23T16:13:46.720450",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import cudf\n",
-    "fn = cudf.read_parquet\n",
-    "timings = %timeit -o -q q3(fn(customer), fn(lineitem), fn(orders))\n",
-    "results['q3'] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "14",
-   "metadata": {
-    "papermill": {
-     "duration": 9.273157,
-     "end_time": "2024-03-23T16:14:04.904258",
-     "exception": false,
-     "start_time": "2024-03-23T16:13:55.631101",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import cudf\n",
-    "fn = cudf.read_parquet\n",
-    "timings = %timeit -o -q q4(fn(lineitem), fn(orders))\n",
-    "results['q4'] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "15",
-   "metadata": {
-    "papermill": {
-     "duration": 11.308626,
-     "end_time": "2024-03-23T16:14:16.369678",
-     "exception": false,
-     "start_time": "2024-03-23T16:14:05.061052",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import cudf\n",
-    "fn = cudf.read_parquet\n",
-    "timings = %timeit -o -q q5(fn(region), fn(nation), fn(customer), fn(lineitem), fn(orders), fn(supplier))\n",
-    "results['q5'] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "16",
-   "metadata": {
-    "papermill": {
-     "duration": 0.157455,
-     "end_time": "2024-03-23T16:14:16.689793",
-     "exception": false,
-     "start_time": "2024-03-23T16:14:16.532338",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import json\n",
-    "with open('results.json', 'w') as fd:\n",
-    "    json.dump(results, fd)"
-   ]
-  }
- ],
- "metadata": {
-  "kaggle": {
-   "accelerator": "nvidiaTeslaT4",
-   "dataSources": [
-    {
-     "sourceId": 167796934,
-     "sourceType": "kernelVersion"
-    }
-   ],
-   "dockerImageVersionId": 30674,
-   "isGpuEnabled": true,
-   "isInternetEnabled": true,
-   "language": "python",
-   "sourceType": "notebook"
-  },
-  "kernelspec": {
-   "display_name": "Python 3",
-   "language": "python",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.10.13"
-  },
-  "papermill": {
-   "default_parameters": {},
-   "duration": 451.646729,
-   "end_time": "2024-03-23T16:14:17.553113",
-   "environment_variables": {},
-   "exception": null,
-   "input_path": "__notebook__.ipynb",
-   "output_path": "__notebook__.ipynb",
-   "parameters": {},
-   "start_time": "2024-03-23T16:06:45.906384",
-   "version": "2.5.0"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}
diff --git a/tpch/notebooks/gpu/kernel-metadata.json b/tpch/notebooks/gpu/kernel-metadata.json
deleted file mode 100644
index 128aea00..00000000
--- a/tpch/notebooks/gpu/kernel-metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "id": "marcogorelli/narwhals-tpch-gpu-s2",
-  "title": "Narwhals TPCH GPU S2",
-  "code_file": "execute.ipynb",
-  "language": "python",
-  "kernel_type": "notebook",
-  "is_private": "false",
-  "enable_gpu": "true",
-  "enable_tpu": "false",
-  "enable_internet": "true",
-  "dataset_sources": [],
-  "competition_sources": [],
-  "kernel_sources": ["marcogorelli/tpc-h-data-parquet-s-2"],
-  "model_sources": []
-}
\ No newline at end of file
diff --git a/tpch/notebooks/q8/execute.ipynb b/tpch/notebooks/q8/execute.ipynb
deleted file mode 100755
index b10b8790..00000000
--- a/tpch/notebooks/q8/execute.ipynb
+++ /dev/null
@@ -1,502 +0,0 @@
-{
- "cells": [
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "0",
-   "metadata": {
-    "papermill": {
-     "duration": 33.390992,
-     "end_time": "2024-03-22T17:24:15.601719",
-     "exception": false,
-     "start_time": "2024-03-22T17:23:42.210727",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "!pip install -U polars pyarrow "
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "1",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "!pip install -U narwhals"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "2",
-   "metadata": {
-    "papermill": {
-     "duration": 0.907754,
-     "end_time": "2024-03-22T17:24:39.053873",
-     "exception": false,
-     "start_time": "2024-03-22T17:24:38.146119",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "import pandas as pd\n",
-    "import polars as pl\n",
-    "\n",
-    "pd.options.mode.copy_on_write = True\n",
-    "pd.options.future.infer_string = True"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "3",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "from typing import Any\n",
-    "from datetime import datetime, date\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q8_pandas_native(\n",
-    "    nation_ds,\n",
-    "    customer_ds,\n",
-    "    line_item_ds,\n",
-    "    orders_ds,\n",
-    "    supplier_ds,\n",
-    ") -> None:\n",
-    "    var1 = \"FRANCE\"\n",
-    "    var2 = \"GERMANY\"\n",
-    "    var3 = date(1995, 1, 1)\n",
-    "    var4 = date(1996, 12, 31)\n",
-    "\n",
-    "    n1 = nation_ds[(nation_ds[\"n_name\"] == var1)]\n",
-    "    n2 = nation_ds[(nation_ds[\"n_name\"] == var2)]\n",
-    "\n",
-    "    # Part 1\n",
-    "    jn1 = customer_ds.merge(n1, left_on=\"c_nationkey\", right_on=\"n_nationkey\")\n",
-    "    jn2 = jn1.merge(orders_ds, left_on=\"c_custkey\", right_on=\"o_custkey\")\n",
-    "    jn2 = jn2.rename({\"n_name\": \"cust_nation\"}, axis=\"columns\")\n",
-    "    jn3 = jn2.merge(line_item_ds, left_on=\"o_orderkey\", right_on=\"l_orderkey\")\n",
-    "    jn4 = jn3.merge(supplier_ds, left_on=\"l_suppkey\", right_on=\"s_suppkey\")\n",
-    "    jn5 = jn4.merge(n2, left_on=\"s_nationkey\", right_on=\"n_nationkey\")\n",
-    "    df1 = jn5.rename({\"n_name\": \"supp_nation\"}, axis=\"columns\")\n",
-    "\n",
-    "    # Part 2\n",
-    "    jn1 = customer_ds.merge(n2, left_on=\"c_nationkey\", right_on=\"n_nationkey\")\n",
-    "    jn2 = jn1.merge(orders_ds, left_on=\"c_custkey\", right_on=\"o_custkey\")\n",
-    "    jn2 = jn2.rename({\"n_name\": \"cust_nation\"}, axis=\"columns\")\n",
-    "    jn3 = jn2.merge(line_item_ds, left_on=\"o_orderkey\", right_on=\"l_orderkey\")\n",
-    "    jn4 = jn3.merge(supplier_ds, left_on=\"l_suppkey\", right_on=\"s_suppkey\")\n",
-    "    jn5 = jn4.merge(n1, left_on=\"s_nationkey\", right_on=\"n_nationkey\")\n",
-    "    df2 = jn5.rename({\"n_name\": \"supp_nation\"}, axis=\"columns\")\n",
-    "\n",
-    "    # Combine\n",
-    "    total = pd.concat([df1, df2])\n",
-    "\n",
-    "    total = total[(total[\"l_shipdate\"] >= var3) & (total[\"l_shipdate\"] <= var4)]\n",
-    "    total[\"volume\"] = total[\"l_extendedprice\"] * (1.0 - total[\"l_discount\"])\n",
-    "    total[\"l_year\"] = total[\"l_shipdate\"].dt.year\n",
-    "\n",
-    "    gb = total.groupby([\"supp_nation\", \"cust_nation\", \"l_year\"], as_index=False)\n",
-    "    agg = gb.agg(revenue=pd.NamedAgg(column=\"volume\", aggfunc=\"sum\"))\n",
-    "\n",
-    "    result_df = agg.sort_values(by=[\"supp_nation\", \"cust_nation\", \"l_year\"])\n",
-    "\n",
-    "    return result_df  # type: ignore[no-any-return]"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "4",
-   "metadata": {
-    "papermill": {
-     "duration": 0.021725,
-     "end_time": "2024-03-22T17:24:39.080999",
-     "exception": false,
-     "start_time": "2024-03-22T17:24:39.059274",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "from typing import Any\n",
-    "from datetime import datetime\n",
-    "import narwhals as nw\n",
-    "\n",
-    "def q8(\n",
-    "    nation_ds_raw: Any,\n",
-    "    customer_ds_raw: Any,\n",
-    "    line_item_ds_raw: Any,\n",
-    "    orders_ds_raw: Any,\n",
-    "    supplier_ds_raw: Any,\n",
-    "    part_ds_raw: Any,\n",
-    ") -> None:\n",
-    "    nation_ds = nw.from_native(nation_ds_raw)\n",
-    "    customer_ds = nw.from_native(customer_ds_raw)\n",
-    "    line_item_ds = nw.from_native(line_item_ds_raw)\n",
-    "    orders_ds = nw.from_native(orders_ds_raw)\n",
-    "    supplier_ds = nw.from_native(supplier_ds_raw)\n",
-    "    part_ds = nw.from_native(part_ds_raw)\n",
-    "\n",
-    "    n1 = nation_ds.select(\"n_nationkey\", \"n_regionkey\")\n",
-    "    n2 = nation_ds.select(\"n_nationkey\", \"n_name\")\n",
-    "\n",
-    "    result = (\n",
-    "        part_ds.join(line_item_ds, left_on=\"p_partkey\", right_on=\"l_partkey\")\n",
-    "        .join(supplier_ds, left_on=\"l_suppkey\", right_on=\"s_suppkey\")\n",
-    "        .join(orders_ds, left_on=\"l_orderkey\", right_on=\"o_orderkey\")\n",
-    "        .join(customer_ds, left_on=\"o_custkey\", right_on=\"c_custkey\")\n",
-    "        .join(n1, left_on=\"c_nationkey\", right_on=\"n_nationkey\")\n",
-    "        .join(region_ds, left_on=\"n_regionkey\", right_on=\"r_regionkey\")\n",
-    "        .filter(nw.col(\"r_name\") == \"AMERICA\")\n",
-    "        .join(n2, left_on=\"s_nationkey\", right_on=\"n_nationkey\")\n",
-    "        .filter(\n",
-    "            nw.col(\"o_orderdate\")>= date(1995, 1, 1),\n",
-    "            nw.col('o_orderdate')<=date(1996, 12, 31)\n",
-    "        )\n",
-    "        .filter(nw.col(\"p_type\") == \"ECONOMY ANODIZED STEEL\")\n",
-    "        .select(\n",
-    "            nw.col(\"o_orderdate\").dt.year().alias(\"o_year\"),\n",
-    "            (nw.col(\"l_extendedprice\") * (1 - nw.col(\"l_discount\"))).alias(\"volume\"),\n",
-    "            nw.col(\"n_name\").alias(\"nation\"),\n",
-    "        )\n",
-    "        .with_columns(\n",
-    "            nw.when(nw.col(\"nation\") == \"BRAZIL\")\n",
-    "            .then(nw.col(\"volume\"))\n",
-    "            .otherwise(0)\n",
-    "            .alias(\"_tmp\")\n",
-    "        )\n",
-    "        .group_by(\"o_year\")\n",
-    "        .agg((nw.sum(\"_tmp\") / nw.sum(\"volume\")).round(2).alias(\"mkt_share\"))\n",
-    "        .sort(\"o_year\")\n",
-    "    )\n",
-    "    \n",
-    "    return nw.to_native(result)\n"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "5",
-   "metadata": {
-    "papermill": {
-     "duration": 0.013325,
-     "end_time": "2024-03-22T17:24:39.099766",
-     "exception": false,
-     "start_time": "2024-03-22T17:24:39.086441",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "dir_ = \"/kaggle/input/tpc-h-data-parquet-s-2/\"\n",
-    "region = dir_ + 'region.parquet'\n",
-    "nation = dir_ + 'nation.parquet'\n",
-    "customer = dir_ + 'customer.parquet'\n",
-    "lineitem = dir_ + 'lineitem.parquet'\n",
-    "orders = dir_ + 'orders.parquet'\n",
-    "supplier = dir_ + 'supplier.parquet'\n",
-    "part = dir_ + 'part.parquet'\n",
-    "partsupp = dir_ + 'partsupp.parquet'"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "6",
-   "metadata": {
-    "papermill": {
-     "duration": 0.014284,
-     "end_time": "2024-03-22T17:24:39.119737",
-     "exception": false,
-     "start_time": "2024-03-22T17:24:39.105453",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "IO_FUNCS = {\n",
-    "    'pandas': lambda x: pd.read_parquet(x, engine='pyarrow'),\n",
-    "    'pandas[pyarrow]': lambda x: pd.read_parquet(x, engine='pyarrow', dtype_backend='pyarrow'),\n",
-    "    'polars[eager]': lambda x: pl.read_parquet(x),\n",
-    "    'polars[lazy]': lambda x: pl.scan_parquet(x),\n",
-    "}"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "7",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "results = {}"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "8",
-   "metadata": {},
-   "source": [
-    "## pandas, pyarrow dtypes, native"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "9",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "tool = 'pandas[pyarrow]'\n",
-    "fn = IO_FUNCS[tool]\n",
-    "timings = %timeit -o -q q7_pandas_native(fn(nation), fn(customer), fn(lineitem), fn(orders), fn(supplier))\n",
-    "results[tool+'[native]'] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "10",
-   "metadata": {
-    "papermill": {
-     "duration": 0.005113,
-     "end_time": "2024-03-22T17:24:39.130472",
-     "exception": false,
-     "start_time": "2024-03-22T17:24:39.125359",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "source": [
-    "## pandas via Narwhals"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "11",
-   "metadata": {
-    "papermill": {
-     "duration": 196.786925,
-     "end_time": "2024-03-22T17:27:55.922832",
-     "exception": false,
-     "start_time": "2024-03-22T17:24:39.135907",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "tool = 'pandas'\n",
-    "fn = IO_FUNCS[tool]\n",
-    "timings = %timeit -o -q q7(fn(nation), fn(customer), fn(lineitem), fn(orders), fn(supplier))\n",
-    "results[tool] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "12",
-   "metadata": {
-    "papermill": {
-     "duration": 0.005184,
-     "end_time": "2024-03-22T17:27:55.933407",
-     "exception": false,
-     "start_time": "2024-03-22T17:27:55.928223",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "source": [
-    "## pandas, pyarrow dtypes, via Narwhals"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "13",
-   "metadata": {
-    "papermill": {
-     "duration": 158.748353,
-     "end_time": "2024-03-22T17:30:34.688289",
-     "exception": false,
-     "start_time": "2024-03-22T17:27:55.939936",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "tool = 'pandas[pyarrow]'\n",
-    "fn = IO_FUNCS[tool]\n",
-    "timings = %timeit -o -q q7(fn(nation), fn(customer), fn(lineitem), fn(orders), fn(supplier))\n",
-    "results[tool] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "14",
-   "metadata": {
-    "papermill": {
-     "duration": 0.005773,
-     "end_time": "2024-03-22T17:30:34.700300",
-     "exception": false,
-     "start_time": "2024-03-22T17:30:34.694527",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "source": [
-    "## Polars read_parquet"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "15",
-   "metadata": {
-    "papermill": {
-     "duration": 37.821116,
-     "end_time": "2024-03-22T17:31:12.527466",
-     "exception": false,
-     "start_time": "2024-03-22T17:30:34.706350",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "tool = 'polars[eager]'\n",
-    "fn = IO_FUNCS[tool]\n",
-    "timings = %timeit -o -q q7(fn(nation), fn(customer), fn(lineitem), fn(orders), fn(supplier))\n",
-    "results[tool] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "16",
-   "metadata": {
-    "papermill": {
-     "duration": 0.005515,
-     "end_time": "2024-03-22T17:31:12.539068",
-     "exception": false,
-     "start_time": "2024-03-22T17:31:12.533553",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "source": [
-    "## Polars scan_parquet"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "17",
-   "metadata": {
-    "papermill": {
-     "duration": 4.800698,
-     "end_time": "2024-03-22T17:31:17.346813",
-     "exception": false,
-     "start_time": "2024-03-22T17:31:12.546115",
-     "status": "completed"
-    },
-    "tags": []
-   },
-   "outputs": [],
-   "source": [
-    "tool = 'polars[lazy]'\n",
-    "fn = IO_FUNCS[tool]\n",
-    "timings = %timeit -o -q q7(fn(nation), fn(customer), fn(lineitem), fn(orders), fn(supplier)).collect()\n",
-    "results[tool] = timings.all_runs"
-   ]
-  },
-  {
-   "cell_type": "markdown",
-   "id": "18",
-   "metadata": {},
-   "source": [
-    "## Save"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "id": "19",
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "import json\n",
-    "with open('results.json', 'w') as fd:\n",
-    "    json.dump(results, fd)\n"
-   ]
-  }
- ],
- "metadata": {
-  "kaggle": {
-   "accelerator": "none",
-   "dataSources": [
-    {
-     "sourceId": 167796716,
-     "sourceType": "kernelVersion"
-    },
-    {
-     "sourceId": 167796934,
-     "sourceType": "kernelVersion"
-    },
-    {
-     "sourceId": 167796952,
-     "sourceType": "kernelVersion"
-    },
-    {
-     "sourceId": 167796969,
-     "sourceType": "kernelVersion"
-    }
-   ],
-   "isGpuEnabled": false,
-   "isInternetEnabled": true,
-   "language": "python",
-   "sourceType": "notebook"
-  },
-  "kernelspec": {
-   "display_name": "Python 3",
-   "language": "python",
-   "name": "python3"
-  },
-  "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
-   "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.11.8"
-  },
-  "papermill": {
-   "default_parameters": {},
-   "duration": 458.423327,
-   "end_time": "2024-03-22T17:31:18.077306",
-   "environment_variables": {},
-   "exception": null,
-   "input_path": "__notebook__.ipynb",
-   "output_path": "__notebook__.ipynb",
-   "parameters": {},
-   "start_time": "2024-03-22T17:23:39.653979",
-   "version": "2.5.0"
-  }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}
diff --git a/tpch/notebooks/q8/kernel-metadata.json b/tpch/notebooks/q8/kernel-metadata.json
deleted file mode 100644
index 1c67f0d5..00000000
--- a/tpch/notebooks/q8/kernel-metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "id": "marcogorelli/narwhals-tpch-q8-s2",
-  "title": "Narwhals TPCH Q8 S2",
-  "code_file": "execute.ipynb",
-  "language": "python",
-  "kernel_type": "notebook",
-  "is_private": "false",
-  "enable_gpu": "false",
-  "enable_tpu": "false",
-  "enable_internet": "true",
-  "dataset_sources": [],
-  "competition_sources": [],
-  "kernel_sources": ["marcogorelli/tpc-h-data-parquet-s-2"],
-  "model_sources": []
-}
\ No newline at end of file
diff --git a/tpch/queries/__init__.py b/tpch/queries/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tpch/queries/q1.py b/tpch/queries/q1.py
new file mode 100644
index 00000000..de615770
--- /dev/null
+++ b/tpch/queries/q1.py
@@ -0,0 +1,32 @@
+from datetime import datetime
+
+import narwhals as nw
+from narwhals.typing import FrameT
+
+
+@nw.narwhalify
+def query(lineitem: FrameT) -> FrameT:
+    var_1 = datetime(1998, 9, 2)
+    return (
+        lineitem.filter(nw.col("l_shipdate") <= var_1)
+        .with_columns(
+            disc_price=nw.col("l_extendedprice") * (1 - nw.col("l_discount")),
+            charge=(
+                nw.col("l_extendedprice")
+                * (1.0 - nw.col("l_discount"))
+                * (1.0 + nw.col("l_tax"))
+            ),
+        )
+        .group_by("l_returnflag", "l_linestatus")
+        .agg(
+            nw.sum("l_quantity").alias("sum_qty"),
+            nw.sum("l_extendedprice").alias("sum_base_price"),
+            nw.sum("disc_price").alias("sum_disc_price"),
+            nw.sum("charge").alias("sum_charge"),
+            nw.mean("l_quantity").alias("avg_qty"),
+            nw.mean("l_extendedprice").alias("avg_price"),
+            nw.mean("l_discount").alias("avg_disc"),
+            nw.len().alias("count_order"),
+        )
+        .sort("l_returnflag", "l_linestatus")
+    )
diff --git a/tpch/queries/q10.py b/tpch/queries/q10.py
new file mode 100644
index 00000000..3faa727f
--- /dev/null
+++ b/tpch/queries/q10.py
@@ -0,0 +1,50 @@
+from datetime import datetime
+
+import narwhals as nw
+from narwhals.typing import FrameT
+
+
+@nw.narwhalify
+def query(
+    customer_ds: FrameT,
+    nation_ds: FrameT,
+    lineitem_ds: FrameT,
+    orders_ds: FrameT,
+) -> FrameT:
+    var1 = datetime(1993, 10, 1)
+    var2 = datetime(1994, 1, 1)
+
+    result = (
+        customer_ds.join(orders_ds, left_on="c_custkey", right_on="o_custkey")
+        .join(lineitem_ds, left_on="o_orderkey", right_on="l_orderkey")
+        .join(nation_ds, left_on="c_nationkey", right_on="n_nationkey")
+        .filter(nw.col("o_orderdate").is_between(var1, var2, closed="left"))
+        .filter(nw.col("l_returnflag") == "R")
+        .with_columns(
+            (nw.col("l_extendedprice") * (1 - nw.col("l_discount"))).alias("revenue")
+        )
+        .group_by(
+            "c_custkey",
+            "c_name",
+            "c_acctbal",
+            "c_phone",
+            "n_name",
+            "c_address",
+            "c_comment",
+        )
+        .agg(nw.sum("revenue"))
+        .select(
+            "c_custkey",
+            "c_name",
+            "revenue",
+            "c_acctbal",
+            "n_name",
+            "c_address",
+            "c_phone",
+            "c_comment",
+        )
+        .sort(by="revenue", descending=True)
+        .head(20)
+    )
+
+    return nw.to_native(result)
diff --git a/tpch/queries/q2.py b/tpch/queries/q2.py
new file mode 100644
index 00000000..d2f189cd
--- /dev/null
+++ b/tpch/queries/q2.py
@@ -0,0 +1,55 @@
+from typing import Any
+
+import narwhals as nw
+
+
+@nw.narwhalify
+def query(
+    region_ds: Any,
+    nation_ds: Any,
+    supplier_ds: Any,
+    part_ds: Any,
+    part_supp_ds: Any,
+) -> Any:
+    var_1 = 15
+    var_2 = "BRASS"
+    var_3 = "EUROPE"
+
+    result_q2 = (
+        part_ds.join(part_supp_ds, left_on="p_partkey", right_on="ps_partkey")
+        .join(supplier_ds, left_on="ps_suppkey", right_on="s_suppkey")
+        .join(nation_ds, left_on="s_nationkey", right_on="n_nationkey")
+        .join(region_ds, left_on="n_regionkey", right_on="r_regionkey")
+        .filter(
+            nw.col("p_size") == var_1,
+            nw.col("p_type").str.ends_with(var_2),
+            nw.col("r_name") == var_3,
+        )
+    )
+
+    final_cols = [
+        "s_acctbal",
+        "s_name",
+        "n_name",
+        "p_partkey",
+        "p_mfgr",
+        "s_address",
+        "s_phone",
+        "s_comment",
+    ]
+
+    return (
+        result_q2.group_by("p_partkey")
+        .agg(nw.col("ps_supplycost").min().alias("ps_supplycost"))
+        .join(
+            result_q2,
+            left_on=["p_partkey", "ps_supplycost"],
+            right_on=["p_partkey", "ps_supplycost"],
+        )
+        .select(final_cols)
+        .sort(
+            ["s_acctbal", "n_name", "s_name", "p_partkey"],
+            descending=[True, False, False, False],
+        )
+        .head(100)
+    )
diff --git a/utils/generate_backend_completeness.py b/utils/generate_backend_completeness.py
index 53770187..b2cb9df2 100644
--- a/utils/generate_backend_completeness.py
+++ b/utils/generate_backend_completeness.py
@@ -36,7 +36,7 @@ BACKENDS = [
     Backend(name="dask", module="_dask", type_=BackendType.LAZY),
 ]
 
-EXCLUDE_CLASSES = {"BaseFrame"}
+EXCLUDE_CLASSES = {"BaseFrame", "Then", "When"}
 
 
 def get_class_methods(kls: type[Any]) -> list[str]:
@@ -113,6 +113,7 @@ def get_backend_completeness_table() -> None:
             tbl_hide_column_data_types=True,
             tbl_hide_dataframe_shape=True,
             set_tbl_rows=results.shape[0],
+            set_tbl_width_chars=1_000,
         ):
             table = str(results)
 


Test patch:
diff --git a/tests/expr_and_series/is_duplicated_test.py b/tests/expr_and_series/is_duplicated_test.py
index 5fa06031..71d16574 100644
--- a/tests/expr_and_series/is_duplicated_test.py
+++ b/tests/expr_and_series/is_duplicated_test.py
@@ -3,19 +3,13 @@ from typing import Any
 import narwhals.stable.v1 as nw
 from tests.utils import compare_dicts
 
-data = {
-    "a": [1, 1, 2],
-    "b": [1, 2, 3],
-}
+data = {"a": [1, 1, 2], "b": [1, 2, 3], "index": [0, 1, 2]}
 
 
 def test_is_duplicated_expr(constructor: Any) -> None:
     df = nw.from_native(constructor(data))
-    result = df.select(nw.all().is_duplicated())
-    expected = {
-        "a": [True, True, False],
-        "b": [False, False, False],
-    }
+    result = df.select(nw.col("a", "b").is_duplicated(), "index").sort("index")
+    expected = {"a": [True, True, False], "b": [False, False, False], "index": [0, 1, 2]}
     compare_dicts(result, expected)
 
 
diff --git a/tests/expr_and_series/is_unique_test.py b/tests/expr_and_series/is_unique_test.py
index 8bddbb64..d203c163 100644
--- a/tests/expr_and_series/is_unique_test.py
+++ b/tests/expr_and_series/is_unique_test.py
@@ -6,15 +6,17 @@ from tests.utils import compare_dicts
 data = {
     "a": [1, 1, 2],
     "b": [1, 2, 3],
+    "index": [0, 1, 2],
 }
 
 
 def test_is_unique_expr(constructor: Any) -> None:
     df = nw.from_native(constructor(data))
-    result = df.select(nw.all().is_unique())
+    result = df.select(nw.col("a", "b").is_unique(), "index").sort("index")
     expected = {
         "a": [False, False, True],
         "b": [True, True, True],
+        "index": [0, 1, 2],
     }
     compare_dicts(result, expected)
 
diff --git a/tests/frame/join_test.py b/tests/frame/join_test.py
index d5c88ee4..e6dfad63 100644
--- a/tests/frame/join_test.py
+++ b/tests/frame/join_test.py
@@ -12,30 +12,35 @@ from tests.utils import compare_dicts
 
 
 def test_inner_join_two_keys(constructor: Any) -> None:
-    data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9]}
+    data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9], "index": [0, 1, 2]}
     df = nw.from_native(constructor(data))
     df_right = df
     result = df.join(df_right, left_on=["a", "b"], right_on=["a", "b"], how="inner")  # type: ignore[arg-type]
+    result = result.sort("index")
+    result = result.drop("index_right")
     expected = {
         "a": [1, 3, 2],
         "b": [4, 4, 6],
         "z": [7.0, 8, 9],
         "z_right": [7.0, 8, 9],
+        "index": [0, 1, 2],
     }
     compare_dicts(result, expected)
 
 
 def test_inner_join_single_key(constructor: Any) -> None:
-    data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9]}
+    data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9], "index": [0, 1, 2]}
     df = nw.from_native(constructor(data))
     df_right = df
-    result = df.join(df_right, left_on="a", right_on="a", how="inner")  # type: ignore[arg-type]
+    result = df.join(df_right, left_on="a", right_on="a", how="inner").sort("index")  # type: ignore[arg-type]
+    result = result.drop("index_right")
     expected = {
         "a": [1, 3, 2],
         "b": [4, 4, 6],
         "b_right": [4, 4, 6],
         "z": [7.0, 8, 9],
         "z_right": [7.0, 8, 9],
+        "index": [0, 1, 2],
     }
     compare_dicts(result, expected)
 
@@ -105,7 +110,7 @@ def test_semi_join(
     data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9]}
     df = nw.from_native(constructor(data))
     other = df.filter(filter_expr)
-    result = df.join(other, how="semi", left_on=join_key, right_on=join_key)  # type: ignore[arg-type]
+    result = df.join(other, how="semi", left_on=join_key, right_on=join_key).sort("a")  # type: ignore[arg-type]
     compare_dicts(result, expected)
 
 
@@ -117,7 +122,7 @@ def test_join_not_implemented(constructor: Any, how: str) -> None:
     with pytest.raises(
         NotImplementedError,
         match=re.escape(
-            f"Only the following join stragies are supported: ('inner', 'left', 'cross', 'anti', 'semi'); found '{how}'."
+            f"Only the following join strategies are supported: ('inner', 'left', 'cross', 'anti', 'semi'); found '{how}'."
         ),
     ):
         df.join(df, left_on="a", right_on="a", how=how)  # type: ignore[arg-type]
@@ -125,51 +130,75 @@ def test_join_not_implemented(constructor: Any, how: str) -> None:
 
 @pytest.mark.filterwarnings("ignore:the default coalesce behavior")
 def test_left_join(constructor: Any) -> None:
-    data_left = {"a": [1.0, 2, 3], "b": [4.0, 5, 6]}
-    data_right = {"a": [1.0, 2, 3], "c": [4.0, 5, 7]}
+    data_left = {"a": [1.0, 2, 3], "b": [4.0, 5, 6], "index": [0.0, 1.0, 2.0]}
+    data_right = {"a": [1.0, 2, 3], "c": [4.0, 5, 7], "index": [0.0, 1.0, 2.0]}
     df_left = nw.from_native(constructor(data_left))
     df_right = nw.from_native(constructor(data_right))
     result = df_left.join(df_right, left_on="b", right_on="c", how="left").select(  # type: ignore[arg-type]
         nw.all().fill_null(float("nan"))
     )
-    expected = {"a": [1, 2, 3], "b": [4, 5, 6], "a_right": [1, 2, float("nan")]}
+    result = result.sort("index")
+    result = result.drop("index_right")
+    expected = {
+        "a": [1, 2, 3],
+        "b": [4, 5, 6],
+        "a_right": [1, 2, float("nan")],
+        "index": [0, 1, 2],
+    }
     compare_dicts(result, expected)
 
 
 @pytest.mark.filterwarnings("ignore: the default coalesce behavior")
 def test_left_join_multiple_column(constructor: Any) -> None:
-    data_left = {"a": [1, 2, 3], "b": [4, 5, 6]}
-    data_right = {"a": [1, 2, 3], "c": [4, 5, 6]}
+    data_left = {"a": [1, 2, 3], "b": [4, 5, 6], "index": [0, 1, 2]}
+    data_right = {"a": [1, 2, 3], "c": [4, 5, 6], "index": [0, 1, 2]}
     df_left = nw.from_native(constructor(data_left))
     df_right = nw.from_native(constructor(data_right))
     result = df_left.join(df_right, left_on=["a", "b"], right_on=["a", "c"], how="left")  # type: ignore[arg-type]
-    expected = {"a": [1, 2, 3], "b": [4, 5, 6]}
+    result = result.sort("index")
+    result = result.drop("index_right")
+    expected = {"a": [1, 2, 3], "b": [4, 5, 6], "index": [0, 1, 2]}
     compare_dicts(result, expected)
 
 
 @pytest.mark.filterwarnings("ignore: the default coalesce behavior")
 def test_left_join_overlapping_column(constructor: Any) -> None:
-    data_left = {"a": [1.0, 2, 3], "b": [4.0, 5, 6], "d": [1.0, 4, 2]}
-    data_right = {"a": [1.0, 2, 3], "c": [4.0, 5, 6], "d": [1.0, 4, 2]}
+    data_left = {
+        "a": [1.0, 2, 3],
+        "b": [4.0, 5, 6],
+        "d": [1.0, 4, 2],
+        "index": [0.0, 1.0, 2.0],
+    }
+    data_right = {
+        "a": [1.0, 2, 3],
+        "c": [4.0, 5, 6],
+        "d": [1.0, 4, 2],
+        "index": [0.0, 1.0, 2.0],
+    }
     df_left = nw.from_native(constructor(data_left))
     df_right = nw.from_native(constructor(data_right))
-    result = df_left.join(df_right, left_on="b", right_on="c", how="left")  # type: ignore[arg-type]
+    result = df_left.join(df_right, left_on="b", right_on="c", how="left").sort("index")  # type: ignore[arg-type]
+    result = result.drop("index_right")
     expected: dict[str, list[Any]] = {
         "a": [1, 2, 3],
         "b": [4, 5, 6],
         "d": [1, 4, 2],
         "a_right": [1, 2, 3],
         "d_right": [1, 4, 2],
+        "index": [0, 1, 2],
     }
     compare_dicts(result, expected)
     result = df_left.join(df_right, left_on="a", right_on="d", how="left").select(  # type: ignore[arg-type]
         nw.all().fill_null(float("nan"))
     )
+    result = result.sort("index")
+    result = result.drop("index_right")
     expected = {
         "a": [1, 2, 3],
         "b": [4, 5, 6],
         "d": [1, 4, 2],
         "a_right": [1.0, 3.0, float("nan")],
         "c": [4.0, 6.0, float("nan")],
+        "index": [0, 1, 2],
     }
     compare_dicts(result, expected)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 68dc90ed..f51c28ea 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -15,15 +15,15 @@ def test_maybe_align_index_pandas() -> None:
     result = nw.maybe_align_index(df, s)
     expected = pd.DataFrame({"a": [2, 1, 3]}, index=[2, 1, 0])
     assert_frame_equal(nw.to_native(result), expected)
-    result = nw.maybe_align_index(s, df)
-    expected = pd.Series([2, 1, 3], index=[1, 2, 0])
-    assert_series_equal(nw.to_native(result), expected)
-    result = nw.maybe_align_index(s, s.sort(descending=True))
-    expected = pd.Series([3, 2, 1], index=[0, 1, 2])
-    assert_series_equal(nw.to_native(result), expected)
     result = nw.maybe_align_index(df, df.sort("a", descending=True))
     expected = pd.DataFrame({"a": [3, 2, 1]}, index=[0, 2, 1])
     assert_frame_equal(nw.to_native(result), expected)
+    result_s = nw.maybe_align_index(s, df)
+    expected_s = pd.Series([2, 1, 3], index=[1, 2, 0])
+    assert_series_equal(nw.to_native(result_s), expected_s)
+    result_s = nw.maybe_align_index(s, s.sort(descending=True))
+    expected_s = pd.Series([3, 2, 1], index=[0, 1, 2])
+    assert_series_equal(nw.to_native(result_s), expected_s)
 
 
 def test_with_columns_sort() -> None: