-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add Control file module files and validation #2445
Conversation
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.
LGTM, thank you!
throws ControlFileValidationException { | ||
Set<String> mappedTargetColumns = new HashSet<>(); | ||
for (ControlFileTableFieldMapping mapping : controlFileTable.getMappings()) { | ||
if (mappedTargetColumns.contains(mapping.getTargetColumn())) { |
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.
[minor] You can call mappedTargetColumns.add(columnName) instead as it returns false when the entry already exists.
I confused this line with https://github.com/scalar-labs/scalardb/pull/2445/files#diff-fe051a3fcbc578fb1d270a16e032dbb16af0284fbd34ef077783848fba783138R89...
* @return Set of uniquely mapped target columns | ||
* @throws ControlFileValidationException when a duplicate mapping is found | ||
*/ | ||
private static Set<String> checkDuplicateColumnMappings(ControlFileTable controlFileTable) |
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.
I think this function name should be getTargetColumnSet
or something since it converts the data structure not only checking. What do you think?
@komamitsu san, |
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.
LGTM! 👍
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.
Left a couple of comments. Please take a look when you have time!
@@ -765,6 +765,44 @@ public enum CoreError implements ScalarDbError { | |||
DATA_LOADER_TABLE_METADATA_RETRIEVAL_FAILED( | |||
Category.USER_ERROR, "0166", "Failed to retrieve table metadata. Details: %s", "", ""), | |||
|
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.
@@ -0,0 +1,14 @@ | |||
package com.scalar.db.dataloader.core.dataimport.controlfile; | |||
|
|||
/** Represents the control file */ |
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.
This javadoc is wrong, right?
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.
@brfrn169 san,
I have updated the javadoc with more details.
Please check it when you get a chance and if it needs further changes, I will update it.
Thank you.
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.
Left a comment. Other than that, LGTM! Thank you!
"0173", | ||
"Duplicated data mappings found for column '%s' in table '%s'", | ||
"", | ||
""), | ||
// |
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 please add an empty line here?
// | |
// |
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Co-authored-by: Peckstadt Yves <[email protected]>
Description
This PR adds files related to control file and its validation. A control file is used to map column names specified in import source file to actual table columns.
Related issues and/or PRs
Please review and merge this PR once the following PRs are merged
Changes made
I have added files related to control file and its validation
Checklist
Additional notes (optional)
Road map to merge remaining data loader core files. Current status
General
Export
Import
Release notes
NA