use of io.prestosql.sql.planner.plan.UpdateIndexNode in project hetu-core by openlookeng.
the class QueryPlanner method updateIndex.
private PlanBuilder updateIndex(PlanBuilder subPlan, Statement originalStatement) {
if (!(originalStatement instanceof UpdateIndex)) {
return subPlan;
}
// rewrite sub queries
UpdateIndex updateIndex = (UpdateIndex) originalStatement;
Map<String, Type> columnTypes = new HashMap<>();
for (Field field : analysis.getRootScope().getRelationType().getAllFields()) {
columnTypes.put(field.getOriginColumnName().get(), field.getType());
}
Properties indexProperties = new Properties();
for (Property property : updateIndex.getProperties()) {
String key = extractPropertyValue(property.getName());
String val = extractPropertyValue(property.getValue()).toUpperCase(Locale.ENGLISH);
indexProperties.setProperty(key, val);
}
return subPlan.withNewRoot(new UpdateIndexNode(idAllocator.getNextId(), ExchangeNode.gatheringExchange(idAllocator.getNextId(), ExchangeNode.Scope.REMOTE, subPlan.getRoot()), new UpdateIndexMetadata(updateIndex.getIndexName().toString(), indexProperties, session.getUser(), columnTypes)));
}
Aggregations