http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/Registering-RawType-with-LegacyTypeInfo-via-Flink-CREATE-TABLE-DDL-tp40289p40327.html
Hi Timo,
Thanks for the explanation. Passing around a byte array is not possible since I need to know the concrete type later for serialization in my sink, so I need to keep the type.
What I'm trying to achieve is the following:
I have a scalar UDF function:
This function is later used in processing of a Flink table, by calling PARSE_JSON on the selected field.
Whoever uses these UDFs isn't aware of any Flink syntax for creating and registering tables, I generate the CREATE TABLE statement behind the scenes, dynamically.
for each table. In order for this to work, I need the UDF to output the correct type (in this example, io.circe.Json). Later, this JSON type (or any other type returned by the UDF for that matter) will get serialized in a custom sink and into a data warehouse (that's why I need to keep the concrete type, since serialization happens at the edges before writing it out).
The reason I'm converting between Table and DataStream is that this table will be further manipulated before being written to the custom DynamicTableSink by applying transformations on a DataStream[Row], and then converted back to a Table to be used in an additional CREATE TABLE and then INSERT INTO statement.
This is why I have these conversions back and forth, and why I somehow need a way to register the legacy types as a valid type of the table.
Hope that clarifies a bit, since the pipeline is rather complex I can't really share a MVCE of it.