use of org.apache.cassandra.fqltool.ResultHandler in project cassandra by apache.
the class Compare method compare.
public static void compare(String querylog, List<String> arguments) {
List<ChronicleQueue> readQueues = null;
try (ResultHandler rh = new ResultHandler(arguments, null, null);
ChronicleQueue queryQ = SingleChronicleQueueBuilder.single(querylog).readOnly(true).build();
FQLQueryIterator queries = new FQLQueryIterator(queryQ.createTailer(), 1)) {
readQueues = arguments.stream().map(s -> SingleChronicleQueueBuilder.single(s).readOnly(true).build()).collect(Collectors.toList());
List<Iterator<ResultHandler.ComparableResultSet>> its = readQueues.stream().map(q -> new StoredResultSetIterator(q.createTailer())).collect(Collectors.toList());
while (queries.hasNext()) rh.handleResults(queries.next(), resultSets(its));
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (readQueues != null)
readQueues.forEach(Closeable::close);
}
}
Aggregations