I'm looking to use a <temporal table function> in ...
# troubleshooting
h
I'm looking to use a temporal table function in Fllink 1.16.1 using a view / query as input instead of a normal source table as I need to perform a CROSS JOIN UNNEST on an array in the original source table (Kafka connector). Best I could come up with is to run the CROSS JOIN UNNEST query, convert to DataStream<Row> and convert back to a Table with PK and Watermark defined. The DataStream<Row> was an insert-only stream. The job runs but nothing is output when calling the temporal table function in a LATERAL table. I simulated similar output from the CROSS JOIN UNNEST query with a normal table via the datagen connector, and I was able to see the expected output in the LATERAL table. Are temporal table functions incompatible with DataStream-based tables?
Here's the relevant code:
Copy code
// perform CROSS JOIN UNNEST
Table queryTable = tableEnv.sqlQuery("...");

// build schema with cols from queryTable and add PK and watermarks
Schema schema = ...

// create new table from query with PK and watermark
DataStream<Row> queryStream = tableEnv.toDataStream(queryTable);
Table unnestedTable = tableEnv.fromDataStream(queryStream, schema);

// expose temporal table function
TemporalTableFunction temporalTableFunction = unnestedTable.createTemporalTableFunction($("row_time"), $("id"));
tableEnv.createTemporarySystemFunction("test", temporalTableFunction);