Skip to content

Conversation

yuqi1129
Copy link
Contributor

What changes were proposed in this pull request?

Instead of catching exceptions when dropping schemas fails, throw them.

Why are the changes needed?

We can't determine whether the schema drop was successful or not based on its return value.

Fix: #1237

Does this PR introduce any user-facing change?

N/A

How was this patch tested?

Existing UTs and ITs.

@yuqi1129 yuqi1129 self-assigned this Dec 22, 2023
} catch (NonEmptySchemaException e) {
throw new TrinoException(GRAVITINO_SCHEMA_NOT_EMPTY, "Schema does not empty", e);
} catch (Exception e) {
String errorMessage =
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 possible to report an error here that the array is out of bounds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Clearvive ,
I can't get your meaning clearly, could you provide more details about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a common practice, and I'll refine it later. I have created the issue #1249

@jerryshao
Copy link
Contributor

@Clearvive can you please help to review.

@yuqi1129
Copy link
Contributor Author

yuqi1129 commented Jan 2, 2024

@jerryshao

All unnecessary changes have been undo, please take a look again.

@yuqi1129 yuqi1129 requested a review from diqiu50 January 2, 2024 09:16
@@ -379,24 +379,15 @@ public Schema alterSchema(NameIdentifier ident, SchemaChange... changes)
@Override
public boolean dropSchema(NameIdentifier ident, boolean cascade) throws NonEmptySchemaException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it only throw the NonEmptySchemaException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other exceptions will also be thrown, but it's not explicitly declared.

Copy link
Contributor

@diqiu50 diqiu50 left a comment

Choose a reason for hiding this comment

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

LGTM

@yuqi1129 yuqi1129 changed the title [#1237] improvement(all): Throw exceptions when dropping schemas failed [#1237] fix(trino): Fix dropping iceberg schema failure Jan 4, 2024
@yuqi1129
Copy link
Contributor Author

yuqi1129 commented Jan 4, 2024

@jerryshao

API related changes have been reverted.

@yuqi1129 yuqi1129 added branch-0.3 need backport Issues that need to backport to another branch labels Jan 4, 2024
@jerryshao jerryshao merged commit 49be585 into apache:main Jan 4, 2024
github-actions bot pushed a commit that referenced this pull request Jan 4, 2024
### What changes were proposed in this pull request?

Instead of catching exceptions when dropping schemas fails, throw them. 

### Why are the changes needed?

We can't determine whether the schema drop was successful or not based
on its return value.

Fix: #1237 

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

N/A

### How was this patch tested?

Existing UTs and ITs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need backport Issues that need to backport to another branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug report] Dropping an Iceberg schema is misunderstanding
4 participants