I am providing a Flink SQL interface to users, so I can't really use the Table or Java/Scala interface. Everything needs to be specified in SQL. I can parse comments in the SQL files though, and add specified ad hoc lower level API instructions.
How can one user could convert, say:
SELECT b, AVG(a) "average" FROM source_data GROUP BY b
name: average_source_data_retracting
b STRING
average NUMERIC
-which is retracting values- to a form that would append them. This appending form could have the following schema:
name: average_source_data_appending
flag BOOLEAN <-- indicating an accumulate or retract message
b STRING
average NUMERIC
Aka sort of having the RetractStreamTableSink equivalent to the AppendStreamTableSink, but without it being a sink.
All this to enable the use of average_source_data_appending to create a Temporal table (filtering retract messages), but this kind of table only accepts append-only source tables.
I have considered using windows (as talked about here), but I'd like the updates to the temporal table to be instantaneous.