Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

N1QL API Parameter

Value

Old Asterix API Parameter

Proposed API Parameter

Comment

statement

string

query

statement

Any valid AQL statement (DDL, update\load statement, flowr query), which should be executed

format

enum

Accept HTTP header

Accept HTTP header

[Optional] Desired format for the query results. Possible values are ADM, JSON, CSV, XML (for VXQuery). (default: ADM)

signature

boolean

header

signature

[Optional] Defines whether to include a header for the results schema in the response. In current Asterix used to include CSV header into response. (default: false)

 

(default: false)

In case of CSV result format header is included right into the result.

-

enum

mode

mode

[Optional] Result delivery mode. Possible values are asynchronous, asynchronous-deferred, synchronous. (default: synchronous)

 
-

boolean

lossless

lossless

[Optional] Defines whether to use  lossless-JSON output for JSON-encoded output or keep clean-JSON instead. (default: false)

 
-

boolean

wrapper-array

wrapper-array

[Optional] Defines whether to wrap ADM-encoded output into array-braces (default: false)

 
-

boolean

print-expr-tree

expr-tree

[Optional] Defines whether to include an query expression AST into the result (default: false)

 
-

boolean

print-rewritten-expr-tree

rewritten-expr-tree

[Optional] Defines whether to include a rewritten query expression AST into the result (default: false)

 
-

boolean

print-logical-plan

logical-plan

[Optional] Defines whether to include a logical plan into the result (default: false)

 
-

boolean

print-optimized-logical-plan

optimized-plan

[Optional] Defines whether to include a optimized logical plan into the result (default: false)

 
-

boolean

print-job

hyracks-job

[Optional] Defines whether to include a Hyracks job into the result (default: false)

 
-

boolean

execute-query

execute-query

[Optional] Defines whether to execute a query (default: true)

 

...

 

N1QL API Parameter

Value

Old Asterix API Parameter

Proposed API Parameter

Comment

results

JSONList

HTTP response body

results

One of three possible values depending on result delivery

1) A list of all results returned by the query (sync result delivery).

2) A list of all URIs to QueryStatus endpoint (async result delivery).

3) No value (DDL\update\load)

signatureJSONObject-signatureThe schema of the results (if signature=true, )

status

string

HTTP response status

status

The status of the request; possible values are: Success, Running (async result), Error (parse\optimizer error), Fatal (execution error).

error

JSONObject

HTTP response body

error

An object containing details of the error

error.code

int

error-code

error.code

A code that identifies the error.

error.msg

string

summary

error.msg

A message describing the error in detail.

  

stacktrace

 

A stack trace of the error.

metrics

JSONObject

 
-

metrics

An object containing details of the  execution metrics.

metrics.executionTime

string

 
-

metrics.executionTime

The time taken for the execution of the request, i.e. time from when query execution started until the results were returned. (if execute-query=true)

metrics.resultCount

unsigned int

 
-

metrics.resultCount

The total number of objects in the results (if result delivery is synchronous and execute-query=true)

 

JSONObject

 
-

metrics.expr_tree

Serialized query expression tree (if expr-tree=true)

 

JSONObject

 
-

metrics.rewritten_expr_tree

Serialized rewritten query expression tree (if rewritten-expr-tree=true)

 

JSONObject

 
-

metrics.logical_plan

Serialized query logical plan (if logical-plan=true)

 

JSONObject

 
-

metrics.optimized_plan

Serialized query optimized logical plan (if optimized-plan=true)

 

JSONObject

 
-

metrics.hyracks_job

Serialized Hyracks job (if hyracks-job=true)

Examples:

  1. DDL request

    Code Block
    titleQuery
    curl -v http://localhost:19002/query -X POST \
    -d "statement=create dataverse test;"
    Code Block
    titleResponse
    < HTTP/1.1 200 OK
    Content-Type: application/json
    {
      "status": "success"
      "metrics": {
        "executionTime": "1ms"
      }
    }
  2. Query which is not executed, but returns logical plan

    Code Block
    titleQuery
    curl -v http://localhost:19002/query -X POST -H "Accept: application/json" \
    -d "statement=for $x in dataset testDS return $x & lossless=true & logical-plan=true & execute-query=false"
    Code Block
    titleResponse
    < HTTP/1.1 200 OK
    Content-Type: application/json
    {
      "status": "success"
      "metrics": {
        "executionTime": "5ms",
        "logical_plan": [
          {"operator": "distribute_result", "args": [{"exp": "var_ref", "var": "$$1$$0"}]},
          {"operator": "datascan", "output_vars": ["$$0", "$$1"]}
      }
    }

     

     

     

  3. Query which synchronously returns CSV result , but returns logical planinside JSON response