How to read UUID out of a JDBC table source

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to read UUID out of a JDBC table source

Bonino Dario

Dear list,

I need to use a Table Source to extract data from a PostgreSQL table that includes a column of type uuid. Data in the column is converted to java.util.UUID by the postgresql jdbc driver (I guess) however I was not able to find a way to define a Table schema for correctly reading that column (selecting RAW(TypeInformation.of(UUID.class)) does not work providing the following error:

org.apache.flink.table.api.ValidationException: Type RAW('java.util.UUID', ?) of table field 'datastream' does not match with the physical type LEGACY('RAW', 'ANY<java.util.UUID>') of the 'datastream' field of the TableSource return type.

Did someone encountered the same issue? Does someone have any suggestion on how to proceed?


Thank you very much

Dario


-- 
Ing. Dario Bonino, Ph.D

e-m@il: [hidden email] 
www: https://www.linkedin.com/in/dariobonino
<foaf:Person>
	<foaf:firstName>Dario</foaf:firstName>
	<foaf:surname>Bonino</foaf:surname>
	<foaf:msnChatID>[hidden email]</foaf:msnChatID>
</foaf:Person> 
<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Person", "name": "Dario Bonino", "jobTitle": "POst-doc Researcher", "affiliation": "PHPower s.r.l.", "additionalName": "Dario", "url": "https://www.linkedin.com/in/dariobonino", } </script>
Reply | Threaded
Open this post in threaded view
|

Re: How to read UUID out of a JDBC table source

Dawid Wysakowicz-2

Hi Dario,

What version of Flink are you using? Are you implementing your own TableSource or do you use the JdbcTableSource that comes with Flink? Which planner do you use blink or the old one?

Unfortunately the rework of Table API type system is not finished yet, therefore there are still rough edges, sorry about that. If you are implementing your own source make sure you return DataTypes.RAW(TypeInformation.of(UUID.class) in both the TableSchema and getProducedDataType.

Best,

Dawid

On 14/05/2020 18:42, Bonino Dario wrote:

Dear list,

I need to use a Table Source to extract data from a PostgreSQL table that includes a column of type uuid. Data in the column is converted to java.util.UUID by the postgresql jdbc driver (I guess) however I was not able to find a way to define a Table schema for correctly reading that column (selecting RAW(TypeInformation.of(UUID.class)) does not work providing the following error:

org.apache.flink.table.api.ValidationException: Type RAW('java.util.UUID', ?) of table field 'datastream' does not match with the physical type LEGACY('RAW', 'ANY<java.util.UUID>') of the 'datastream' field of the TableSource return type.

Did someone encountered the same issue? Does someone have any suggestion on how to proceed?


Thank you very much

Dario


-- 
Ing. Dario Bonino, Ph.D

e-m@il: [hidden email] 
www: https://www.linkedin.com/in/dariobonino
<foaf:Person>
	<foaf:firstName>Dario</foaf:firstName>
	<foaf:surname>Bonino</foaf:surname>
	<foaf:msnChatID>[hidden email]</foaf:msnChatID>
</foaf:Person> 
<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Person", "name": "Dario Bonino", "jobTitle": "POst-doc Researcher", "affiliation": "PHPower s.r.l.", "additionalName": "Dario", "url": "https://www.linkedin.com/in/dariobonino", } </script>

signature.asc (849 bytes) Download Attachment