Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flink]Datastream sink supports dynamic bucketing #520

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test dynamic_bucket failover recover
Signed-off-by: zenghua <huazeng@dmetasoul.com>
  • Loading branch information
zenghua committed Aug 2, 2024
commit 0e63939f783f78ed57d5af33f0c22dc06d3e7788
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ public List<LakeSoulMultiTableSinkGlobalCommittable> commit(
.setTableSchema(msgSchema.toJson())
.setPartitions(partition)
.setProperties(properties.toJSONString());
Tuple2<Long, TableInfo> last = finalTableInfoMap.get(tablePath);
if (last == null) {
Tuple2<Long, TableInfo> latest = finalTableInfoMap.get(tablePath);
if (latest == null) {
finalTableInfoMap.put(tablePath, Tuple2.of(latestSrcTsMs, builder.build()));
} else if (last.f0 < latestSrcTsMs) {
} else if (latest.f0 < latestSrcTsMs) {
finalTableInfoMap.put(tablePath, Tuple2.of(latestSrcTsMs, builder.build()));
}
} else {
Expand All @@ -187,11 +187,11 @@ public List<LakeSoulMultiTableSinkGlobalCommittable> commit(
}

String tablePath = tableInfo.getTablePath();
Tuple2<Long, TableInfo> last = finalTableInfoMap.get(tablePath);
Tuple2<Long, TableInfo> latest = finalTableInfoMap.get(tablePath);
TableInfo.Builder builder = tableInfo.toBuilder().setTableSchema(msgSchema.toJson());
if (last == null) {
if (latest == null) {
finalTableInfoMap.put(tablePath, Tuple2.of(latestSrcTsMs, builder.build()));
} else if (last.f0 < latestSrcTsMs) {
} else if (latest.f0 < latestSrcTsMs) {
finalTableInfoMap.put(tablePath, Tuple2.of(latestSrcTsMs, builder.build()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testLakeSoulDataStreamSink() throws Exception {
TableId tableId = new TableId(LakeSoulCatalog.CATALOG_NAME, "default", tableName);
LakeSoulRowDataWrapper data = mockInsertLakeSoulRowDataWrapper(1, useCDC, tableId);
recordCollection.add(new BinarySourceRecord(topic, primaryKeys, tableId, path, partitionKeys, false, data, ""));

Thread.sleep(100);
// LakeSoulRowDataWrapper data1 = mockUpdateLakeSoulRowDataWrapper(2, useCDC, tableId);
LakeSoulRowDataWrapper data1 = mockInsertLakeSoulRowDataWrapper(4, useCDC, tableId);
recordCollection.add(new BinarySourceRecord(topic, primaryKeys, tableId, path, partitionKeys, false, data1, ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ abstract class DDLTestBase extends QueryTest with SQLTestUtils {
}
}

// test("read") {
// sql("show create table TestBinarySourceRecordSink").show(false)
// sql("desc TestBinarySourceRecordSink").show()
// sql("select * from TestBinarySourceRecordSink").show()
// }
test("read") {
sql("show create table TestBinarySourceRecordSink").show(false)
sql("desc TestBinarySourceRecordSink").show()
sql("select * from TestBinarySourceRecordSink").show()
}
}
Loading