From cc5ad0099d2cb9197a590886b0344c92f7821bc4 Mon Sep 17 00:00:00 2001 From: Colin Ho Date: Tue, 17 Dec 2024 17:39:05 -0800 Subject: [PATCH] chore: Fix ordering in sql tests (#3596) Co-authored-by: Colin Ho --- tests/dataframe/test_intersect.py | 2 +- tests/integration/sql/docker-compose/docker-compose.yml | 7 +++---- tests/sql/test_sql.py | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/dataframe/test_intersect.py b/tests/dataframe/test_intersect.py index 4061fe7f71..59e9d9a79e 100644 --- a/tests/dataframe/test_intersect.py +++ b/tests/dataframe/test_intersect.py @@ -7,7 +7,7 @@ def test_simple_intersect(make_df): df1 = make_df({"foo": [1, 2, 3]}) df2 = make_df({"bar": [2, 3, 4]}) - result = df1.intersect(df2) + result = df1.intersect(df2).sort(by="foo") assert result.to_pydict() == {"foo": [2, 3]} diff --git a/tests/integration/sql/docker-compose/docker-compose.yml b/tests/integration/sql/docker-compose/docker-compose.yml index b8eb8c3eba..3748cb1da4 100644 --- a/tests/integration/sql/docker-compose/docker-compose.yml +++ b/tests/integration/sql/docker-compose/docker-compose.yml @@ -1,13 +1,12 @@ -version: '3.7' services: trino: - image: trinodb/trino + image: trinodb/trino:467 container_name: trino ports: - 8080:8080 postgres: - image: postgres:latest + image: postgres:17.2 container_name: postgres environment: POSTGRES_DB: postgres @@ -19,7 +18,7 @@ services: - postgres_data:/var/lib/postgresql/data mysql: - image: mysql:latest + image: mysql:9.1 container_name: mysql environment: MYSQL_DATABASE: mysql diff --git a/tests/sql/test_sql.py b/tests/sql/test_sql.py index f06c4f64f7..caa5d2a8a9 100644 --- a/tests/sql/test_sql.py +++ b/tests/sql/test_sql.py @@ -211,9 +211,8 @@ def test_sql_tbl_alias(): def test_sql_distinct(): df = daft.from_pydict({"n": [1, 1, 2, 2]}) - actual = daft.sql("SELECT DISTINCT n FROM df").collect().to_pydict() - expected = df.distinct().collect().to_pydict() - assert actual == expected + df = daft.sql("SELECT DISTINCT n FROM df").collect().to_pydict() + assert set(df["n"]) == {1, 2} @pytest.mark.parametrize(