The current protocol uses HTTP headers for many things including session parameters, session properties, transaction info, prepared statements, etc. This is problematic for prepared statements due to length limitations on HTTP headers in various clients and servers. It is also makes the protocol harder to following by mixing things across headers and the request / response bodies.
As long as we're changing the protocol, it makes sense to move everything from
headers into the JSON documents. We will add a new endpoint, /v2/statement
,
that accepts application/json
with the new request body (instead of just the query
text). The new endpoint will return the new response format.
Request document:
{
"session": {
"user": "bob",
"source": "cli",
"clientInfo": "junk",
"catalog": "tpch",
"schema": "sf10",
"timeZone": "UTC",
"language": "en-US",
"transactionId": "tx123",
"properties": {
"query_max_run_time": "30s",
"hive.bucket_execution_enabled": "true"
},
"preparedStatements": {
"abc": "data",
"xyz": "data"
}
},
"query": "SELECT ..."
}
Response document (same as existing, with the addition of the actions
field):
{
"id": "query12345",
"columns": [],
"data": [],
"actions": {
"setTransactionId": "tx123",
"clearTransactionId": true,
"setSessionProperties": {
"query_max_run_time": "30s",
"hive.bucket_execution_enabled": "true"
},
"clearSessionProperties": [
"query_max_run_time",
"hive.bucket_execution_enabled"
],
"addPreparedStatements": {
"abc": "data",
"xyz": "data"
},
"deallocatePreparedStatements": [
"abc",
"xyz"
]
}
}
Was wondering if adding a version field would be any useful for the future.
It would serve as a minor version, since the major is in the endpoint address.