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

[#2999][#2997] improvement(partition): add partition operation dispatcher #3221

Merged
merged 3 commits into from
May 9, 2024

Conversation

mchades
Copy link
Contributor

@mchades mchades commented Apr 29, 2024

What changes were proposed in this pull request?

  • reuse the class loader of the catalog for partition operation
  • add partition operation dispatcher

Why are the changes needed?

Fix: #2997 #2999

Does this PR introduce any user-facing change?

no

How was this patch tested?

tests added

@mchades mchades self-assigned this Apr 29, 2024
@mchades mchades requested a review from FANNG1 April 30, 2024 03:27
cl -> {
Preconditions.checkArgument(
asTables() != null, "Catalog does not support table operations");
Table table = asTables().loadTable(tableIdent);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we load table first and then as a parameter to this method? So we would not load the table each time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but there is a trade-off:

  1. load table first and then as a parameter to this method: load table once, switch thread class loader 4 times(2 for load table, 2 for partition ops)
  2. current implementation: load table once (Since each request will only perform one partition operation currently), switch thread class loader 2 times

Therefore, I think it's fine for the current implementation, WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

The current implementation is fine as is, and we can change it after the full test is completed.

@mchades
Copy link
Contributor Author

mchades commented May 6, 2024

@jerryshao All comments are resolved, do you want to take another look?

@mchades mchades requested a review from yuqi1129 May 6, 2024 12:19
@jerryshao
Copy link
Contributor

Yeah, I will.

@jerryshao
Copy link
Contributor

jerryshao commented May 6, 2024

How do you verify that the partition operation is running in the isolated classloader, is it possible to add the test case to cover this?

@mchades
Copy link
Contributor Author

mchades commented May 7, 2024

How do you verify that the partition operation is running in the isolated classloader, is it possible to add the test case to cover this?

@jerryshao test for isolated classloader added, please help review again

asTables() != null, "Catalog does not support table operations");
Table table = asTables().loadTable(tableIdent);
Preconditions.checkArgument(
table.supportPartitions() != null, "Table does not support partition operations");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it throwing an exception (UnsupportedOperationException) or returning null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UnsupportedOperationException

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So should I remove this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps it can avoid the implementer returning null.

Copy link
Contributor

Choose a reason for hiding this comment

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

if it will never return null, you don't need to handle this, otherwise, you need to think about how to handle UnsupportedOperationException

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if it will never return null, you don't need to handle this,

Whether null will be returned depends on the developer of the catalog. The current implementation is more like defensive programming.

you need to think about how to handle UnsupportedOperationException

Since UnsupportedOperationException is a RuntimeException, I think we could just throws it out

@jerryshao jerryshao merged commit 09f82cf into apache:main May 9, 2024
22 checks passed
github-actions bot pushed a commit that referenced this pull request May 9, 2024
…cher (#3221)

### What changes were proposed in this pull request?

- reuse the class loader of the catalog for partition operation
- add partition operation dispatcher

### Why are the changes needed?

Fix: #2997 #2999 

### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

tests added
diqiu50 pushed a commit to diqiu50/gravitino that referenced this pull request Jun 13, 2024
…ation dispatcher (apache#3221)

### What changes were proposed in this pull request?

- reuse the class loader of the catalog for partition operation
- add partition operation dispatcher

### Why are the changes needed?

Fix: apache#2997 apache#2999 

### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

tests added
@mchades mchades deleted the dispatch-part branch November 22, 2024 03:40
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] Provide specific classLoader for Partition operation
4 participants