@Override public boolean useRoundRobinIterator() throws SQLException { return delegate.useRoundRobinIterator(); }
private void addIterator(List<PeekingResultIterator> parentIterators, List<PeekingResultIterator> childIterators) throws SQLException { if (!childIterators.isEmpty()) { if (plan.useRoundRobinIterator()) { /* * When using a round robin iterator we shouldn't concatenate the iterators together. This is because a * round robin iterator should be calling next() on these iterators directly after selecting them in a * round robin fashion. This helps take advantage of loading the underlying scanners' caches in parallel * as well as preventing errors arising out of scanner lease expirations. */ parentIterators.addAll(childIterators); } else { parentIterators.add(ConcatResultIterator.newIterator(childIterators)); } } }
if (plan.useRoundRobinIterator()) { buf.append("ROUND ROBIN ");
private void testForceRowKeyOrder(Connection conn, boolean isSalted) throws SQLException { String tableName = "tablename" + (isSalted ? "_salt" : ""); conn.createStatement().execute("CREATE TABLE " + tableName + " (k1 char(2) not null, k2 varchar not null, k3 integer not null, v varchar, constraint pk primary key(k1,k2,k3))"); String[] queries = { "SELECT 1 FROM " + tableName , "SELECT 1 FROM " + tableName + " WHERE V = 'c'", "SELECT 1 FROM " + tableName + " WHERE (k1, k2, k3) > ('a', 'ab', 1)", }; String query; for (int i = 0; i < queries.length; i++) { query = queries[i]; QueryPlan plan = conn.createStatement().unwrap(PhoenixStatement.class).compileQuery(query); assertFalse("Expected plan to not use round robin iterator " + query, plan.useRoundRobinIterator()); } }
private void testOrderByOrGroupByDoesntUseRoundRobin(Connection conn, boolean salted) throws SQLException { String tableName = "orderbygroupbytable" + (salted ? "_salt" : ""); conn.createStatement().execute("CREATE TABLE " + tableName + " (k1 char(2) not null, k2 varchar not null, k3 integer not null, v varchar, constraint pk primary key(k1,k2,k3))"); String[] queries = { "SELECT 1 FROM " + tableName + " ORDER BY K1", "SELECT 1 FROM " + tableName + " WHERE V = 'c' ORDER BY K1, K2", "SELECT 1 FROM " + tableName + " WHERE V = 'c' ORDER BY K1, K2, K3", "SELECT 1 FROM " + tableName + " WHERE V = 'c' ORDER BY K3", "SELECT 1 FROM " + tableName + " WHERE (k1,k2, k3) > ('a', 'ab', 1) ORDER BY V", "SELECT 1 FROM " + tableName + " GROUP BY V", "SELECT 1 FROM " + tableName + " GROUP BY K1, V, K2 ORDER BY V", }; String query; for (int i = 0; i < queries.length; i++) { query = queries[i]; QueryPlan plan = conn.createStatement().unwrap(PhoenixStatement.class).compileQuery(query); assertFalse("Expected plan to not use round robin iterator " + query, plan.useRoundRobinIterator()); } }
@Test public void testUseRoundRobinIterator() throws Exception { Properties props = new Properties(); props.setProperty(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, Boolean.toString(false)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute("CREATE TABLE t (k1 char(2) not null, k2 varchar not null, k3 integer not null, v varchar, constraint pk primary key(k1,k2,k3))"); String[] queries = { "SELECT 1 FROM T ", "SELECT 1 FROM T WHERE V = 'c'", "SELECT 1 FROM T WHERE (k1,k2, k3) > ('a', 'ab', 1)", }; String query; for (int i = 0; i < queries.length; i++) { query = queries[i]; QueryPlan plan = conn.createStatement().unwrap(PhoenixStatement.class).compileQuery(query); assertTrue("Expected plan to use round robin iterator " + query, plan.useRoundRobinIterator()); } }
iterators.add(peekingResultIterator); ResultIterator iterator = queryPlan.useRoundRobinIterator() ? RoundRobinResultIterator.newIterator(iterators, queryPlan) : ConcatResultIterator.newIterator(iterators);
@Override public boolean useRoundRobinIterator() throws SQLException { return delegate.useRoundRobinIterator(); }
@Override public boolean useRoundRobinIterator() throws SQLException { return delegate.useRoundRobinIterator(); }
ResultIterator iterator = queryPlan.useRoundRobinIterator() ? RoundRobinResultIterator.newIterator(iterators, queryPlan) : ConcatResultIterator.newIterator(iterators); if(queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext().getSequenceManager());
iterators.add(peekingResultIterator); ResultIterator iterator = queryPlan.useRoundRobinIterator() ? RoundRobinResultIterator.newIterator(iterators, queryPlan) : ConcatResultIterator.newIterator(iterators); if (queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext().getSequenceManager());
private void addIterator(List<PeekingResultIterator> parentIterators, List<PeekingResultIterator> childIterators) throws SQLException { if (!childIterators.isEmpty()) { if (plan.useRoundRobinIterator()) { /* * When using a round robin iterator we shouldn't concatenate the iterators together. This is because a * round robin iterator should be calling next() on these iterators directly after selecting them in a * round robin fashion. This helps take advantage of loading the underlying scanners' caches in parallel * as well as preventing errors arising out of scanner lease expirations. */ parentIterators.addAll(childIterators); } else { parentIterators.add(ConcatResultIterator.newIterator(childIterators)); } } }
private void addIterator(List<PeekingResultIterator> parentIterators, List<PeekingResultIterator> childIterators) throws SQLException { if (!childIterators.isEmpty()) { if (plan.useRoundRobinIterator()) { /* * When using a round robin iterator we shouldn't concatenate the iterators together. This is because a * round robin iterator should be calling next() on these iterators directly after selecting them in a * round robin fashion. This helps take advantage of loading the underlying scanners' caches in parallel * as well as preventing errors arising out of scanner lease expirations. */ parentIterators.addAll(childIterators); } else { parentIterators.add(ConcatResultIterator.newIterator(childIterators)); } } }
if (plan.useRoundRobinIterator()) { buf.append("ROUND ROBIN ");
if (plan.useRoundRobinIterator()) { buf.append("ROUND ROBIN ");
ResultIterator iterator = queryPlan.useRoundRobinIterator() ? RoundRobinResultIterator.newIterator(iterators, queryPlan) : ConcatResultIterator.newIterator(iterators); if(queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext().getSequenceManager());
ResultIterator iterator = queryPlan.useRoundRobinIterator() ? RoundRobinResultIterator.newIterator(iterators, queryPlan) : ConcatResultIterator.newIterator(iterators); if(queryPlan.getContext().getSequenceManager().getSequenceCount() > 0) { iterator = new SequenceResultIterator(iterator, queryPlan.getContext().getSequenceManager());