Uh oh!
There was an error while loading. Please reload this page.
Flink: flink read iceberg upsert data use streaming mode - #3095
Conversation
hameizi
commented
Sep 10, 2021
@openinx@stevenzwu Could you help take a look? |
openinx
commented
Sep 13, 2021
Thanks for @hameizi for contribution, I will take a look tomorrow. |
hameizi
commented
Oct 18, 2021
@openinx Could you help take a look again? |
openinx
commented
Oct 18, 2021
Thanks for the work @hameizi , I think I will take a look at this tomorrow ! |
@hameizi Flink SQL> CREATE TABLE iceberg_table_upsert8(
INSERT INTO iceberg_table_upsert8 VALUES(1,'qq'); INSERT INTO iceberg_table_upsert8 VALUES(1,'aa'); Flink SQL> SELECT * FROM iceberg_table_upsert8 /+ OPTIONS('streaming'='true', 'monitor-interval'='1s')/ ; When I use Flink Batch query table ,it has tow records |
hameizi
commented
Oct 25, 2021
@MOBIN-F It's true, this PR translate update to -D and +I. |
MOBIN-F
commented
Oct 25, 2021
It will query the record(1,qq). but this record is from before the update, Is that right? |
hameizi
commented
Oct 25, 2021
If you don't query op of data, you will get only one result (1,aa). |
Hi @hameizi, thanks for the great work! I'm really interested in this patch to support @openinx do you know if this PR can make it to the next release? if so, roughly when will be the next release or does it depends on the progress on the priority 1 items in the roadmap? |
hameizi
commented
Nov 4, 2021
@xinbinhuang It work for both Flink 1.12 and 1.13. |
Initial-neko
commented
Nov 10, 2021
https://ci.apache.org/projects/flink/flink-docs-release-1.13/zh/docs/dev/table/sqlclient/ client mode can help you to do that |
Thanks ,After testing, the PR is problematic, there will be duplicate data in batch read, not suitable for Retract stream and join scenario also have problems, |
hameizi
commented
Nov 12, 2021
This PR is not relate to bath mode. And can you descript the detail of Upsert and join problem? |
openinx
commented
Nov 12, 2021
@hameizi , would you mind to resolve the conflicts ? I think I can take a look for the first round later. |
hameizi
commented
Nov 12, 2021
4391208 to
9889199ComparexianyouQ
commented
Jan 19, 2022
I merged this PR and did some testing. i used flink cdc to consume binlog and wrote to iceberg table, then run some flink sql query(streaming) and compared with mysql original query , then the results were not matched. After some debug I found 2 issues.
` `
After fixed above 2 issues the test is passed. |
hameizi
commented
Jan 20, 2022
For this issue, config
I will do more test for this issue. |
xianyouQ
commented
Jan 24, 2022
|
kingeasternsun
commented
Jan 27, 2022
I think this code will be more clear if written like this publicvoidwrite(RowDatarow) throwsIOException {
RowDataDeltaWriterwriter = route(row);
switch (row.getRowKind()) {
caseINSERT:
if (upsert) {
writer.delete(row);
}
writer.write(row);
break;
caseUPDATE_AFTER:
writer.write(row);
break;
caseUPDATE_BEFORE:
caseDELETE:
writer.delete(row);
break;
default:
thrownewUnsupportedOperationException("Unknown row kind: " + row.getRowKind());
}
} |
liubo1022126
commented
Feb 18, 2022
xianyouQ
commented
Mar 16, 2022
Another issue, After run rewrite data file action and expire snapshot action(retain one Last snapshot), and then started a new flink streaming job, it did not read the old data. I checked metadata files , there was only one snapshot and all manifest file had a smaller sequenceNumber. what should i do if i want to read all data. |
| * copied. | ||
| * @return a {@link CloseableIterable} of {@link FileScanTask} | ||
| */ | ||
| public CloseableIterable<FileScanTask> planStreamingFiles() { |
There was a problem hiding this comment.
Streaming is an ambiguous name here. maybe planFilesForChangelog?
| * @return a table scan which can read append data for {@code snapshotId} | ||
| * exclusive and up to current snapshot inclusive | ||
| */ | ||
| TableScan appendsCurrent(long snapshotId); |
There was a problem hiding this comment.
this change seems unnecessary
| import org.apache.iceberg.util.PartitionUtil; | ||
| @Internal | ||
| public class StreamingRowDataFileScanTaskReader implements FileScanTaskReader<RowData> { |
There was a problem hiding this comment.
Similarly, maybe ChangelogRowDataFileScanTaskReader is more accurate
hameizi
commented
Apr 19, 2022
@stevenzwu I will perfect this PR after #4580 finished, because there is some correlation between them. |
GavinH1984
commented
May 16, 2022
hameizi
commented
May 16, 2022
iflytek-hmwang5
commented
Aug 2, 2022
Xiangakun
commented
Jun 9, 2023
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Now, flink read iceberg use streaming mode ignore 'overwrite' snapshot, so user can't read the delete data real-time.
This PR first emit the eqdelete as delete rowdata(-U), and then emit the rowdata(+I) that join adddata and posdelete by function applyPosdelete. And then flink can keep one primary table from read iceberg primary table.