public DegenerateQueryPlan( StatementContext context, FilterableStatement statement, TableRef table) { super( context, statement, table, RowProjector.EMPTY_PROJECTOR, PhoenixParameterMetaData.EMPTY_PARAMETER_META_DATA, null, OrderBy.EMPTY_ORDER_BY, GroupBy.EMPTY_GROUP_BY, null); context.setScanRanges(ScanRanges.NOTHING); }
private static List<KeyRange> getSplits( final TableRef tableRef, final Scan scan, final List<HRegionLocation> regions, final ScanRanges scanRanges) throws SQLException { final List<TableRef> tableRefs = Collections.singletonList(tableRef); ColumnResolver resolver = new ColumnResolver() { @Override public List<PFunction> getFunctions() { return Collections.emptyList(); } @Override public List<TableRef> getTables() { return tableRefs; } @Override public TableRef resolveTable(String schemaName, String tableName) throws SQLException { throw new UnsupportedOperationException(); } @Override public ColumnRef resolveColumn(String schemaName, String tableName, String colName) throws SQLException { throw new UnsupportedOperationException(); } @Override public PFunction resolveFunction(String functionName) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean hasUDFs() { return false; } }; PhoenixConnection connection = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES)) .unwrap(PhoenixConnection.class); final PhoenixStatement statement = new PhoenixStatement(connection); final StatementContext context = new StatementContext(statement, resolver, scan, new SequenceManager(statement)); context.setScanRanges(scanRanges); ParallelIterators parallelIterators = new ParallelIterators( new QueryPlan() { @Override public StatementContext getContext() { return context; } @Override public ParameterMetaData getParameterMetaData() { return PhoenixParameterMetaData.EMPTY_PARAMETER_META_DATA; } @Override public ExplainPlan getExplainPlan() throws SQLException { return ExplainPlan.EMPTY_PLAN; } @Override public ResultIterator iterator(ParallelScanGrouper scanGrouper) throws SQLException { return ResultIterator.EMPTY_ITERATOR; } @Override public ResultIterator iterator() throws SQLException { return ResultIterator.EMPTY_ITERATOR; } @Override public long getEstimatedSize() { return 0; } @Override public TableRef getTableRef() { return tableRef; } @Override public RowProjector getProjector() { return RowProjector.EMPTY_PROJECTOR; } @Override public Integer getLimit() { return null; } @Override public OrderBy getOrderBy() { return OrderBy.EMPTY_ORDER_BY; } @Override public GroupBy getGroupBy() { return GroupBy.EMPTY_GROUP_BY; } @Override public List<KeyRange> getSplits() { return null; } @Override public FilterableStatement getStatement() { return SelectStatement.SELECT_ONE; } @Override public boolean isDegenerate() { return false; } @Override public boolean isRowKeyOrdered() { return true; } @Override public List<List<Scan>> getScans() { return null; } @Override public boolean useRoundRobinIterator() { return false; } }, null, new SpoolingResultIterator.SpoolingResultIteratorFactory( context.getConnection().getQueryServices())); List<KeyRange> keyRanges = parallelIterators.getSplits(); return keyRanges; }