Skip to content
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

[Feature][PostgreSQL-jdbc] Supports GEOMETRY data type for PostgreSQL #4652

Closed
2 of 3 tasks
ic4y opened this issue Apr 23, 2023 · 5 comments
Closed
2 of 3 tasks

[Feature][PostgreSQL-jdbc] Supports GEOMETRY data type for PostgreSQL #4652

ic4y opened this issue Apr 23, 2023 · 5 comments
Assignees

Comments

@ic4y
Copy link
Contributor

ic4y commented Apr 23, 2023

Search before asking

  • I had searched in the feature and found no similar feature requirement.

Description

Currently, the Pg source connector does not support the GEOMETRY data type. We can convert the GEOMETRY data type to the String data type in Zeta to support the reading of GEOMETRY data types, like pg(GEOMETRY) -> zeta(String).

You may need to modify the following files in the JDBC connector:
src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresTypeMapper.java
src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresJdbcRowConverter.java

When testing, note that Pg needs to install the PostGIS plugin:

apt-get install postgis postgresql-12-postgis-3
CREATE EXTENSION IF NOT EXISTS postgis;

Create a table and insert data:

CREATE TABLE spatial_data (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255),
    geometry_data GEOMETRY
);

-- Insert a point
INSERT INTO spatial_data (name, geometry_data)
VALUES ('Test Point', ST_GeomFromText('POINT(30 10)'));

-- Insert a linestring
INSERT INTO spatial_data (name, geometry_data)
VALUES ('Test LineString', ST_GeomFromText('LINESTRING(30 10, 40 40, 50 50, 60 60)'));

Add the GEOMETRY data type in the e2e test and check the synchronized results.

Usage Scenario

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@zhilinli123
Copy link
Contributor

I'd like to finish it thanks

@ic4y
Copy link
Contributor Author

ic4y commented Apr 25, 2023

I'd like to finish it thanks
Great, looking forward to submitting a pull request.

@zhilinli123
Copy link
Contributor

I understand it's just converted to String on the Source side because we don't know what type is downstream, right
@ic4y @EricJoy2048

@ic4y
Copy link
Contributor Author

ic4y commented Apr 26, 2023

I understand it's just converted to String on the Source side because we don't know what type is downstream, right
@ic4y @EricJoy2048
You're right

zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue Apr 29, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 4, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 4, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 5, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 5, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 5, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 5, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 5, 2023
zhilinli123 pushed a commit to zhilinli123/incubator-seatunnel that referenced this issue May 5, 2023
@zhilinli123
Copy link
Contributor

Closing issues
feature pr:#4673

@ic4y ic4y closed this as completed May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants