opensearch-project / opensearch-project/sql
[BUG] Query with UNION operator fails with NullPointerException
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 176
- Forks
- 229
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 43
Description
What is the bug?
Present in OpenSearch 2.12.0, 2.11.0, 1.3.10
The documentation states that Union queries are supported. However, when attempting a simple union query, the request fails with:
{
"error": {
"reason": "There was internal problem at backend",
"details": "",
"type": "NullPointerException"
},
"status": 500
}
The query returns the expected result when ?format=csv is added to the request URL.
How can one reproduce the bug?
Steps to reproduce the behavior:
- Index data into OpenSearch (for this example, I am using simple novels/song data)
- perform query involving union:
{ "query": "SELECT title FROM novels UNION SELECT title FROM songs" } - NullPointerException error returned
What is the expected behavior?
Union operator to work as expected. In above example adding the request call to be ''http://localhost:9200/_plugins/_sql?format=csv" returns:
title
Animal Farm
The Great Gatsby
Catcher In The Rye
Bohemian Rhapsody
What is your host/environment?
Present in OpenSearch 2.12, 2.11 and 1.3.10
Do you have any screenshots?
Error:
As expected (When adding ?format=csv to request URL):
Do you have any additional context?
Add any other context about the problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the OpenSearch SQL plugin's _plugins/_sql endpoint and compare the default response path with the format=csv path for the UNION query shown. Reproduce the NullPointerException with the JSON response, then verify that the same UNION query returns its expected rows without requiring the CSV parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100