From a119133ea10bd478a868e92ac6a91dd8fa9e9efb Mon Sep 17 00:00:00 2001 From: ncclementi Date: Thu, 15 Feb 2024 18:04:49 -0500 Subject: [PATCH] chore: add env for arm64 and xfail geospatial tests Add environment-arm64.yml to build dev env on mac m1 and m2. While doing this, a shapely/geos bug fix was exposed (see shapely issue 1992). Including the corresponding fixes, when shapely is upgraded, the xfails should start xpass. --- environment-arm64.yml | 101 ++++++++++++++++++ .../shp8-0_0_1_1_2_2/out.sql | 2 +- ibis/backends/duckdb/tests/test_geospatial.py | 9 +- .../multipoint-geography/out.sql | 4 +- .../multipoint-geometry/out.sql | 4 +- .../multipoint-none/out.sql | 4 +- .../multipoint-srid/out.sql | 4 +- .../shp8/out.sql | 4 +- .../postgres/tests/test_geospatial.py | 21 +++- 9 files changed, 137 insertions(+), 16 deletions(-) create mode 100644 environment-arm64.yml diff --git a/environment-arm64.yml b/environment-arm64.yml new file mode 100644 index 0000000000000..8ffc7ecf5a776 --- /dev/null +++ b/environment-arm64.yml @@ -0,0 +1,101 @@ +name: ibis-dev +channels: + - conda-forge +dependencies: + # runtime dependencies + - python =3.10 + - atpublic >=2.3 + - bidict >=0.22.1 + - clickhouse-connect >=0.5.23 + - dask >=2022.9.1 + - datafusion >=0.6 + - db-dtypes >=0.3.0,<2 + - deltalake + - duckdb-engine <1,>=0.1.8 + - filelock >=3.7.0,<4 + - fsspec >=2022.1.0 + - gcsfs + - geoalchemy2 >=0.6.3 + - geopandas >=0.6 + - google-cloud-bigquery >=3,<4 + - google-cloud-bigquery-storage >=2,<3 + - impyla >=0.17 + - multipledispatch >=0.6,<2 + - numpy >=1.15,<2 + - oracledb >=1.3.1 + - packaging >=21.3 + - pandas >=1.2.5 + - parsy >=2 + - pins >=0.8.2 + - poetry-core >=1.0.0 + - poetry-dynamic-versioning >=0.18.0 + - polars >=0.19 + - psycopg2 >=2.8.4 + - pyarrow >=2 + - pyarrow-hotfix >=0.4 + - pydata-google-auth + - pydruid >=0.6.5 + - pymssql >=2.2.5 + - pymysql >=1 + - pyspark >=3 + - python-dateutil >=2.8.2 + - python-duckdb >=0.8.1 + - python-graphviz >=0.16 + - pytz >=2022.7 + - regex >=2021.7.6 + - requests >=2 + - rich >=12.4.4 + - snowflake-connector-python >=3.0.2 + - snowflake-sqlalchemy >=1.4.1 + - sqlalchemy <3,>=1.4 + - sqlalchemy-risingwave >=1.0.0 + - sqlalchemy-views <1,>=0.3.1 + - sqlalchemy_exasol >=4.6.0 + - sqlglot >=18.7.0,<=20.11 + - toolz >=0.11 + - trino-python-client >=0.321 + # geospatial + - leafmap >=0.29.6 + # streaming + - kafka-python + # test dependencies + - filelock >=3.7.0,<4 + - hypothesis >=6.58.0,<7 + - pytest >=7.0.0,<9 + - pytest-benchmark >=3.4.1,<5 + - pytest-clarity >=1.0.1,<2 + - pytest-cov >=3.0.0,<5 + - pytest-httpserver >=1.0.5,<2 + - pytest-mock >=3.6.1,<4 + - pytest-randomly >=3.10.1,<4 + - pytest-repeat >=0.9.1,<0.10 + - pytest-snapshot >=0.9.0,<1 + - pytest-xdist >=2.3.0,<4 + - requests >=2,<3 + # docs + - altair >=5.0.1 + - distributed >=2022.9.1 + - ipykernel >=6.25.1 + - itables >=1.6.3 + - nbclient >=0.8.0 + - plotly >=5.16.1 + - plotnine >=0.12.2 + - py-cpuinfo >=9 + - quartodoc >=0.6.1 + - seaborn + # dev utilities + - codespell >=2.2.6 + - ipython + - poetry-plugin-export + - pre-commit + - prettier + - pydeps >=1.12.7 + - pyinstrument + - ruff >=0.1.8 + - taplo + - tqdm >=4.66.1 + - just + - pip + - pip: + - shapely>=2,<3 + - apache-flink>=1.18.1 diff --git a/ibis/backends/duckdb/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8-0_0_1_1_2_2/out.sql b/ibis/backends/duckdb/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8-0_0_1_1_2_2/out.sql index c242993f867c5..01fdfc1efadbd 100644 --- a/ibis/backends/duckdb/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8-0_0_1_1_2_2/out.sql +++ b/ibis/backends/duckdb/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8-0_0_1_1_2_2/out.sql @@ -2,5 +2,5 @@ SELECT ST_ASWKB("result") AS result FROM ( SELECT - ST_GEOMFROMTEXT('MULTIPOINT (0 0, 1 1, 2 2)') AS "result" + ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 1), (2 2))') AS "result" ) \ No newline at end of file diff --git a/ibis/backends/duckdb/tests/test_geospatial.py b/ibis/backends/duckdb/tests/test_geospatial.py index 0a791639f3512..473c705774e64 100644 --- a/ibis/backends/duckdb/tests/test_geospatial.py +++ b/ibis/backends/duckdb/tests/test_geospatial.py @@ -281,7 +281,14 @@ def test_literal_geospatial_explicit(con, expr, snapshot): (shp_polygon_0, "((0 0, 1 1, 2 2, 0 0))"), (shp_multipolygon_0, "(((0 0, 1 1, 2 2, 0 0)))"), (shp_multilinestring_0, "((0 0, 1 1, 2 2), (2 2, 1 1, 0 0))"), - (shp_multipoint_0, "(0 0, 1 1, 2 2)"), + param( + shp_multipoint_0, + "((0 0), (1 1), (2 2))", + marks=pytest.mark.xfail( + raises=AssertionError, + reason="Bug-fix change in GEOS 3.12 see shapely issue #1992", + ), + ), ], ) def test_literal_geospatial_inferred(con, shp, expected, snapshot): diff --git a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geography/out.sql b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geography/out.sql index 0acd04127b7e1..f9ceba9f0370e 100644 --- a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geography/out.sql +++ b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geography/out.sql @@ -1,6 +1,6 @@ SELECT - ST_ASEWKB("t0"."") AS "" + ST_ASEWKB("t0"."") AS "" FROM ( SELECT - ST_GEOMFROMTEXT('MULTIPOINT (10 40, 40 30, 20 20, 30 10)', 4326) AS "" + ST_GEOMFROMTEXT('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))', 4326) AS "" ) AS "t0" \ No newline at end of file diff --git a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geometry/out.sql b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geometry/out.sql index 0acd04127b7e1..f9ceba9f0370e 100644 --- a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geometry/out.sql +++ b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-geometry/out.sql @@ -1,6 +1,6 @@ SELECT - ST_ASEWKB("t0"."") AS "" + ST_ASEWKB("t0"."") AS "" FROM ( SELECT - ST_GEOMFROMTEXT('MULTIPOINT (10 40, 40 30, 20 20, 30 10)', 4326) AS "" + ST_GEOMFROMTEXT('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))', 4326) AS "" ) AS "t0" \ No newline at end of file diff --git a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-none/out.sql b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-none/out.sql index 12a5a5bf5a4e7..d02b5305e3c16 100644 --- a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-none/out.sql +++ b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-none/out.sql @@ -1,6 +1,6 @@ SELECT - ST_ASEWKB("t0"."") AS "" + ST_ASEWKB("t0"."") AS "" FROM ( SELECT - ST_GEOMFROMTEXT('MULTIPOINT (10 40, 40 30, 20 20, 30 10)') AS "" + ST_GEOMFROMTEXT('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))') AS "" ) AS "t0" \ No newline at end of file diff --git a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-srid/out.sql b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-srid/out.sql index 0acd04127b7e1..f9ceba9f0370e 100644 --- a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-srid/out.sql +++ b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_geo_literals_smoke/multipoint-srid/out.sql @@ -1,6 +1,6 @@ SELECT - ST_ASEWKB("t0"."") AS "" + ST_ASEWKB("t0"."") AS "" FROM ( SELECT - ST_GEOMFROMTEXT('MULTIPOINT (10 40, 40 30, 20 20, 30 10)', 4326) AS "" + ST_GEOMFROMTEXT('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))', 4326) AS "" ) AS "t0" \ No newline at end of file diff --git a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8/out.sql b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8/out.sql index f481c00ddfe99..e0de4a016125b 100644 --- a/ibis/backends/postgres/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8/out.sql +++ b/ibis/backends/postgres/tests/snapshots/test_geospatial/test_literal_geospatial_inferred/shp8/out.sql @@ -1,6 +1,6 @@ SELECT - ST_ASEWKB("t0"."") AS "" + ST_ASEWKB("t0"."") AS "" FROM ( SELECT - ST_GEOMFROMTEXT('MULTIPOINT (0 0, 1 1, 2 2)') AS "" + ST_GEOMFROMTEXT('MULTIPOINT ((0 0), (1 1), (2 2))') AS "" ) AS "t0" \ No newline at end of file diff --git a/ibis/backends/postgres/tests/test_geospatial.py b/ibis/backends/postgres/tests/test_geospatial.py index f6fc3fd36232b..d216bd551ce7c 100644 --- a/ibis/backends/postgres/tests/test_geospatial.py +++ b/ibis/backends/postgres/tests/test_geospatial.py @@ -81,7 +81,13 @@ def test_literal_geospatial_explicit(con, expr, snapshot): shp_polygon_0, shp_multipolygon_0, shp_multilinestring_0, - shp_multipoint_0, + param( + shp_multipoint_0, + marks=pytest.mark.xfail( + raises=AssertionError, + reason="Bug-fix change in GEOS 3.12 see shapely issue #1992", + ), + ), ], ) def test_literal_geospatial_inferred(con, shp, snapshot): @@ -370,7 +376,7 @@ def test_geo_dataframe(geotable): @pytest.mark.parametrize( ("shape", "value"), [ - # Geometry primitives (2D) + # # Geometry primitives (2D) param("point", (30, 10), id="point"), param("linestring", ((30, 10), (10, 30), (40, 40)), id="linestring"), param( @@ -387,7 +393,15 @@ def test_geo_dataframe(geotable): id="polygon_single", ), # Multipart geometries (2D) - param("multipoint", ((10, 40), (40, 30), (20, 20), (30, 10)), id="multipoint"), + param( + "multipoint", + ((10, 40), (40, 30), (20, 20), (30, 10)), + id="multipoint", + marks=pytest.mark.xfail( + raises=AssertionError, + reason="Bug-fix change in GEOS 3.12 see shapely issue #1992", + ), + ), param( "multilinestring", (((10, 10), (20, 20), (10, 40)), ((40, 40), (30, 30), (40, 20), (30, 10))), @@ -409,7 +423,6 @@ def test_geo_dataframe(geotable): def test_geo_literals_smoke(con, shape, value, modifier, snapshot): """Smoke tests for geo spatial literals.""" expr = ibis.literal(value, type=getattr(dt, shape).copy(**modifier)) - snapshot.assert_match(con.compile(expr), "out.sql")