You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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')
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
The text was updated successfully, but these errors were encountered:
curl -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query" : "SELECT A, B FROM (SELECT `key` as A, DAYSOFWEEK(customer_first_name) AS B from opensearch_dashboards_sample_data_flights) opensearch_dashboards_sample_data_ecommerce;"}' -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 9200 (#0)
> POST /_plugins/_sql HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 180
>
* upload completely sent off: 180 out of 180 bytes
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-length: 214
<
{
"error": {
"reason": "There was internal problem at backend",
"details": "The following method is not supported in Schema: DAYSOFWEEK",
"type": "UnsupportedOperationException"
},
"status": 500
* Connection #0 to host localhost left intact
}* Closing connection 0
I think the sql engine itself shouldn't return 200 for this, it should be a 400 bad request. Then sql-cli will be able to handle this as TransportError defined in opensearch-py clinet. But since it's 200, sql-cli will assume it's giving data in the format, when it tries to parse it by data['datarows'], an KeyError is thrown.
I can deliver a fix temporarily, while creaing an issue for sql-engine
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.
In such cases I have to use CURL to see the message:
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
The text was updated successfully, but these errors were encountered: