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

[Importer] Adding an option to copy and not just move files #3520

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

agl29
Copy link
Collaborator

@agl29 agl29 commented Nov 1, 2023

What changes were proposed in this pull request?

  • Adding an option "Copy file" in importer to copy file

How was this patch tested?

  • Locally in both AWS and AZURE

desktop/libs/indexer/src/indexer/templates/importer.mako Outdated Show resolved Hide resolved
@@ -2633,6 +2640,7 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
self.isTransactionalVisible = ko.observable((vm.sourceType == 'impala' && isTransactionalVisibleImpala) || (vm.sourceType == 'hive' && isTransactionalVisibleHive));
self.isTransactional = ko.observable(self.isTransactionalVisible());
self.isTransactional.subscribe(function(val) {
self.copyFile(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sets self.copyFile to false regardless of what the isTransactional value is changed to, is that correct? I would assume you only want to set the self.copyFile to false if isTransactional is true, given the visibility logic of the input.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Option of transactional comes first then copy file option will come, hence I thought user must choose the option of copy file after he/she decided that table should be transactional or not. So if he/she wanted to create transactional table then we are hiding the option of copy file (as this condition is not possible) and setting it to 'False' and if user disabled the transactional option then we are providing the option of copy file, and user can choose whether he/she wants to copy the file or not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, so in practice it doesn't really matter that we set self.copyFile to false even when the isTransactional is set to false.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thinking more about this, this UI flow is a bit strange and could lead to mistakes, e.g:

  1. User checks Copy file
  2. User checks Transactional table
  3. User unchecks Transactional table (perhaps it was a misstake to select it in the first place)
  4. Now the Copy file selection has been undone and the user might miss that when moving forward.

Do we really need to change the state of the "Copy file" checkbox if it is not going to be used? Can't we just set a default value of false in the data we are submitting.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree Bjorm's thinking the logic in the UI flow of when to use copy option.
When there is a logic in UI, always put a validation in the backend code also to enforce the consistency. Also, do we expose importer in pubic API?

@agl29 agl29 force-pushed the importer_copy_file_option branch 3 times, most recently from 82b7024 to 461bd02 Compare November 1, 2023 12:03
@agl29 agl29 force-pushed the importer_copy_file_option branch 3 times, most recently from 115f487 to f50c676 Compare November 7, 2023 10:14
Copy link
Collaborator

@bjornalm bjornalm left a comment

Choose a reason for hiding this comment

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

Nice, the actual values of isTransactional and useCopy are now separated and we only use hide and disable on the UI elements to handle their relationship. This seems consistent with the iceberg additions.

Copy link
Contributor

@JohanAhlen JohanAhlen left a comment

Choose a reason for hiding this comment

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

LGTM!

@agl29 agl29 enabled auto-merge (squash) November 7, 2023 11:51
@agl29 agl29 merged commit 82fd88d into master Nov 7, 2023
3 of 4 checks passed
@agl29 agl29 deleted the importer_copy_file_option branch November 7, 2023 12:00
athithyaaselvam pushed a commit that referenced this pull request Feb 5, 2024
wing2fly pushed a commit that referenced this pull request Mar 6, 2024
…es (#3520)

(cherry picked from commit 82fd88d)
(cherry picked from commit b45ca92)
Change-Id: I6aa72cce7423c488868355e68fa20733bc2dc7d5
(cherry picked from commit 563fe012f78d5a912aef6b714fc1b00675bb8c12)
athithyaaselvam pushed a commit that referenced this pull request Mar 14, 2024
…es (#3520)

(cherry picked from commit 82fd88d)
(cherry picked from commit b45ca92)
Change-Id: I6aa72cce7423c488868355e68fa20733bc2dc7d5
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.

4 participants