opensearch-project / opensearch-project/sql-cli

[BUG] opensearch-sql CLI doesn't print a error return if http code is 500

Open
#5 2 comments 0 reactions 1 assignee View on GitHub

@zhongnansu is already working on this.

Since Nov 30, 2021.

bug
Dominant language
Python
Stars
9
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Some queries cause a error on server side and REST returns a message describing it followed by code 500. In this case CLI doesn't print the error.

opensearchsql> SELECT A, B FROM (SELECT `key` as A, DAYOFWEEK(date1) AS B from calcs) tmp WHERE tmp.B IN (1, 7);
KeyError('datarows')

image
In such cases I have to use CURL to see the message:

curl -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query" : "SELECT A, B FROM (SELECT `key` as A, DAYOFWEEK(date1) AS B from calcs) tmp WHERE B IN (1, 7);"}'
{
  "error": {
    "reason": "There was internal problem at backend",
    "details": "The following method is not supported in Schema: DAYOFWEEK",
    "type": "UnsupportedOperationException"
  },
  "status": 500
}

The CLI interface is much more convenient for use rather than CURL, so it would be useful to keep using it to see the error message.

Additional context
Low priority

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.