Package com.twilio.kudu.sql.mutation
Class MutationState
- java.lang.Object
-
- com.twilio.kudu.sql.mutation.MutationState
-
- Direct Known Subclasses:
CubeMutationState
public class MutationState extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected CalciteModifiableKuduTable
calciteModifiableKuduTable
protected org.apache.kudu.client.KuduTable
kuduTable
protected org.apache.kudu.client.KuduSession
session
-
Constructor Summary
Constructors Constructor Description MutationState(CalciteModifiableKuduTable calciteModifiableKuduTable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears the cube mutation state (and thus frees up memory)void
flush()
int
mutateRow(List<Integer> columnIndexes, List<Object> values)
Mutate Kudu table usingObject
.int
mutateTuples(List<Integer> columnIndexes, List<List<org.apache.calcite.rex.RexLiteral>> tuples)
Mutate Kudu table usingRexLiteral
.protected void
updateMutationState(Map<Integer,Object> colIndexToValueMap)
Creates a mutation for the row being inserted and adds it to the kudu session.
-
-
-
Field Detail
-
calciteModifiableKuduTable
protected final CalciteModifiableKuduTable calciteModifiableKuduTable
-
kuduTable
protected final org.apache.kudu.client.KuduTable kuduTable
-
session
protected final org.apache.kudu.client.KuduSession session
-
-
Constructor Detail
-
MutationState
public MutationState(CalciteModifiableKuduTable calciteModifiableKuduTable)
-
-
Method Detail
-
mutateTuples
public int mutateTuples(List<Integer> columnIndexes, List<List<org.apache.calcite.rex.RexLiteral>> tuples)
Mutate Kudu table usingRexLiteral
. Called while using a regular Statement- Parameters:
columnIndexes
- the kudu indexes to mutatetuples
- a collection of rows to insert- Returns:
- number of rows inserted
-
mutateRow
public int mutateRow(List<Integer> columnIndexes, List<Object> values)
Mutate Kudu table usingObject
.- Parameters:
columnIndexes
- the kudu indexes to mutatevalues
- a collection of rows to insert- Returns:
- number of rows inserted
-
updateMutationState
protected void updateMutationState(Map<Integer,Object> colIndexToValueMap)
Creates a mutation for the row being inserted and adds it to the kudu session. Also callsupdateMutationState()
for all cube tables (if any exist).- Parameters:
colIndexToValueMap
- Kudu index to new value mapping
-
flush
public void flush()
-
clear
public void clear()
Clears the cube mutation state (and thus frees up memory)
-
-