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;
}
Aggregations