public class SqlFieldsQuery extends Query<List<?>>
'select'
clause, as opposed to SqlQuery
, which always returns
the whole key and value objects back.
For example, in case of Word-Count example, we know that all identical words
are processed on the same cluster member, because we use the word
itself
as affinity key. This allows Ignite to execute the 'limit'
clause on
the remote nodes and bring back only the small data set specified within the 'limit' clause,
instead of the whole query result as would happen in a non-collocated execution.
IgniteCache.query(Query)
,
Serialized FormDFLT_PAGE_SIZE
Constructor and Description |
---|
SqlFieldsQuery(SqlFieldsQuery qry)
Copy constructs SQL fields query.
|
SqlFieldsQuery(String sql)
Constructs SQL fields query.
|
SqlFieldsQuery(String sql,
boolean collocated)
Constructs SQL fields query.
|
Modifier and Type | Method and Description |
---|---|
SqlFieldsQuery |
copy() |
Object[] |
getArgs()
Gets SQL arguments.
|
@Nullable int[] |
getPartitions()
Gets partitions for query, in ascending order.
|
@Nullable String |
getSchema()
Get schema for the query.
|
String |
getSql()
Gets SQL clause.
|
int |
getTimeout()
Gets the query execution timeout in milliseconds.
|
boolean |
isCollocated()
Checks if this query is collocated.
|
boolean |
isDistributedJoins()
Check if distributed joins are enabled for this query.
|
boolean |
isEnforceJoinOrder()
Checks if join order of tables if enforced.
|
boolean |
isLazy()
Gets lazy query execution flag.
|
boolean |
isReplicatedOnly()
Deprecated.
No longer used as of Apache Ignite 2.8.
|
SqlFieldsQuery |
setArgs(Object... args)
Sets SQL arguments.
|
SqlFieldsQuery |
setCollocated(boolean collocated)
Sets flag defining if this query is collocated.
|
SqlFieldsQuery |
setDistributedJoins(boolean distributedJoins)
Specify if distributed joins are enabled for this query.
|
SqlFieldsQuery |
setEnforceJoinOrder(boolean enforceJoinOrder)
Sets flag to enforce join order of tables in the query.
|
SqlFieldsQuery |
setLazy(boolean lazy)
Sets lazy query execution flag.
|
SqlFieldsQuery |
setLocal(boolean loc)
Sets whether this query should be executed on local node only.
|
SqlFieldsQuery |
setPageSize(int pageSize)
Sets optional page size, if
0 , then default is used. |
SqlFieldsQuery |
setPartitions(int... parts)
Sets partitions for a query.
|
SqlFieldsQuery |
setReplicatedOnly(boolean replicatedOnly)
Deprecated.
No longer used as of Apache Ignite 2.8.
|
SqlFieldsQuery |
setSchema(@Nullable String schema)
Set schema for the query.
|
SqlFieldsQuery |
setSql(String sql)
Sets SQL clause.
|
SqlFieldsQuery |
setTimeout(int timeout,
TimeUnit timeUnit)
Sets the query execution timeout.
|
String |
toString() |
getPageSize, isLocal, prepare
public SqlFieldsQuery(SqlFieldsQuery qry)
qry
- SQL query.public SqlFieldsQuery(String sql)
sql
- SQL query.public SqlFieldsQuery(String sql, boolean collocated)
sql
- SQL query.collocated
- Collocated flag.public String getSql()
public SqlFieldsQuery setSql(String sql)
sql
- SQL clause.this
For chaining.public Object[] getArgs()
public SqlFieldsQuery setArgs(Object... args)
args
- SQL arguments.this
For chaining.public int getTimeout()
public SqlFieldsQuery setTimeout(int timeout, TimeUnit timeUnit)
timeout
- Timeout value. Zero value disables timeout.timeUnit
- Time unit.this
For chaining.public boolean isCollocated()
true
If the query is collocated.public SqlFieldsQuery setCollocated(boolean collocated)
collocated
- Flag value.this
For chaining.public boolean isEnforceJoinOrder()
public SqlFieldsQuery setEnforceJoinOrder(boolean enforceJoinOrder)
true
query optimizer will not reorder tables in join. By default is false
.
It is not recommended to enable this property until you are sure that your indexes and the query itself are correct and tuned as much as possible but query optimizer still produces wrong join order.
enforceJoinOrder
- Flag value.this
For chaining.public SqlFieldsQuery setDistributedJoins(boolean distributedJoins)
distributedJoins
- Distributed joins enabled.this
For chaining.public boolean isDistributedJoins()
true
If distributed joins enabled.public SqlFieldsQuery setPageSize(int pageSize)
0
, then default is used.setPageSize
in class Query<List<?>>
pageSize
- Optional page size.this
for chaining.public SqlFieldsQuery setLocal(boolean loc)
@Deprecated public SqlFieldsQuery setReplicatedOnly(boolean replicatedOnly)
replicatedOnly
- The query contains only replicated tables.this
For chaining.@Deprecated public boolean isReplicatedOnly()
true
If the query contains only replicated tables.public SqlFieldsQuery setLazy(boolean lazy)
By default Ignite attempts to fetch the whole query result set to memory and send it to the client. For small and medium result sets this provides optimal performance and minimize duration of internal database locks, thus increasing concurrency.
If result set is too big to fit in available memory this could lead to excessive GC pauses and even OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory consumption at the cost of moderate performance hit.
Defaults to false
, meaning that the whole result set is fetched to memory eagerly.
lazy
- Lazy query execution flag.this
For chaining.public boolean isLazy()
See setLazy(boolean)
for more information.
@Nullable public @Nullable int[] getPartitions()
public SqlFieldsQuery setPartitions(@Nullable int... parts)
Note what passed array'll be sorted in place for performance reasons, if it wasn't sorted yet.
parts
- Partitions.this
for chaining.@Nullable public @Nullable String getSchema()
public SqlFieldsQuery setSchema(@Nullable @Nullable String schema)
schema
- Schema. Null to unset schema.this
for chaining.public SqlFieldsQuery copy()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019