sedona icon indicating copy to clipboard operation
sedona copied to clipboard

datatype geometry is not supported when 'create table xxx (geom geometry)'

Open freamdx opened this issue 1 year ago • 3 comments

Expected behavior

image

Actual behavior

image

Steps to reproduce the problem

  1. server: copy sedona-spark-shaded-3.x_2.12-1.5.x.jar to 'spark/jars'
  2. client: connect to spark-thrift-server, eg: beeline -u jdbc:hive2://<...>:<...>
  3. client: create table test (geom geometry);

Settings

Sedona version = 1.5

Apache Spark version = 3.x

Environment = spark-thrift-server

freamdx avatar May 16 '24 07:05 freamdx

one way (not best): image

freamdx avatar May 16 '24 07:05 freamdx

refer: https://github.com/freamdx/spark/commit/cf2b0fe18c938744f2cfb111f6878eec8ad220cf

freamdx avatar May 16 '24 07:05 freamdx

@freamdx Thanks. This is on our radar. This can be done via adding a custom Sedona SQL parser on top of Spark, without forking Spark code. We will add the support in 1.6.1 release.

jiayuasu avatar May 17 '24 16:05 jiayuasu

@freamdx The issue is currently being worked on. Before the fix, I think you can use the following workaround to create the Hive table.

CREATE OR REPLACE TEMP VIEW EMPTY_VIEW AS
SELECT ST_GEOMFROMTEXT(CAST(NULL AS STRING)) AS GEOM
WHERE 1 = 0;

CREATE TABLE T_TEST AS (SELECT * FROM EMPTY_VIEW);

zhangfengcdt avatar Jul 29 '24 23:07 zhangfengcdt