Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-55698

CBO Analyze: improve error message if seed value is invalid

    XMLWordPrintable

Details

    • 0
    • Yes
    • Analytics CBO Sprint 14, Analytics CBO Sprint 15

    Description

      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.

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-55698
          # Subject Branch Project Status CR V

          Activity

            People

              umang.agrawal Umang
              pierre.regazzoni Pierre Regazzoni
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty