use of org.apache.rya.indexing.KeyParts in project incubator-rya by apache.
the class AccumuloTemporalIndexer method queryInstantBeforeInstant.
/**
* get statements where the db row ID is BEFORE the given queryInstant.
*/
@Override
public CloseableIteration<Statement, QueryEvaluationException> queryInstantBeforeInstant(final TemporalInstant queryInstant, final StatementConstraints constraints) throws QueryEvaluationException {
// get rows where the repository time is before the given time.
final Query query = new Query() {
@Override
public Range getRange(final KeyParts keyParts) {
Text start = null;
if (keyParts.constraintPrefix != null) {
// <-- start specific logic
start = keyParts.constraintPrefix;
} else {
start = new Text(KeyParts.HASH_PREFIX_FOLLOWING);
}
// <-- end specific logic
final Text endAt = keyParts.getQueryKey();
// System.out.println("Scanning queryInstantBeforeInstant: from:" + KeyParts.toHumanString(start) + " up to:" + KeyParts.toHumanString(endAt));
return new Range(start, true, endAt, false);
}
};
final ScannerBase scanner = query.doQuery(queryInstant, constraints);
return getContextIteratorWrapper(scanner, constraints.getContext());
}
Aggregations