use of org.apache.ignite.internal.sql.optimizer.affinity.PartitionTableModel in project ignite by apache.
the class PartitionExtractor method prepareTableModel.
/**
* Prepare table model.
*
* @param from FROM clause.
* @return Join model.
*/
private PartitionTableModel prepareTableModel(GridSqlAst from) {
PartitionTableModel res = new PartitionTableModel();
prepareTableModel0(from, res);
return res;
}
use of org.apache.ignite.internal.sql.optimizer.affinity.PartitionTableModel in project ignite by apache.
the class PartitionExtractor method extract.
/**
* Extract partitions.
*
* @param qry Query.
* @return Partitions.
*/
public PartitionResult extract(GridSqlQuery qry) throws IgniteCheckedException {
// No unions support yet.
if (!(qry instanceof GridSqlSelect))
return null;
GridSqlSelect select = (GridSqlSelect) qry;
// Prepare table model.
PartitionTableModel tblModel = prepareTableModel(select.from());
// Do extract.
PartitionNode tree = extractFromExpression(select.where(), tblModel, false);
assert tree != null;
// Reduce tree if possible.
tree = tree.optimize();
if (tree instanceof PartitionAllNode)
return null;
// Done.
return new PartitionResult(tree, tblModel.joinGroupAffinity(tree.joinGroup()), ctx.cache().context().exchange().readyAffinityVersion());
}
Aggregations