[FLINK-39224] Support JSON, JSONB types for PostgreSQL#189
Conversation
RocMarshal
left a comment
There was a problem hiding this comment.
Thanks @och5351 for the PR.
LGTM on the whole just left a few of comments.
| String.format("'%s'", jsonNode.toString())); | ||
| } | ||
|
|
||
| public static TestTable getJsonbTable() throws JsonProcessingException { |
There was a problem hiding this comment.
| public static TestTable getJsonbTable() throws JsonProcessingException { | |
| static TestTable getJsonbTable() throws JsonProcessingException { |
| return json.replaceAll(":", ": ").replaceAll(",", ", "); | ||
| } | ||
|
|
||
| public static TestTable getJsonTable() throws JsonProcessingException { |
There was a problem hiding this comment.
| public static TestTable getJsonTable() throws JsonProcessingException { | |
| static TestTable getJsonTable() throws JsonProcessingException { |
| "1, NULL"); | ||
| } | ||
|
|
||
| public static String transformPGJsonb(String json) { |
There was a problem hiding this comment.
| public static String transformPGJsonb(String json) { | |
| static String transformPGJsonb(String json) { |
Could the method be removed into PostgresCatalogITCase?
Because it's used by PostgresCatalogITCase only.
bd010f0 to
88de511
Compare
Hi, @RocMarshal ! I agree :) PTAL !! |
Thank you @eskabetxe ! Could you please run CI again?
|
RocMarshal
left a comment
There was a problem hiding this comment.
Thanks @och5351 .
LGTM +1.

Motivation
Currently, the Flink JDBC Connector for PostgreSQL does not support the
json/jsonbdata types. When users attempt to read a table containingjson/jsonbcolumns through thePostgresCatalog, it fails with anUnsupportedOperationException: Doesn't support Postgres type 'jsonb' yet.The
json/jsonbtypes are widely used native data types in PostgreSQL for storing JSON documents.Changes
This PR adds support for PostgreSQL
json/jsonbtypes by mapping them to Flink'sDataTypes.STRING().Since PostgreSQL's JDBC driver returns
json/jsonbvalues as JavaString, users can leverage Flink's JSON functions (e.g.,JSON_QUERY,JSON_VALUE) to process these columns.Test Cases
jsontype inPostgresDynamicTableSourceITCase.getTestData()json/jsonbtype mapping in the PostgreSQL catalog