I'm trying to get the following snippet to work on...
# troubleshooting
j
I'm trying to get the following snippet to work on AWS Managed Apache Flink:
Copy code
CREATE TABLE input_stream (
  `proctime` AS PROCTIME(),
  `eventtime` TIMESTAMP(3),
  `key` INT,
  WATERMARK FOR `eventtime` as `eventtime`
)
PARTITIONED BY `key`
WITH ( 'connector' = 'kinesis', 'stream' = '...')

CREATE TABLE large_read_table (
  `key` INT,
  `annotation` INT,
  PRIMARY KEY (`key`) NOT ENFORCED
)
WITH ( 'connector' = 'iceberg', 'warehouse' = '...', ... )

CREATE TABLE output_stream (
  `proctime` TIMESTAMP_LTZ(3),
  `eventtime` TIMESTAMP(3),
  `key` INT
  `annotation` INT,
  WATERMARK FOR `eventtime` as `eventtime`
)
PARTITIONED BY `key`
WITH ( 'connector' = 'kinesis', 'stream' = '...')

INSERT INTO output_stream live
SELECT
  s.`proctime`,
  s.`eventtime`,
  s.`key`,
  t.`annotation`
FROM input_stream s
LEFT JOIN large_read_table t
ON s.`key` = t.`key`
This give me the error:
Copy code
Table sink '...output_stream' doesn't support consuming update and delete changes which is produced by node Join.
Joining with
LEFT JOIN large_read_table FOR SYSTEM_TIME AS OF s.proctime AS t
instead, I get the error:
Copy code
Processing-time temporal join is not supported yet.
Is there a way to make annotation from lookup table work and have a stream at the end?
m
Is there a way to make annotation from lookup table work and have a stream at the end?
You could use the lookup work on event time, so you would have an event time temporal join
j
so if I do
for SYSTEM_TIME AS OF s.eventtime
it should work?
m
I would expect so yes
j
Cool. Thanks. Ill try it out now.
Unfortunatly it didn't work. I got the error
org.apache.flink.table.api.ValidationException: Event-Time Temporal Table Join requires both primary key and row time attribute in versioned table, but no row time attribute can be found.
I am not quite sure what this error is trying to say. Any pointers?
m
You don't have a primary key defined on your kinesis stream
j
Thank you. I'll give it a try.
Hm... I added `PRIMARY KEY (
eventtime
) NOT ENFORCED` to both input_ and output_stream, but there don't seem to make any difference.
Does the primary key need to be the same for the stream and the lookup table? Could I e.g. use the key `(
eventime
,
key
)` pair?
Aligning made no difference. @Martijn Visser, is it possible that Iceberg doesn't support being a lookup table?
m
is it possible that Iceberg doesn't support being a lookup table?
Definitely. I don't know if they've built in support for that
j
okay. ill ask over on their what is possible with iceberg. Thank you so much for you time Martijn.
yeah, no. Not supported.