@Override
public Iterator<ResultRowImpl> getRows() {
prepare();
if (explain) {
String plan = getPlan();
columns = new ColumnImpl[] { new ColumnImpl("explain", "plan", "plan")};
ResultRowImpl r = new ResultRowImpl(this,
Tree.EMPTY_ARRAY,
new PropertyValue[] { PropertyValues.newString(plan)},
null);
return Arrays.asList(r).iterator();
}
if (LOG.isDebugEnabled()) {
LOG.debug("query execute {} ", statement);
LOG.debug("query plan {}", getPlan());
}
RowIterator rowIt = new RowIterator(context.getBaseState());
Comparator<ResultRowImpl> orderBy = ResultRowImpl.getComparator(orderings);
Iterator<ResultRowImpl> it =
FilterIterators.newCombinedFilter(rowIt, distinct, limit, offset, orderBy);
if (measure) {
// run the query
while (it.hasNext()) {
it.next();
}
columns = new ColumnImpl[] {
new ColumnImpl("measure", "selector", "selector"),
new ColumnImpl("measure", "scanCount", "scanCount")
};
ArrayList<ResultRowImpl> list = new ArrayList<ResultRowImpl>();
ResultRowImpl r = new ResultRowImpl(this,
Tree.EMPTY_ARRAY,
new PropertyValue[] {