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

[#5533] fix (trino-connector): Fix the exception of ArrayIndexOutOfBoundsException when execute COMMENT COLUMN command #6182

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

diqiu50
Copy link
Contributor

@diqiu50 diqiu50 commented Jan 10, 2025

What changes were proposed in this pull request?

Fix the exception of ArrayIndexOutOfBoundsException when handle error message of IllegalArgumentException

Why are the changes needed?

Fix: #5533

Does this PR introduce any user-facing change?

No

How was this patch tested?

IT

@jerryshao jerryshao added the branch-0.8 Automatically cherry-pick commit to branch-0.8 label Jan 10, 2025
@diqiu50 diqiu50 changed the title [#5533] fix (trino-connector): Fix the exception of ArrayIndexOutOfBoundsException when execute ALTER SQL command [#5533] fix (trino-connector): Fix the exception of ArrayIndexOutOfBoundsException when execute COMMENT COLUMN command Jan 10, 2025
@diqiu50 diqiu50 requested a review from yuqi1129 January 10, 2025 09:23
@@ -109,17 +110,19 @@ String runQueryOnce(String query) {
session = builder.build();
queryRunner.setSession(session);
}
return outputStream.toString();

// avoid the ide capturing the error message as failure
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid -> Avoid
ide -> IDE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix


public static String toSimpleErrorMessage(Exception e) {
List<String> lines = e.getMessage().lines().toList();
return lines.size() > 1 ? lines.get(0) + lines.get(1) : lines.get(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we only output the first two lines of the error message?

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, the client doesn't need to see the stack trace in the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-0.8 Automatically cherry-pick commit to branch-0.8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug report] Trino, hive catalog: COMMNET COLUMN with ' ' or NULL has ArrayIndexOutOfBoundsException error
3 participants