Version:

Execute SQL

SQL Request

Input Parameter Description

Name Type Description
statement string SQL statement (query, DML, or DDL) to be executed
offset long A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The minimum allowed value is 0. The maximum allowed value is MAX_INT.
limit long A positive integer indicating the maximum number of results to be returned (if not provided the default is 10000), or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned.
encoding string

Specifies the encoding for returned records; either 'binary' or 'json'. The supported values are:

  • binary
  • json
request_schema_str string Avro schema of input parameter data. The default value is ''.
data array of bytes An array of binary-encoded data for the records to be binded to the SQL query. The default value is an empty array ( [] ).
options map of string to strings

Optional parameters. The default value is an empty map ( {} ).

Supported Parameters (keys) Parameter Description
parallel_execution

If false, disables the parallel step execution of the given query. The supported values are:

  • true
  • false
cost_based_optimization

If false, disables the cost-based optimization of the given query. The supported values are:

  • true
  • false
plan_cache

If false, disables plan caching for the given query. The supported values are:

  • true
  • false
rule_based_optimization

If false, disables rule-based rewrite optimizations for the given query The supported values are:

  • true
  • false
results_caching

If false, disables caching of the results of the given query The supported values are:

  • true
  • false
paging_table When empty or the specified paging table not exists, the system will create a paging table and return when query output has more records than the user asked. If the paging table exists in the system, the records from the paging table are returned without evaluating the query.
paging_table_ttl Sets the TTL of the paging table.
distributed_joins

If true, enables the use of distributed joins in servicing the given query. Any query requiring a distributed join will succeed, though hints can be used in the query to change the distribution of the source data to allow the query to succeed. The supported values are:

  • true
  • false
distributed_operations

If true, enables the use of distributed operations in servicing the given query. Any query requiring a distributed join will succeed, though hints can be used in the query to change the distribution of the source data to allow the query to succeed. The supported values are:

  • true
  • false
ssq_optimization

If false, scalar subqueries will be translated into joins The supported values are:

  • true
  • false
late_materialization

If true, Joins/Filters results will always be materialized ( saved to result tables format) The supported values are:

  • true
  • false
ttl Sets the TTL of the intermediate result tables used in query execution.
update_on_existing_pk

Can be used to customize behavior when the updated primary key value already exists as described in Insert Records Request. The supported values are:

  • true
  • false
preserve_dict_encoding

If true, then columns that were dict encoded in the source table will be dict encoded in the projection table. The supported values are:

  • true
  • false
validate_change_column

When changing a column using alter table, validate the change before applying it. If true, then validate all values. A value too large (or too long) for the new type will prevent any change. If false, then when a value is too large or long, it will be truncated.

Supported Values Description
true true
false false
prepare_mode

If true, compiles a query into an execution plan and saves it in query cache. Query execution is not performed and an empty response will be returned to user The supported values are:

  • true
  • false

Output Parameter Description

Name Type Description
count_affected long The number of objects/records affected.
response_schema_str string Avro schema of output parameter binary_encoded_response or output parameter json_encoded_response.
binary_encoded_response bytes Avro binary encoded response.
json_encoded_response string Avro JSON encoded response.
total_number_of_records long Total/Filtered number of records.
has_more_records boolean

Too many records. Returned a partial set. Possible values are:

  • true
  • false
paging_table string Name of the table that has the result records of the query. Valid, when output parameter has_more_records is true (Subject to config.paging_tables_enabled)
info map of string to strings Additional information.