예제 #1
0
 public AggregatePlan(
     StatementContext context,
     FilterableStatement statement,
     TableRef table,
     RowProjector projector,
     Integer limit,
     OrderBy orderBy,
     ParallelIteratorFactory parallelIteratorFactory,
     GroupBy groupBy,
     Expression having) {
   super(
       context,
       statement,
       table,
       projector,
       context.getBindManager().getParameterMetaData(),
       limit,
       orderBy,
       groupBy,
       parallelIteratorFactory);
   this.having = having;
   this.aggregators = context.getAggregationManager().getAggregators();
 }
 private static List<KeyRange> getSplits(
     TableRef table,
     final Scan scan,
     final NavigableMap<HRegionInfo, ServerName> regions,
     final ScanRanges scanRanges)
     throws SQLException {
   PhoenixConnection connection =
       DriverManager.getConnection(getUrl(), TEST_PROPERTIES).unwrap(PhoenixConnection.class);
   StatementContext context =
       new StatementContext(connection, null, Collections.emptyList(), 0, scan);
   context.setScanRanges(scanRanges);
   SkipRangeParallelIteratorRegionSplitter splitter =
       SkipRangeParallelIteratorRegionSplitter.getInstance(context, table);
   List<KeyRange> keyRanges = splitter.getSplits();
   Collections.sort(
       keyRanges,
       new Comparator<KeyRange>() {
         @Override
         public int compare(KeyRange o1, KeyRange o2) {
           return Bytes.compareTo(o1.getLowerRange(), o2.getLowerRange());
         }
       });
   return keyRanges;
 }