use of org.apache.ignite.internal.sql.engine.metadata.FragmentMappingException in project ignite-3 by apache.
the class QueryTemplate method map.
/**
* Map.
* TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public ExecutionPlan map(MappingService mappingService, MappingQueryContext ctx) {
ExecutionPlan executionPlan = this.executionPlan.get();
if (executionPlan != null && Objects.equals(executionPlan.topologyVersion(), ctx.topologyVersion())) {
return executionPlan;
}
List<Fragment> fragments = Commons.transform(this.fragments, fragment -> fragment.attach(ctx.cluster()));
Exception ex = null;
RelMetadataQuery mq = first(fragments).root().getCluster().getMetadataQuery();
for (int i = 0; i < 3; i++) {
try {
ExecutionPlan executionPlan0 = new ExecutionPlan(ctx.topologyVersion(), map(mappingService, fragments, ctx, mq));
if (executionPlan == null || executionPlan.topologyVersion() < executionPlan0.topologyVersion()) {
this.executionPlan.compareAndSet(executionPlan, executionPlan0);
}
return executionPlan0;
} catch (FragmentMappingException e) {
if (ex == null) {
ex = e;
} else {
ex.addSuppressed(e);
}
fragments = replace(fragments, e.fragment(), new FragmentSplitter(e.node()).go(e.fragment()));
}
}
throw new IgniteException("Failed to map query.", ex);
}
Aggregations