throw new IOException("Not match primary key.");
}
byte[] primayKey = RowBuilder.build().genRowkey(primaryKeyPairs);
UpdateAction action = new UpdateAction(fTableName, primayKey);
// Parse Update Item
List<SQLUpdateSetItem> updateItems = sqlUpdateStatement.getItems();
for (SQLUpdateSetItem updateItem : updateItems) {
String columnName = parseColumn(updateItem.getColumn());
// check this FTable has the column and not pk
metaEventOperation.checkFieldNotInPrimaryKeys(table, columnName);
Field field = table.getColumn(columnName);
// Check the input is the same as DataType
checkType(field, updateItem.getValue());
byte[] value = convert(field, updateItem.getValue());
String familyName = metaEventOperation.getColumnFamily(fTableName,
columnName);
action.addEntityColumn(fTableName, familyName, columnName,
field.getType(), value);
}
if (context.isGenWholePlan()) {
Condition entityGroupKeyCondition = ParserUtils.getCondition(table
.getEntityGroupKey().getName(), conditions);
// Get entityGroupLocation according to entity group key
EntityGroupLocation entityGroupLocation = this.connection
.locateEntityGroup(Bytes.toBytes(table.getTableName()), DruidParser
.convert(table.getColumn(entityGroupKeyCondition.getFieldName()),
entityGroupKeyCondition.getValue()));
action.setEntityGroupLocation(entityGroupLocation);
}
action.setSessionId(context.getSessionId());
List<UpdateAction> actions = new ArrayList<UpdateAction>();
actions.add(action);
UpdatePlan plan = new UpdatePlan(actions);
context.setPlan(plan);
LOG.debug("UpdatePlan " + plan);