[ https://issues.apache.org/jira/browse/RYA-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125933#comment-16125933 ]
ASF GitHub Bot commented on RYA-337: ------------------------------------ Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/204#discussion_r132990636 --- Diff: dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/MongoDBQueryEngine.java --- @@ -140,72 +121,35 @@ public MongoDBRdfConfiguration getConf() { public CloseableIteration<RyaStatement, RyaDAOException> batchQuery( final Collection<RyaStatement> stmts, MongoDBRdfConfiguration conf) throws RyaDAOException { - if (conf == null) { - conf = configuration; - } - final Long maxResults = conf.getLimit(); - final Set<DBObject> queries = new HashSet<DBObject>(); - - try { - for (final RyaStatement stmt : stmts) { - queries.add( strategy.getQuery(stmt)); - } + final Map<RyaStatement, BindingSet> queries = new HashMap<>(); - // TODO not sure what to do about regex ranges? - final RyaStatementCursorIterator iterator = new RyaStatementCursorIterator(getCollection(conf), queries, - strategy, configuration.getAuthorizations()); - - if (maxResults != null) { - iterator.setMaxResults(maxResults); - } - return iterator; - } catch (final Exception e) { - throw new RyaDAOException(e); + for (final RyaStatement stmt : stmts) { + queries.put(stmt, new MapBindingSet()); } + return new RyaStatementCursorIterator(queryWithBindingSet(queries.entrySet(), conf)); } + @Override public CloseableIterable<RyaStatement> query(final RyaQuery ryaQuery) throws RyaDAOException { - final Set<DBObject> queries = new HashSet<DBObject>(); - - try { - queries.add( strategy.getQuery(ryaQuery)); - - // TODO not sure what to do about regex ranges? - // TODO this is gross - final RyaStatementCursorIterable iterator = new RyaStatementCursorIterable( - new NonCloseableRyaStatementCursorIterator(new RyaStatementCursorIterator(getCollection(getConf()), - queries, strategy, configuration.getAuthorizations()))); - - return iterator; - } catch (final Exception e) { - throw new RyaDAOException(e); - } + return query(new BatchRyaQuery(Collections.singleton(ryaQuery.getQuery()))); --- End diff -- Null check > Batch Queries to MongoDB > ------------------------ > > Key: RYA-337 > URL: https://issues.apache.org/jira/browse/RYA-337 > Project: Rya > Issue Type: Improvement > Components: dao > Reporter: Aaron Mihalik > Assignee: Aaron Mihalik > > Currently the MongoDB DAO sends one query at a time to Mongo. Instead, the > DAO should send a batch of queries and perform a client side hash join (like > the Accumulo DAO) -- This message was sent by Atlassian JIRA (v6.4.14#64029)