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

Improve error handling for some more edge cases #3080

Merged
merged 8 commits into from
Oct 23, 2024

Conversation

Swiddis
Copy link
Collaborator

@Swiddis Swiddis commented Oct 18, 2024

Description

Improves error handling for some types of malformed SQL queries.

Related Issues

N/A

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
@Swiddis Swiddis changed the title Fix err bugs Improve error handling for some more edge cases Oct 18, 2024
Signed-off-by: Simeon Widdis <[email protected]>
@Swiddis Swiddis marked this pull request as ready for review October 18, 2024 19:25
@Swiddis Swiddis added v2.18.0 Issues targeting release v2.18.0 bug Something isn't working labels Oct 18, 2024
@@ -122,7 +123,23 @@ public boolean visit(SQLIdentifierExpr expr) {
String fullFieldName = arr[1];

String index = curScope().getAliases().get(alias);
if (index == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see issue related. Could you elaborate what's the current behavior without the changes? From what I see here, we try to find the index corresponding to an alias. If not found, does it mean the alias may be wrong?

Copy link
Collaborator Author

@Swiddis Swiddis Oct 23, 2024

Choose a reason for hiding this comment

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

The issue is that it doesn't get caught as a specific error so the response is unclear/unactionable -- when you pass invalid indices, this index not being found propagates up as a generic internal server error

OpenSearchException[Internal error occurred while processing request]
For more details, please send request for Json format to see the raw response from OpenSearch engine.

Signed-off-by: Simeon Widdis <[email protected]>
@Swiddis Swiddis merged commit 5852ce3 into opensearch-project:main Oct 23, 2024
13 of 15 checks passed
@Swiddis Swiddis deleted the fix-err-bugs branch October 23, 2024 19:35
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 23, 2024
* Add failing tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix the first test

Signed-off-by: Simeon Widdis <[email protected]>

* Revise the tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix wildcard tests

Signed-off-by: Simeon Widdis <[email protected]>

* Add license header

Signed-off-by: Simeon Widdis <[email protected]>

* Fix rerunning SQL parsing

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
(cherry picked from commit 5852ce3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 23, 2024
* Add failing tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix the first test

Signed-off-by: Simeon Widdis <[email protected]>

* Revise the tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix wildcard tests

Signed-off-by: Simeon Widdis <[email protected]>

* Add license header

Signed-off-by: Simeon Widdis <[email protected]>

* Fix rerunning SQL parsing

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
(cherry picked from commit 5852ce3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Swiddis added a commit to Swiddis/sql that referenced this pull request Oct 23, 2024
)

* Add failing tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix the first test

Signed-off-by: Simeon Widdis <[email protected]>

* Revise the tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix wildcard tests

Signed-off-by: Simeon Widdis <[email protected]>

* Add license header

Signed-off-by: Simeon Widdis <[email protected]>

* Fix rerunning SQL parsing

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
Swiddis added a commit that referenced this pull request Oct 25, 2024
) (#3115)

* Improve error handling for some more edge cases (#3080)

* Add failing tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix the first test

Signed-off-by: Simeon Widdis <[email protected]>

* Revise the tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix wildcard tests

Signed-off-by: Simeon Widdis <[email protected]>

* Add license header

Signed-off-by: Simeon Widdis <[email protected]>

* Fix rerunning SQL parsing

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>

* Fix test imports

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
ykmr1224 pushed a commit that referenced this pull request Nov 14, 2024
* Improve error handling for some more edge cases (#3080)

* Add failing tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix the first test

Signed-off-by: Simeon Widdis <[email protected]>

* Revise the tests

Signed-off-by: Simeon Widdis <[email protected]>

* Fix wildcard tests

Signed-off-by: Simeon Widdis <[email protected]>

* Add license header

Signed-off-by: Simeon Widdis <[email protected]>

* Fix rerunning SQL parsing

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>

* Fix: CSV and Raw output, escape quotes (#3063)

Fixes #3050

Signed-off-by: Mike Swierczek <[email protected]>
(cherry picked from commit cfe38d7)
Signed-off-by: Simeon Widdis <[email protected]>

* Fix merge conflict

Signed-off-by: Simeon Widdis <[email protected]>

---------

Signed-off-by: Simeon Widdis <[email protected]>
Signed-off-by: Mike Swierczek <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Co-authored-by: Mike Swierczek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport 2.18 bug Something isn't working v2.18.0 Issues targeting release v2.18.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants