Search in sources :

Example 1 with DateRestrictingNode

use of com.bakdata.conquery.models.query.queryplan.specific.DateRestrictingNode in project conquery by bakdata.

the class CQDateRestriction method createQueryPlan.

@Override
public QPNode createQueryPlan(QueryPlanContext context, ConceptQueryPlan plan) {
    QPNode childAgg = child.createQueryPlan(context.withDateRestriction(CDateRange.of(dateRange)), plan);
    // insert behind every ValidityDateNode
    Queue<QPNode> openList = new ArrayDeque<>();
    openList.add(childAgg);
    while (!openList.isEmpty()) {
        QPNode current = openList.poll();
        if (current instanceof ValidityDateNode) {
            ValidityDateNode validityDateNode = (ValidityDateNode) current;
            validityDateNode.setChild(new DateRestrictingNode(CDateSet.create(Collections.singleton(CDateRange.of(dateRange))), validityDateNode.getChild()));
        } else if (current instanceof NegatingNode) {
        // we can't push date restrictions past negations
        } else {
            openList.addAll(current.getChildren());
        }
    }
    return childAgg;
}
Also used : NegatingNode(com.bakdata.conquery.models.query.queryplan.specific.NegatingNode) DateRestrictingNode(com.bakdata.conquery.models.query.queryplan.specific.DateRestrictingNode) QPNode(com.bakdata.conquery.models.query.queryplan.QPNode) ValidityDateNode(com.bakdata.conquery.models.query.queryplan.specific.ValidityDateNode) ArrayDeque(java.util.ArrayDeque)

Aggregations

QPNode (com.bakdata.conquery.models.query.queryplan.QPNode)1 DateRestrictingNode (com.bakdata.conquery.models.query.queryplan.specific.DateRestrictingNode)1 NegatingNode (com.bakdata.conquery.models.query.queryplan.specific.NegatingNode)1 ValidityDateNode (com.bakdata.conquery.models.query.queryplan.specific.ValidityDateNode)1 ArrayDeque (java.util.ArrayDeque)1