Class UpdatePlan
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan
-
public final class UpdatePlan extends Object
Update plan - where to take data to update cache from and how to construct new keys and values, if needed.
-
-
Constructor Summary
Constructors Constructor Description UpdatePlan(UpdateMode mode, GridH2Table tbl, String[] colNames, int[] colTypes, KeyValueSupplier keySupplier, KeyValueSupplier valSupplier, int keyColIdx, int valColIdx, String selectQry, boolean isLocSubqry, List<List<DmlArgument>> rows, int rowsNum, @Nullable FastUpdate fastUpdate, @Nullable DmlDistributedPlanInfo distributed, boolean canSelectBeLazy, boolean fillAbsentPKsWithDefaults)Constructor.UpdatePlan(UpdateMode mode, GridH2Table tbl, String selectQry, @Nullable FastUpdate fastUpdate, @Nullable DmlDistributedPlanInfo distributed)Constructor for delete operation or fast update.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GridCacheContextcacheContext()booleancanSelectBeLazy()List<List<?>>createRows(Object[] args)Extract rows from plan without performing any query.List<List<List<?>>>createRows(List<Object[]> argss)Extract rows from plan without performing any query.@Nullable DmlDistributedPlanInfodistributedPlan()booleanhasRows()booleanisLocalSubquery()UpdateModemode()UpdateResultprocessFast(Object[] args)Process fast DML operation if possible.IgniteBiTuple<?,?>processRow(List<?> row)Convert a row into key-value pair.T3<Object,Object,Object>processRowForUpdate(List<?> row)Convert a row into value.introwCount()StringselectQuery()
-
-
-
Constructor Detail
-
UpdatePlan
public UpdatePlan(UpdateMode mode, GridH2Table tbl, String[] colNames, int[] colTypes, KeyValueSupplier keySupplier, KeyValueSupplier valSupplier, int keyColIdx, int valColIdx, String selectQry, boolean isLocSubqry, List<List<DmlArgument>> rows, int rowsNum, @Nullable @Nullable FastUpdate fastUpdate, @Nullable @Nullable DmlDistributedPlanInfo distributed, boolean canSelectBeLazy, boolean fillAbsentPKsWithDefaults)
Constructor.- Parameters:
mode- Mode.tbl- Table.colNames- Column names.colTypes- Column types.keySupplier- Key supplier.valSupplier- Value supplier.keyColIdx- Key column index.valColIdx- value column index.selectQry- Select query.isLocSubqry- Local subquery flag.rows- Rows for query-less INSERT or MERGE.rowsNum- Rows number.fastUpdate- Fast update (if any).distributed- Distributed plan (if any)fillAbsentPKsWithDefaults- Fills absent PKs with nulls or defaults setting.
-
UpdatePlan
public UpdatePlan(UpdateMode mode, GridH2Table tbl, String selectQry, @Nullable @Nullable FastUpdate fastUpdate, @Nullable @Nullable DmlDistributedPlanInfo distributed)
Constructor for delete operation or fast update.- Parameters:
mode- Mode.tbl- Table.selectQry- Select query.fastUpdate- Fast update arguments (if any).distributed- Distributed plan (if any)
-
-
Method Detail
-
processRow
public IgniteBiTuple<?,?> processRow(List<?> row) throws IgniteCheckedException
Convert a row into key-value pair.- Parameters:
row- Row to process.- Throws:
IgniteCheckedException- if failed.
-
processRowForUpdate
public T3<Object,Object,Object> processRowForUpdate(List<?> row) throws IgniteCheckedException
Convert a row into value.- Parameters:
row- Row to process.- Returns:
- Tuple contains: [key, old value, new value]
- Throws:
IgniteCheckedException- if failed.
-
processFast
public UpdateResult processFast(Object[] args) throws IgniteCheckedException
Process fast DML operation if possible.- Parameters:
args- QUery arguments.- Returns:
- Update result or
nullif fast update is not applicable for plan. - Throws:
IgniteCheckedException- If failed.
-
hasRows
public boolean hasRows()
- Returns:
Trueif predefined rows exist.
-
createRows
public List<List<?>> createRows(Object[] args) throws IgniteCheckedException
Extract rows from plan without performing any query.- Parameters:
args- Original query arguments.- Returns:
Listof rows from the plan for a single query. For example, if we have multiple args in a query:
INSERT INTO person VALUES (k1, v1), (k2, v2), (k3, v3);
we will get aListofListwith items{[k1, v1], [k2, v2], [k3, v3]}.- Throws:
IgniteCheckedException- if failed.
-
createRows
public List<List<List<?>>> createRows(List<Object[]> argss) throws IgniteCheckedException
Extract rows from plan without performing any query.- Parameters:
argss- Batch of arguments.- Returns:
Listof rows from the plan for each query. For example, if we have a batch of queries with multiple args:
INSERT INTO person VALUES (k1, v1), (k2, v2), (k3, v3);we will get a
INSERT INTO person VALUES (k4, v4), (k5, v5), (k6, v6);
ListofListofListwith items:
{[k1, v1], [k2, v2], [k3, v3]},
{[k4, v4], [k5, v5], [k6, v6]}- Throws:
IgniteCheckedException- If failed.
-
mode
public UpdateMode mode()
- Returns:
- Update mode.
-
cacheContext
public GridCacheContext cacheContext()
- Returns:
- Cache context.
-
distributedPlan
@Nullable public @Nullable DmlDistributedPlanInfo distributedPlan()
- Returns:
- Distributed plan info (for skip-reducer mode).
-
rowCount
public int rowCount()
- Returns:
- Row count.
-
selectQuery
public String selectQuery()
- Returns:
- Select query.
-
isLocalSubquery
public boolean isLocalSubquery()
- Returns:
- Local subquery flag.
-
canSelectBeLazy
public boolean canSelectBeLazy()
- Returns:
trueis the SELECT query may be executed in lazy mode.
-
-