Vijay Sarathy created ASTERIXDB-3120:
----------------------------------------

             Summary: CBO Analyze: improve error message if seed value is 
invalid
                 Key: ASTERIXDB-3120
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-3120
             Project: Apache AsterixDB
          Issue Type: Bug
            Reporter: Vijay Sarathy


To repro: 
 - run: ANALYZE ANALYTICS COLLECTION airline WITH \{"sample-seed":-10};

 
|2023-02-23 14:21:27 \| ERROR \| MainProcess \| test_thread \| 
[on_prem_rest_client._http_request] POST 
http://172.23.104.91:8095/analytics/service body: \{"statement": "ANALYZE 
ANALYTICS COLLECTION airline WITH {\"sample-seed\":-10};", "pretty": true, 
"client_context_id": null, "mode": "immediate"} headers: \{'Content-Type': 
'application/json', 'Authorization': 'Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==', 
'Accept': '*/*'} error: 400 reason: unknown b'\{\n\t"requestID": 
"5200ed34-6c83-4c5c-b9da-77762ad352d9",\n\t"clientContextID": 
"null",\n\t"errors": [{ \n\t\t"code": 24000,\t\t"msg": "Syntax error: ASX1057: 
Expression of type UNARY_EXPRESSION is not supported in constant record (in 
line 1, at column 1)"\t} \n\t],\n\t"status": "fatal",\n\t"metrics": 
\{\n\t\t"elapsedTime": "21.125638ms",\n\t\t"executionTime": 
"18.197098ms",\n\t\t"resultCount": 0,\n\t\t"resultSize": 
0,\n\t\t"processedObjects": 0,\n\t\t"errorCount": 1\n\t}\n}\n'|

 

Also with string value get "VARIABLE_EXPRESSION is not supported in constant 
record"

 
|2023-02-23 14:29:43 \| ERROR \| MainProcess \| test_thread \| 
[on_prem_rest_client._http_request] POST 
http://172.23.104.91:8095/analytics/service body: \{"statement": "ANALYZE 
ANALYTICS COLLECTION airline WITH {\"sample-seed\":abc};", "pretty": true, 
"client_context_id": null, "mode": "immediate"} headers: \{'Content-Type': 
'application/json', 'Authorization': 'Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==', 
'Accept': '*/*'} error: 400 reason: unknown b'\{\n\t"requestID": 
"03d9352a-f3a2-41af-bd17-c86e27c8340c",\n\t"clientContextID": 
"null",\n\t"errors": [{ \n\t\t"code": 24000,\t\t"msg": "Syntax error: ASX1057: 
Expression of type VARIABLE_EXPRESSION is not supported in constant record (in 
line 1, at column 1)"\t} \n\t],\n\t"status": "fatal",\n\t"metrics": 
\{\n\t\t"elapsedTime": "8.310699ms",\n\t\t"executionTime": 
"5.256804ms",\n\t\t"resultCount": 0,\n\t\t"resultSize": 
0,\n\t\t"processedObjects": 0,\n\t\t"errorCount": 1\n\t}\n}\n' auth: 
Administrator:password|

 

 

and in invalid case when passing an actual string, we get "Invalid format for 
property \'sample-seed\'"

 
|2023-02-23 14:42:52 \| INFO \| MainProcess \| test_thread \| 
[tuq.run_cbq_query] RUN QUERY ANALYZE ANALYTICS COLLECTION airline WITH 
\{"sample-seed":"abc"}|
|2023-02-23 14:42:55 \| ERROR \| MainProcess \| test_thread \| 
[on_prem_rest_client._http_request] POST 
http://172.23.104.91:8095/analytics/service body: \{"statement": "ANALYZE 
ANALYTICS COLLECTION airline WITH {\"sample-seed\":\"abc\"};", "pretty": true, 
"client_context_id": null, "mode": "immediate"} headers: \{'Content-Type': 
'application/json', 'Authorization': 'Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==', 
'Accept': '*/*'} error: 400 reason: unknown b'\{\n\t"requestID": 
"03fa8585-77ae-444a-ad90-c1489db08147",\n\t"clientContextID": 
"null",\n\t"errors": [{ \n\t\t"code": 24102,\t\t"msg": "Invalid format for 
property \'sample-seed\'"\t} \n\t],\n\t"status": "fatal",\n\t"metrics": 
\{\n\t\t"elapsedTime": "2.0024407s",\n\t\t"executionTime": 
"2.000495388s",\n\t\t"resultCount": 0,\n\t\t"resultSize": 
0,\n\t\t"processedObjects": 0,\n\t\t"errorCount": 1\n\t}\n}\n' auth: 
Administrator:password|
|2023-02-23 14:42:55 \| ERROR \| MainProcess \| test_thread \| 
[tuq.run_cbq_query] PROBLEM WITH RESULT. TYPE IS: <class 'dict'> AND CONTENT 
IS: \{'requestID': '03fa8585-77ae-444a-ad90-c1489db08147', 'clientContextID': 
'null', 'errors': [{'code': 24102, 'msg': "Invalid format for property 
'sample-seed'"}], 'status': 'fatal', 'metrics': \{'elapsedTime': '2.0024407s', 
'executionTime': '2.000495388s', 'resultCount': 0, 'resultSize': 0, 
'processedObjects': 0, 'errorCount': 1}}|

 

 

I would expect a better, more user friendly error message than "Expression of 
type UNARY_EXPRESSION is not supported in constant record" or any of the above 
... and to be more prescriptive.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to