-
Notifications
You must be signed in to change notification settings - Fork 486
Avoid create tables with system column names #878
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
Conversation
wuchong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @zhaomin1423 , the changes looks good in general. I left some minor comments.
fluss-server/src/main/java/com/alibaba/fluss/server/utils/TableDescriptorValidation.java
Show resolved
Hide resolved
| import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
|
||
| /** Test for {@link TableDescriptorValidation} . */ | ||
| public class TableDescriptorValidationTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add an integration test testCreateTableWithInvalidColumns in FlussAdminITCase? If the IT case is added, I think we don't need this unit test anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated
…eDescriptorValidation.java Co-authored-by: Jark Wu <imjark@gmail.com>
|
|
||
| private static void checkSystemColumns(RowType schema) { | ||
| List<String> fieldNames = schema.getFieldNames(); | ||
| List<String> systemColumns = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a set at the class level here? The list is going to grow, and it would help us to have a faster lookup via set and save us from recreating the same list on every function call.
@wuchong What do you think?
private static final Set<String> SYSTEM_COLUMNS = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(OFFSET_COLUMN_NAME, TIMESTAMP_COLUMN_NAME, BUCKET_COLUMN_NAME)));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhaomin1423 could you update PR for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks @MehulBatra
|
Thank you for your Contribution! left one comment remaining, looks good. |
Purpose
Linked issue: close #810
Brief change log
Verify that the system columns are used.
Tests
API and Format
Documentation