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

[kv] Support first row merge engine #240

Merged
merged 4 commits into from
Jan 5, 2025

Conversation

luoyuxia
Copy link
Collaborator

@luoyuxia luoyuxia commented Dec 20, 2024

Purpose

Linked issue: close #133

Introduce first row merge engine for primary key table

Tests

FlussTableITCase#testFirstRowMergeEngine
FlinkTableSinkITCase#testFirstRowMergeEngine

API and Format

N/A

Documentation

I'd like to complete the document in another pr #241 since after introduce merge engine, we may need to refactor the document struture about primary key table.

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need add validations for FlinkTableSink that first_row table doesn't supports UPDATE/DELETE and partial-update! And add tests to verify that.

@luoyuxia
Copy link
Collaborator Author

@wuchong Comments addressed...

if (mergeEngine != null && mergeEngine == ConfigOptions.MergeEngine.FIRST_ROW) {
throw new UnsupportedOperationException(
String.format(
"Table %s is with merge engine '%s'. Table with '%s' merge engine doesn't support DELETE and UPDATE statements.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table xxx uses the 'first_row' merge engine, which does not support DELETE or UPDATE statements.

@@ -712,6 +745,35 @@ void testUnsupportedDeleteAndUpdateStmtOnPartialPK() {
"Currently, Fluss table only supports UPDATE statement with conditions on primary key.");
}

@Test
void testUnsupportedDeleteAndUpdateStmtOnFirstRowMergeEngine() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify partial update as well!

Comment on lines 149 to 151
key(ConfigOptions.TABLE_MERGE_ENGINE.key())
.enumType(ConfigOptions.MergeEngine.class)
.noDefaultValue());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reuse the definition?

@luoyuxia luoyuxia force-pushed the support-first-row-merge-engin branch from e64b962 to 9de11b8 Compare December 24, 2024 08:15
@luoyuxia
Copy link
Collaborator Author

@wuchong Comments addressed again...

@wuchong wuchong force-pushed the support-first-row-merge-engin branch from 9de11b8 to 1353756 Compare January 5, 2025 14:45
Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @luoyuxia I appended a commit to improve the config operations:

  1. Move MergeEngine out of ConfigOptions, as it is very widely used in the code base, just like KvFormat.
  2. use toFlinkOption for quick/easy conversion from Fluss ConfigOption to Flink ConfigOption, avoid duplicate definition in FlinkTableFactory.

@wuchong
Copy link
Member

wuchong commented Jan 5, 2025

The CI is passed. I will merge it...

@luoyuxia please check the commit I appended.

1 similar comment
@wuchong
Copy link
Member

wuchong commented Jan 5, 2025

The CI is passed. I will merge it...

@luoyuxia please check the commit I appended.

@wuchong wuchong merged commit 92c6d23 into alibaba:main Jan 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Introduce first-row merge engine for primary key table
3 participants