public class ExecuteSqlRequest extends Object implements org.apache.avro.generic.IndexedRecord
GPUdb.executeSql
.
Execute a SQL statement (query, DML, or DDL).
See SQL Support for the complete set of supported SQL commands.
Modifier and Type | Class and Description |
---|---|
static class |
ExecuteSqlRequest.Encoding
A set of string constants for the
ExecuteSqlRequest parameter
encoding . |
static class |
ExecuteSqlRequest.Options
A set of string constants for the
ExecuteSqlRequest parameter
options . |
Constructor and Description |
---|
ExecuteSqlRequest()
Constructs an ExecuteSqlRequest object with default parameters.
|
ExecuteSqlRequest(String statement,
long offset,
long limit,
String requestSchemaStr,
List<ByteBuffer> data,
Map<String,String> options)
Constructs an ExecuteSqlRequest object with the specified parameters.
|
ExecuteSqlRequest(String statement,
long offset,
long limit,
String encoding,
String requestSchemaStr,
List<ByteBuffer> data,
Map<String,String> options)
Constructs an ExecuteSqlRequest object with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Object |
get(int index)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
static org.apache.avro.Schema |
getClassSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
List<ByteBuffer> |
getData()
An array of binary-encoded data for the records to be binded to the SQL
query.
|
String |
getEncoding()
Specifies the encoding for returned records; either 'binary' or 'json'.
|
long |
getLimit()
A positive integer indicating the maximum number of results to be
returned, or END_OF_SET (-9999) to indicate that the maximum number of
results allowed by the server should be returned.
|
long |
getOffset()
A positive integer indicating the number of initial results to skip
(this can be useful for paging through the results).
|
Map<String,String> |
getOptions()
Optional parameters.
|
String |
getRequestSchemaStr()
Avro schema of
data . |
org.apache.avro.Schema |
getSchema()
This method supports the Avro framework and is not intended to be called
directly by the user.
|
String |
getStatement()
SQL statement (query, DML, or DDL) to be executed
|
int |
hashCode() |
void |
put(int index,
Object value)
This method supports the Avro framework and is not intended to be called
directly by the user.
|
ExecuteSqlRequest |
setData(List<ByteBuffer> data)
An array of binary-encoded data for the records to be binded to the SQL
query.
|
ExecuteSqlRequest |
setEncoding(String encoding)
Specifies the encoding for returned records; either 'binary' or 'json'.
|
ExecuteSqlRequest |
setLimit(long limit)
A positive integer indicating the maximum number of results to be
returned, or END_OF_SET (-9999) to indicate that the maximum number of
results allowed by the server should be returned.
|
ExecuteSqlRequest |
setOffset(long offset)
A positive integer indicating the number of initial results to skip
(this can be useful for paging through the results).
|
ExecuteSqlRequest |
setOptions(Map<String,String> options)
Optional parameters.
|
ExecuteSqlRequest |
setRequestSchemaStr(String requestSchemaStr)
Avro schema of
data . |
ExecuteSqlRequest |
setStatement(String statement)
SQL statement (query, DML, or DDL) to be executed
|
String |
toString() |
public ExecuteSqlRequest()
public ExecuteSqlRequest(String statement, long offset, long limit, String requestSchemaStr, List<ByteBuffer> data, Map<String,String> options)
statement
- SQL statement (query, DML, or DDL) to be executedoffset
- A positive integer indicating the number of initial
results to skip (this can be useful for paging through
the results). The default value is 0. The minimum allowed
value is 0. The maximum allowed value is MAX_INT.limit
- A positive integer indicating the maximum number of
results to be returned, or END_OF_SET (-9999) to indicate
that the maximum number of results allowed by the server
should be returned. The number of records returned will
never exceed the server's own limit, defined by the max_get_records_size parameter in the
server configuration. Use hasMoreRecords
to see if more records exist in the result
to be fetched, and offset
& limit
to
request subsequent pages of results. The default value is
-9999.requestSchemaStr
- Avro schema of data
. The default value
is ''.data
- An array of binary-encoded data for the records to be
binded to the SQL query. Or use QUERY_PARAMETERS
to pass the data
in JSON format. The default value is an empty List
.options
- Optional parameters.
COST_BASED_OPTIMIZATION
: If FALSE
, disables the cost-based
optimization of the given query.
Supported values:
The default value is FALSE
.
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.
Supported values:
The default value is 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.
Supported values:
The default value is FALSE
.
IGNORE_EXISTING_PK
: Specifies the record
collision error-suppression policy for inserting
into or updating a table with a primary key, only used when
primary key record collisions are rejected
(UPDATE_ON_EXISTING_PK
is FALSE
). If set to TRUE
,
any record insert/update that is rejected for
resulting in a primary key collision with an
existing table record will be ignored with no
error generated. If FALSE
, the rejection of any insert/update for
resulting in a primary key collision will cause
an error to be reported. If the specified table
does not have a primary key or if UPDATE_ON_EXISTING_PK
is TRUE
, then this option has no effect.
Supported values:
TRUE
: Ignore
inserts/updates that result in primary
key collisions with existing records
FALSE
: Treat as
errors any inserts/updates that result
in primary key collisions with existing
records
FALSE
.
LATE_MATERIALIZATION
: If TRUE
, Joins/Filters results will always be
materialized ( saved to result tables format).
Supported values:
The default value is 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.
PARALLEL_EXECUTION
: If FALSE
, disables the parallel step execution of
the given query.
Supported values:
The default value is TRUE
.
PLAN_CACHE
: If FALSE
, disables plan caching for
the given query.
Supported values:
The default value is TRUE
.
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.
Supported values:
The default value is FALSE
.
PRESERVE_DICT_ENCODING
: If TRUE
, then columns that were dict encoded in
the source table will be dict encoded in the
projection table.
Supported values:
The default value is TRUE
.
QUERY_PARAMETERS
: Query parameters in JSON
array or arrays (for inserting multiple rows).
This can be used instead of data
and
requestSchemaStr
.
RESULTS_CACHING
:
If FALSE
, disables caching
of the results of the given query.
Supported values:
The default value is TRUE
.
RULE_BASED_OPTIMIZATION
: If FALSE
, disables rule-based
rewrite optimizations for the given query.
Supported values:
The default value is TRUE
.
SSQ_OPTIMIZATION
: If FALSE
, scalar subqueries will be translated
into joins.
Supported values:
The default value is TRUE
.
TTL
: Sets the TTL of the intermediate result
tables used in query execution.
UPDATE_ON_EXISTING_PK
: Specifies the record
collision policy for inserting into or updating
a table with a primary key. If set to TRUE
, any existing table record
with primary key values that match those of a
record being inserted or updated will be
replaced by that record. If set to FALSE
, any such primary key
collision will result in the insert/update being
rejected and the error handled as determined by
IGNORE_EXISTING_PK
. If the specified table
does not have a primary key, then this option
has no effect.
Supported values:
TRUE
: Replace the
collided-into record with the record
inserted or updated when a new/modified
record causes a primary key collision
with an existing record
FALSE
: Reject the
insert or update when it results in a
primary key collision with an existing
record
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:
The default value is TRUE
.
CURRENT_SCHEMA
:
Use the supplied value as the default schema when processing
this SQL command.
Map
.public ExecuteSqlRequest(String statement, long offset, long limit, String encoding, String requestSchemaStr, List<ByteBuffer> data, Map<String,String> options)
statement
- SQL statement (query, DML, or DDL) to be executedoffset
- A positive integer indicating the number of initial
results to skip (this can be useful for paging through
the results). The default value is 0. The minimum allowed
value is 0. The maximum allowed value is MAX_INT.limit
- A positive integer indicating the maximum number of
results to be returned, or END_OF_SET (-9999) to indicate
that the maximum number of results allowed by the server
should be returned. The number of records returned will
never exceed the server's own limit, defined by the max_get_records_size parameter in the
server configuration. Use hasMoreRecords
to see if more records exist in the result
to be fetched, and offset
& limit
to
request subsequent pages of results. The default value is
-9999.encoding
- Specifies the encoding for returned records; either
'binary' or 'json'.
Supported values:
The default value is BINARY
.requestSchemaStr
- Avro schema of data
. The default value
is ''.data
- An array of binary-encoded data for the records to be
binded to the SQL query. Or use QUERY_PARAMETERS
to pass the data
in JSON format. The default value is an empty List
.options
- Optional parameters.
COST_BASED_OPTIMIZATION
: If FALSE
, disables the cost-based
optimization of the given query.
Supported values:
The default value is FALSE
.
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.
Supported values:
The default value is 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.
Supported values:
The default value is FALSE
.
IGNORE_EXISTING_PK
: Specifies the record
collision error-suppression policy for inserting
into or updating a table with a primary key, only used when
primary key record collisions are rejected
(UPDATE_ON_EXISTING_PK
is FALSE
). If set to TRUE
,
any record insert/update that is rejected for
resulting in a primary key collision with an
existing table record will be ignored with no
error generated. If FALSE
, the rejection of any insert/update for
resulting in a primary key collision will cause
an error to be reported. If the specified table
does not have a primary key or if UPDATE_ON_EXISTING_PK
is TRUE
, then this option has no effect.
Supported values:
TRUE
: Ignore
inserts/updates that result in primary
key collisions with existing records
FALSE
: Treat as
errors any inserts/updates that result
in primary key collisions with existing
records
FALSE
.
LATE_MATERIALIZATION
: If TRUE
, Joins/Filters results will always be
materialized ( saved to result tables format).
Supported values:
The default value is 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.
PARALLEL_EXECUTION
: If FALSE
, disables the parallel step execution of
the given query.
Supported values:
The default value is TRUE
.
PLAN_CACHE
: If FALSE
, disables plan caching for
the given query.
Supported values:
The default value is TRUE
.
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.
Supported values:
The default value is FALSE
.
PRESERVE_DICT_ENCODING
: If TRUE
, then columns that were dict encoded in
the source table will be dict encoded in the
projection table.
Supported values:
The default value is TRUE
.
QUERY_PARAMETERS
: Query parameters in JSON
array or arrays (for inserting multiple rows).
This can be used instead of data
and
requestSchemaStr
.
RESULTS_CACHING
:
If FALSE
, disables caching
of the results of the given query.
Supported values:
The default value is TRUE
.
RULE_BASED_OPTIMIZATION
: If FALSE
, disables rule-based
rewrite optimizations for the given query.
Supported values:
The default value is TRUE
.
SSQ_OPTIMIZATION
: If FALSE
, scalar subqueries will be translated
into joins.
Supported values:
The default value is TRUE
.
TTL
: Sets the TTL of the intermediate result
tables used in query execution.
UPDATE_ON_EXISTING_PK
: Specifies the record
collision policy for inserting into or updating
a table with a primary key. If set to TRUE
, any existing table record
with primary key values that match those of a
record being inserted or updated will be
replaced by that record. If set to FALSE
, any such primary key
collision will result in the insert/update being
rejected and the error handled as determined by
IGNORE_EXISTING_PK
. If the specified table
does not have a primary key, then this option
has no effect.
Supported values:
TRUE
: Replace the
collided-into record with the record
inserted or updated when a new/modified
record causes a primary key collision
with an existing record
FALSE
: Reject the
insert or update when it results in a
primary key collision with an existing
record
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:
The default value is TRUE
.
CURRENT_SCHEMA
:
Use the supplied value as the default schema when processing
this SQL command.
Map
.public static org.apache.avro.Schema getClassSchema()
public String getStatement()
statement
.public ExecuteSqlRequest setStatement(String statement)
statement
- The new value for statement
.this
to mimic the builder pattern.public long getOffset()
offset
.public ExecuteSqlRequest setOffset(long offset)
offset
- The new value for offset
.this
to mimic the builder pattern.public long getLimit()
hasMoreRecords
to see if more records exist in the result to be
fetched, and offset
& limit
to
request subsequent pages of results. The default value is -9999.limit
.public ExecuteSqlRequest setLimit(long limit)
hasMoreRecords
to see if more records exist in the result to be
fetched, and offset
& limit
to
request subsequent pages of results. The default value is -9999.limit
- The new value for limit
.this
to mimic the builder pattern.public String getEncoding()
BINARY
.encoding
.public ExecuteSqlRequest setEncoding(String encoding)
BINARY
.encoding
- The new value for encoding
.this
to mimic the builder pattern.public String getRequestSchemaStr()
data
. The default value is ''.requestSchemaStr
.public ExecuteSqlRequest setRequestSchemaStr(String requestSchemaStr)
data
. The default value is ''.requestSchemaStr
- The new value for requestSchemaStr
.this
to mimic the builder pattern.public List<ByteBuffer> getData()
QUERY_PARAMETERS
to pass
the data in JSON format. The default value is an empty List
.data
.public ExecuteSqlRequest setData(List<ByteBuffer> data)
QUERY_PARAMETERS
to pass
the data in JSON format. The default value is an empty List
.data
- The new value for data
.this
to mimic the builder pattern.public Map<String,String> getOptions()
COST_BASED_OPTIMIZATION
:
If FALSE
, disables the cost-based
optimization of the given query.
Supported values:
The default value is FALSE
.
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.
Supported values:
The default value is 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.
Supported values:
The default value is FALSE
.
IGNORE_EXISTING_PK
: Specifies
the record collision error-suppression policy for inserting into
or updating a table with a primary key, only used when primary key record
collisions are rejected (UPDATE_ON_EXISTING_PK
is FALSE
). If set
to TRUE
, any record insert/update that is
rejected for resulting in a primary key collision with an
existing table record will be ignored with no error generated.
If FALSE
, the rejection of any
insert/update for resulting in a primary key collision will
cause an error to be reported. If the specified table does not
have a primary key or if UPDATE_ON_EXISTING_PK
is TRUE
, then this
option has no effect.
Supported values:
TRUE
: Ignore inserts/updates that
result in primary key collisions with existing records
FALSE
: Treat as errors any
inserts/updates that result in primary key collisions
with existing records
FALSE
.
LATE_MATERIALIZATION
: If
TRUE
, Joins/Filters results will always be
materialized ( saved to result tables format).
Supported values:
The default value is 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.
PARALLEL_EXECUTION
: If FALSE
, disables the parallel step execution of
the given query.
Supported values:
The default value is TRUE
.
PLAN_CACHE
: If FALSE
, disables plan caching for the given query.
Supported values:
The default value is TRUE
.
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.
Supported values:
The default value is FALSE
.
PRESERVE_DICT_ENCODING
:
If TRUE
, then columns that were dict
encoded in the source table will be dict encoded in the
projection table.
Supported values:
The default value is TRUE
.
QUERY_PARAMETERS
: Query
parameters in JSON array or arrays (for inserting multiple
rows). This can be used instead of data
and
requestSchemaStr
.
RESULTS_CACHING
: If FALSE
, disables caching of the results of the
given query.
Supported values:
The default value is TRUE
.
RULE_BASED_OPTIMIZATION
:
If FALSE
, disables rule-based rewrite
optimizations for the given query.
Supported values:
The default value is TRUE
.
SSQ_OPTIMIZATION
: If FALSE
, scalar subqueries will be translated into
joins.
Supported values:
The default value is TRUE
.
TTL
: Sets the TTL of
the intermediate result tables used in query execution.
UPDATE_ON_EXISTING_PK
:
Specifies the record collision policy for inserting into or
updating a table with a primary key. If set to TRUE
, any existing table record with primary key values that
match those of a record being inserted or updated will be
replaced by that record. If set to FALSE
,
any such primary key collision will result in the insert/update
being rejected and the error handled as determined by IGNORE_EXISTING_PK
. If the
specified table does not have a primary key, then this option
has no effect.
Supported values:
TRUE
: Replace the collided-into
record with the record inserted or updated when a
new/modified record causes a primary key collision with
an existing record
FALSE
: Reject the insert or update
when it results in a primary key collision with an
existing record
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:
The default value is TRUE
.
CURRENT_SCHEMA
: Use the supplied
value as the default schema when processing this SQL
command.
Map
.options
.public ExecuteSqlRequest setOptions(Map<String,String> options)
COST_BASED_OPTIMIZATION
:
If FALSE
, disables the cost-based
optimization of the given query.
Supported values:
The default value is FALSE
.
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.
Supported values:
The default value is 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.
Supported values:
The default value is FALSE
.
IGNORE_EXISTING_PK
: Specifies
the record collision error-suppression policy for inserting into
or updating a table with a primary key, only used when primary key record
collisions are rejected (UPDATE_ON_EXISTING_PK
is FALSE
). If set
to TRUE
, any record insert/update that is
rejected for resulting in a primary key collision with an
existing table record will be ignored with no error generated.
If FALSE
, the rejection of any
insert/update for resulting in a primary key collision will
cause an error to be reported. If the specified table does not
have a primary key or if UPDATE_ON_EXISTING_PK
is TRUE
, then this
option has no effect.
Supported values:
TRUE
: Ignore inserts/updates that
result in primary key collisions with existing records
FALSE
: Treat as errors any
inserts/updates that result in primary key collisions
with existing records
FALSE
.
LATE_MATERIALIZATION
: If
TRUE
, Joins/Filters results will always be
materialized ( saved to result tables format).
Supported values:
The default value is 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.
PARALLEL_EXECUTION
: If FALSE
, disables the parallel step execution of
the given query.
Supported values:
The default value is TRUE
.
PLAN_CACHE
: If FALSE
, disables plan caching for the given query.
Supported values:
The default value is TRUE
.
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.
Supported values:
The default value is FALSE
.
PRESERVE_DICT_ENCODING
:
If TRUE
, then columns that were dict
encoded in the source table will be dict encoded in the
projection table.
Supported values:
The default value is TRUE
.
QUERY_PARAMETERS
: Query
parameters in JSON array or arrays (for inserting multiple
rows). This can be used instead of data
and
requestSchemaStr
.
RESULTS_CACHING
: If FALSE
, disables caching of the results of the
given query.
Supported values:
The default value is TRUE
.
RULE_BASED_OPTIMIZATION
:
If FALSE
, disables rule-based rewrite
optimizations for the given query.
Supported values:
The default value is TRUE
.
SSQ_OPTIMIZATION
: If FALSE
, scalar subqueries will be translated into
joins.
Supported values:
The default value is TRUE
.
TTL
: Sets the TTL of
the intermediate result tables used in query execution.
UPDATE_ON_EXISTING_PK
:
Specifies the record collision policy for inserting into or
updating a table with a primary key. If set to TRUE
, any existing table record with primary key values that
match those of a record being inserted or updated will be
replaced by that record. If set to FALSE
,
any such primary key collision will result in the insert/update
being rejected and the error handled as determined by IGNORE_EXISTING_PK
. If the
specified table does not have a primary key, then this option
has no effect.
Supported values:
TRUE
: Replace the collided-into
record with the record inserted or updated when a
new/modified record causes a primary key collision with
an existing record
FALSE
: Reject the insert or update
when it results in a primary key collision with an
existing record
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:
The default value is TRUE
.
CURRENT_SCHEMA
: Use the supplied
value as the default schema when processing this SQL
command.
Map
.options
- The new value for options
.this
to mimic the builder pattern.public org.apache.avro.Schema getSchema()
getSchema
in interface org.apache.avro.generic.GenericContainer
public Object get(int index)
get
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to getIndexOutOfBoundsException
public void put(int index, Object value)
put
in interface org.apache.avro.generic.IndexedRecord
index
- the position of the field to setvalue
- the value to setIndexOutOfBoundsException
Copyright © 2025. All rights reserved.