opensearch-project / opensearch-project/sql
[BUG] SQL fails on executing some queries - OutOfBoundsException
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 176
- Forks
- 229
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 43
Description
Describe the bug
Tableau Desktop lists all columns in a query when it reads all data from a table, instead of calling SELECT * .... For example, kibana service table has 91 columns, so query gets big amount of columns listed.
{
"error": {
"reason": "There was internal problem at backend",
"details": "begin 1, end 0, length 1",
"type": "StringIndexOutOfBoundsException"
},
"status": 503
}
To Reproduce
The reason of failure is a bit unclear.
This query fails (23 columns, 721 chars):
SELECT `.kibana`.`application_usage_daily`,
`.kibana`.`application_usage_totals`,
`.kibana`.`application_usage_transactional`,
`.kibana`.`config`,
`.kibana`.`dashboard`,
`.kibana`.`dql-telemetry`,
`.kibana`.`index-pattern`,
`.kibana`.`migrationVersion`,
`.kibana`.`namespace`,
`.kibana`.`namespaces`,
`.kibana`.`originId`,
`.kibana`.`query`,
`.kibana`.`references`,
`.kibana`.`sample-data-telemetry`,
`.kibana`.`search-telemetry`,
`.kibana`.`search`,
`.kibana`.`timelion-sheet`,
`.kibana`.`tsvb-validation-telemetry`,
`.kibana`.`type`,
`.kibana`.`ui-metric`,
`.kibana`.`updated_at`,
`.kibana`.`url`,
`.kibana`.`visualization`
FROM `.kibana`
LIMIT 10000;
This is ok: (12 columns, 403 chars)
SELECT `.kibana`.`application_usage_daily`,
`.kibana`.`application_usage_totals`,
`.kibana`.`application_usage_transactional`,
`.kibana`.`config`,
`.kibana`.`dashboard`,
`.kibana`.`dql-telemetry`,
`.kibana`.`index-pattern`,
`.kibana`.`migrationVersion`,
`.kibana`.`namespace`,
`.kibana`.`namespaces`,
`.kibana`.`originId`,
`.kibana`.`query`
FROM `.kibana`
LIMIT 10000;
But if you will add one more column from the table it would fail.
This one is also ok:
SELECT 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50
This is ok (1 col, 1055 chars):
SELECT COUNT(*) as very_long_alias_blah_blah_blah________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
FROM `.kibana`
LIMIT 10000;
This one fails with the message I listed above, but actually it has a syntax error:
SELECT * as A
FROM `.kibana`
LIMIT 10000;
Expected behavior
SQL plugin shouldn't fail on parsing/processing such queries if they don't have syntax errors.
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
Reproduce the failure with the provided long column-list query and compare it with the shorter query and the long COUNT alias case. Trace the SQL plugin's parsing or processing path for the StringIndexOutOfBoundsException, then verify that valid queries no longer fail and that the shown syntax-error query is still rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100