Class SqlFieldsQueryEx
- java.lang.Object
-
- org.apache.ignite.cache.query.Query<List<?>>
-
- org.apache.ignite.cache.query.SqlFieldsQuery
-
- org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx
-
- All Implemented Interfaces:
Serializable
public final class SqlFieldsQueryEx extends SqlFieldsQuery
SqlFieldsQuerywith experimental and internal features.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.cache.query.SqlFieldsQuery
DFLT_LAZY
-
Fields inherited from class org.apache.ignite.cache.query.Query
DFLT_PAGE_SIZE
-
-
Constructor Summary
Constructors Constructor Description SqlFieldsQueryEx(String sql, Boolean isQry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatchedArgs(Object[] args)Adds batched arguments.List<Object[]>batchedArguments()Returns batched arguments.voidclearBatchedArgs()Clears batched arguments.SqlFieldsQuerycopy()booleanisAutoCommit()booleanisBatched()Checks if query is batched.BooleanisQuery()booleanisSkipReducerOnUpdate()Gets server side update flag.SqlFieldsQueryExsetArgs(Object... args)Sets SQL arguments.voidsetAutoCommit(boolean autoCommit)SqlFieldsQueryExsetCollocated(boolean collocated)Sets flag defining if this query is collocated.SqlFieldsQueryExsetDistributedJoins(boolean distributedJoins)Specify if distributed joins are enabled for this query.SqlFieldsQueryExsetEnforceJoinOrder(boolean enforceJoinOrder)Sets flag to enforce join order of tables in the query.SqlFieldsQueryExsetLocal(boolean loc)Sets whether this query should be executed on local node only.SqlFieldsQueryExsetPageSize(int pageSize)Sets optional page size, if0, then default is used.SqlFieldsQuerysetSkipReducerOnUpdate(boolean skipReducerOnUpdate)Sets server side update flag.SqlFieldsQueryExsetSql(String sql)Sets SQL clause.SqlFieldsQueryExsetTimeout(int timeout, TimeUnit timeUnit)Sets the query execution timeout.-
Methods inherited from class org.apache.ignite.cache.query.SqlFieldsQuery
getArgs, getPartitions, getQueryInitiatorId, getSchema, getSql, getTimeout, getUpdateBatchSize, isCollocated, isDistributedJoins, isEnforceJoinOrder, isLazy, isReplicatedOnly, resetThreadedQueryInitiatorId, setLazy, setPartitions, setQueryInitiatorId, setReplicatedOnly, setSchema, setThreadedQueryInitiatorId, setUpdateBatchSize, threadedQueryInitiatorId, toString
-
Methods inherited from class org.apache.ignite.cache.query.Query
getPageSize, isLocal, prepare
-
-
-
-
Method Detail
-
isQuery
public Boolean isQuery()
- Returns:
- Flag indicating whether this object denotes a query or an update operation.
-
setSql
public SqlFieldsQueryEx setSql(String sql)
Sets SQL clause.- Overrides:
setSqlin classSqlFieldsQuery- Parameters:
sql- SQL clause.- Returns:
thisFor chaining.
-
setArgs
public SqlFieldsQueryEx setArgs(Object... args)
Sets SQL arguments.- Overrides:
setArgsin classSqlFieldsQuery- Parameters:
args- SQL arguments.- Returns:
thisFor chaining.
-
setTimeout
public SqlFieldsQueryEx setTimeout(int timeout, TimeUnit timeUnit)
Sets the query execution timeout. Query will be automatically cancelled if the execution timeout is exceeded.- Overrides:
setTimeoutin classSqlFieldsQuery- Parameters:
timeout- Timeout value. Zero value disables timeout.timeUnit- Time unit.- Returns:
thisFor chaining.
-
setCollocated
public SqlFieldsQueryEx setCollocated(boolean collocated)
Sets flag defining if this query is collocated. Collocation flag is used for optimization purposes of queries with GROUP BY statements. Whenever Ignite executes a distributed query, it sends sub-queries to individual cluster members. If you know in advance that the elements of your query selection are collocated together on the same node and you group by collocated key (primary or affinity key), then Ignite can make significant performance and network optimizations by grouping data on remote nodes.- Overrides:
setCollocatedin classSqlFieldsQuery- Parameters:
collocated- Flag value.- Returns:
thisFor chaining.
-
setEnforceJoinOrder
public SqlFieldsQueryEx setEnforceJoinOrder(boolean enforceJoinOrder)
Sets flag to enforce join order of tables in the query. If set totruequery optimizer will not reorder tables in join. By default isfalse.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.
- Overrides:
setEnforceJoinOrderin classSqlFieldsQuery- Parameters:
enforceJoinOrder- Flag value.- Returns:
thisFor chaining.
-
setDistributedJoins
public SqlFieldsQueryEx setDistributedJoins(boolean distributedJoins)
Specify if distributed joins are enabled for this query.- Overrides:
setDistributedJoinsin classSqlFieldsQuery- Parameters:
distributedJoins- Distributed joins enabled.- Returns:
thisFor chaining.
-
setPageSize
public SqlFieldsQueryEx setPageSize(int pageSize)
Sets optional page size, if0, then default is used.- Overrides:
setPageSizein classSqlFieldsQuery- Parameters:
pageSize- Optional page size.- Returns:
thisfor chaining.
-
setLocal
public SqlFieldsQueryEx setLocal(boolean loc)
Sets whether this query should be executed on local node only.- Overrides:
setLocalin classSqlFieldsQuery- Parameters:
loc- Local flag.- Returns:
thisfor chaining.
-
setSkipReducerOnUpdate
public SqlFieldsQuery setSkipReducerOnUpdate(boolean skipReducerOnUpdate)
Sets server side update flag.By default, when processing DML command, Ignite first fetches all affected intermediate rows for analysis to the node which initiated the query and only then forms batches of updated values to be sent to remote nodes. For simple DML commands (that however affect great deal of rows) such approach may be an overkill in terms of network delays and memory usage on initiating node. Use this flag as hint for Ignite to do all intermediate rows analysis and updates in place on corresponding remote data nodes.
There are limitations to what DML command can be optimized this way. The command containing LIMIT, OFFSET, DISTINCT, ORDER BY, GROUP BY, sub-query or UNION will be processed the usual way despite this flag setting.
Defaults to
false, meaning that intermediate results will be fetched to initiating node first. Only affects DML commands. Ignored whenQuery.isLocal()istrue. Note that when set totrue, the query may fail in the case of even single node failure.- Parameters:
skipReducerOnUpdate- Server side update flag.- Returns:
thisFor chaining.
-
isSkipReducerOnUpdate
public boolean isSkipReducerOnUpdate()
Gets server side update flag.See
setSkipReducerOnUpdate(boolean)for more information.- Returns:
- Server side update flag.
-
isAutoCommit
public boolean isAutoCommit()
- Returns:
- Auto commit flag.
-
setAutoCommit
public void setAutoCommit(boolean autoCommit)
- Parameters:
autoCommit- Auto commit flag.
-
copy
public SqlFieldsQuery copy()
- Overrides:
copyin classSqlFieldsQuery- Returns:
- Copy of this query.
-
addBatchedArgs
public void addBatchedArgs(Object[] args)
Adds batched arguments.- Parameters:
args- Batched arguments.
-
clearBatchedArgs
public void clearBatchedArgs()
Clears batched arguments.
-
batchedArguments
public List<Object[]> batchedArguments()
Returns batched arguments.- Returns:
- Batched arguments.
-
isBatched
public boolean isBatched()
Checks if query is batched.- Returns:
Trueif batched.
-
-