org.apache.ignite.internal.processors.cache.query

## 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

`SqlFieldsQuery` with experimental and internal features.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.cache.query.Query

`DFLT_PAGE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`SqlFieldsQueryEx(String sql, Boolean isQry)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addBatchedArgs(Object[] args)` Adds batched arguments.
`List<Object[]>` `batchedArguments()` Returns batched arguments.
`void` `clearBatchedArgs()` Clears batched arguments.
`SqlFieldsQuery` `copy()`
`boolean` `isBatched()` Checks if query is batched.
`Boolean` `isQuery()`
`boolean` `isSkipReducerOnUpdate()` Gets server side update flag.
`SqlFieldsQueryEx` `setArgs(Object... args)` Sets SQL arguments.
`SqlFieldsQueryEx` `setCollocated(boolean collocated)` Sets flag defining if this query is collocated.
`SqlFieldsQueryEx` `setDistributedJoins(boolean distributedJoins)` Specify if distributed joins are enabled for this query.
`SqlFieldsQueryEx` `setEnforceJoinOrder(boolean enforceJoinOrder)` Sets flag to enforce join order of tables in the query.
`SqlFieldsQueryEx` `setLocal(boolean loc)` Sets whether this query should be executed on local node only.
`SqlFieldsQueryEx` `setPageSize(int pageSize)` Sets optional page size, if `0`, then default is used.
`SqlFieldsQuery` `setSkipReducerOnUpdate(boolean skipReducerOnUpdate)` Sets server side update flag.
`SqlFieldsQueryEx` `setSql(String sql)` Sets SQL clause.
`SqlFieldsQueryEx` `setTimeout(int timeout, TimeUnit timeUnit)` Sets the query execution timeout.

### Methods inherited from class org.apache.ignite.cache.query.SqlFieldsQuery

`getArgs, getPartitions, getSchema, getSql, getTimeout, isCollocated, isDistributedJoins, isEnforceJoinOrder, isLazy, isReplicatedOnly, setLazy, setPartitions, setReplicatedOnly, setSchema, toString`

### Methods inherited from class org.apache.ignite.cache.query.Query

`getPageSize, isLocal, prepare`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SqlFieldsQueryEx

    public SqlFieldsQueryEx(String sql,
                            Boolean isQry)

Parameters:
  `sql` - SQL query.
  `isQry` - Flag indicating whether this object denotes a query or an update operation.

### 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:
  `setSql` in class `SqlFieldsQuery`
Parameters:
  `sql` - SQL clause.
Returns:
  `this` For chaining.

#### setArgs

    public SqlFieldsQueryEx setArgs(Object... args)

Sets SQL arguments.

Overrides:
  `setArgs` in class `SqlFieldsQuery`
Parameters:
  `args` - SQL arguments.
Returns:
  `this` For 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:
  `setTimeout` in class `SqlFieldsQuery`
Parameters:
  `timeout` - Timeout value. Zero value disables timeout.
  `timeUnit` - Time unit.
Returns:
  `this` For 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:
  `setCollocated` in class `SqlFieldsQuery`
Parameters:
  `collocated` - Flag value.
Returns:
  `this` For chaining.

#### setEnforceJoinOrder

    public SqlFieldsQueryEx setEnforceJoinOrder(boolean enforceJoinOrder)

Sets flag to enforce join order of tables in the query. If set to `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.

Overrides:
  `setEnforceJoinOrder` in class `SqlFieldsQuery`
Parameters:
  `enforceJoinOrder` - Flag value.
Returns:
  `this` For chaining.

#### setDistributedJoins

    public SqlFieldsQueryEx setDistributedJoins(boolean distributedJoins)

Specify if distributed joins are enabled for this query.

Overrides:
  `setDistributedJoins` in class `SqlFieldsQuery`
Parameters:
  `distributedJoins` - Distributed joins enabled.
Returns:
  `this` For chaining.

#### setPageSize

    public SqlFieldsQueryEx setPageSize(int pageSize)

Sets optional page size, if `0`, then default is used.

Overrides:
  `setPageSize` in class `SqlFieldsQuery`
Parameters:
  `pageSize` - Optional page size.
Returns:
  `this` for chaining.

#### setLocal

    public SqlFieldsQueryEx setLocal(boolean loc)

Sets whether this query should be executed on local node only.

Overrides:
  `setLocal` in class `SqlFieldsQuery`
Parameters:
  `loc` - Local flag.
Returns:
  `this` for 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 when `Query.isLocal()` is `true`. Note that when set to `true`, the query may fail in the case of even single node failure.

Parameters:
  `skipReducerOnUpdate` - Server side update flag.
Returns:
  `this` For chaining.

#### isSkipReducerOnUpdate

    public boolean isSkipReducerOnUpdate()

Gets server side update flag.

See `setSkipReducerOnUpdate(boolean)` for more information.

Returns:
  Server side update flag.

#### copy

    public SqlFieldsQuery copy()

Overrides:
  `copy` in class `SqlFieldsQuery`
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:
  `True` if batched.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.6.0
Release Date | : July 10 2018