GitHub user alexeyegorov added a comment to the discussion: Support GEOMETRY in 
Spark SQL table creation DDL

> Thank you for checking. You are right, the below code works fine for me as 
> well (I think regardless of Sedona version):
> 
> df =spark.sql("SELECT ST_Point(1, 1) AS geometry") display(df) 
> df.write.saveAsTable("geospatial.default.mygeom")
> 
> But with CTAS like below, it will throw an error with sedona 1.7.1 but works 
> fine with sedona 1.7.0:
> 
> %sql CREATE TABLE geospatial.some_schema_other_than_default.mygeom ( id int, 
> geometry geometry )
> 

I think what is happening here is:
* in the first example spark/sedona decides itself to save it as binary
* in the second example you tell it to be geometry and since 1.7.1 it is not 
working unfortunately
However, what worked for me was e.g.

```
CREATE OR REPLACE TABLE catalog.schema.table AS 
SELECT id, timestamp, ST_GEOMFROMEWKB(geometry) AS geometry FROM <some raw data 
with geometry as wkb or wkt>
```

In our usecase, this is how we basically ingest spatial data into DBT pipeline 
on databricks.


GitHub link: 
https://github.com/apache/sedona/discussions/1934#discussioncomment-14766620

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to