Table targetTable = m_parsedUpdate.m_tableList.get(0);
updateNode.setTargetTableName(targetTable.getTypeName());
// set this to false until proven otherwise
updateNode.setUpdateIndexes(false);
ProjectionPlanNode projectionNode = new ProjectionPlanNode();
TupleAddressExpression tae = new TupleAddressExpression();
NodeSchema proj_schema = new NodeSchema();
// This planner-generated column is magic.
proj_schema.addColumn(new SchemaColumn("VOLT_TEMP_TABLE",
"VOLT_TEMP_TABLE",
"tuple_address",
"tuple_address",
tae));
// get the set of columns affected by indexes
Set<String> affectedColumns = getIndexedColumnSetForTable(targetTable);
// add the output columns we need to the projection
//
// Right now, the EE is going to use the original column names
// and compare these to the persistent table column names in the
// update executor in order to figure out which table columns get
// updated. We'll associate the actual values with VOLT_TEMP_TABLE
// to avoid any false schema/column matches with the actual table.
for (Entry<Column, AbstractExpression> col : m_parsedUpdate.columns.entrySet()) {
String tableName = col.getKey().getTypeName();
AbstractExpression expr = col.getValue();
expr.setInBytes(col.getKey().getInbytes());
proj_schema.addColumn(new SchemaColumn("VOLT_TEMP_TABLE",
"VOLT_TEMP_TABLE",
tableName,
tableName,
expr));
// check if this column is an indexed column
if (affectedColumns.contains(col.getKey().getTypeName()))
{
updateNode.setUpdateIndexes(true);
}
}
projectionNode.setOutputSchema(proj_schema);
// add the projection inline (TODO: this will break if more than one
// layer is below this)
//