Skip to content

bug: Unable to cache table after creating geometry column #10324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
jstammers opened this issue Oct 16, 2024 · 2 comments · Fixed by #10333
Closed
1 task done

bug: Unable to cache table after creating geometry column #10324

jstammers opened this issue Oct 16, 2024 · 2 comments · Fixed by #10333
Assignees
Labels
bug Incorrect behavior inside of ibis geospatial Geospatial related functionality
Milestone

Comments

@jstammers
Copy link
Contributor

jstammers commented Oct 16, 2024

What happened?

I'm trying to create a table with a geometry column using given lat/long coodinates.

I can successfully create this column, but when calling .cache(), I get a ParserError.

Here's an example that replicates it

 from ibis.interactive import *
 t = ibis.examples.zones.fetch()
 t = t.mutate(geom=_.x_cent.point(_.y_cent)).cache()

I don't see this behaviour when I do the following

 t = ibis.examples.zones.fetch()
 t = t.cache() #geom already exists in the zones table

The only material difference in the SQL in each case is the use of ST_POINT when creating the geometry

SELECT
  *
  REPLACE (ST_ASWKB("geom") AS "geom")
FROM (
  SELECT
    "t0"."OBJECTID",
    "t0"."Shape_Leng",
    "t0"."Shape_Area",
    "t0"."zone",
    "t0"."LocationID",
    "t0"."borough",
    "t0"."x_cent",
    "t0"."y_cent",
    ST_POINT("t0"."x_cent", "t0"."y_cent") AS "geom"
  FROM "ibis_read_geo_xqclf77uwbhqzmcrvtctt27c34" AS "t0"
)
SELECT
  *
  REPLACE (ST_ASWKB("geom") AS "geom")
FROM (
  SELECT
    *
  FROM "ibis_read_geo_qwgreoxngfbmjdveyqna5ldkfy"
)

What version of ibis are you using?

9.5.0

What backend(s) are you using, if any?

DuckDB

Relevant log output

ParserException: Parser Error: Expected a constant as type modifier
File <command-2809322511957941>, line 2
      1 t = ibis.examples.zones.fetch()
----> 2 t = t.mutate(geom=_.x_cent.point(_.y_cent)).cache()

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jstammers jstammers added the bug Incorrect behavior inside of ibis label Oct 16, 2024
@gforsyth
Copy link
Member

Thanks for reporting this, @jstammers !

It looks like we're generating incorrect SQL for the temporary table definition in the mutate case:

CREATE TEMPORARY TABLE "temp"."main"."ibis_cached_ibsdggv2efdinijummdputbqly" ("OBJECTID" INT, "Shape_Leng" DOUBLE, "Shape_Area" DOUBLE, "zone" TEXT, "LocationID" INT, "borough" TEXT, "x_cent" DOUBLE, "y_cent" DOUBLE, "geom" GEOMETRY(POINT))

That should just be "geom" GEOMETRY at the end, I think.

@gforsyth gforsyth added the geospatial Geospatial related functionality label Oct 16, 2024
@anjakefala
Copy link
Contributor

/take

anjakefala added a commit to anjakefala/ibis that referenced this issue Oct 18, 2024
…roject#10324)

Ensure compatibility with DuckDB's implementation of geospatial types.
Closes ibis-project#10324
anjakefala added a commit to anjakefala/ibis that referenced this issue Oct 22, 2024
…roject#10324)

Ensure compatibility with DuckDB's implementation of geospatial types.
Closes ibis-project#10324
cpcloud pushed a commit to anjakefala/ibis that referenced this issue Oct 23, 2024
…roject#10324)

Ensure compatibility with DuckDB's implementation of geospatial types.
Closes ibis-project#10324
@github-project-automation github-project-automation bot moved this from backlog to done in Ibis planning and roadmap Oct 24, 2024
@github-actions github-actions bot added this to the 10.0 milestone Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis geospatial Geospatial related functionality
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants