Example #1
0
  private static HBaseMRRowRange getRangeMax(
      final Index<?, ?> index,
      final AdapterStore adapterStore,
      final DataStatisticsStore statsStore,
      final String[] authorizations) {

    final RowRangeDataStatistics<?> stats =
        (RowRangeDataStatistics<?>)
            statsStore.getDataStatistics(
                index.getId(), RowRangeDataStatistics.getId(index.getId()), authorizations);
    if (stats == null) {
      LOGGER.warn(
          "Could not determine range of data from 'RowRangeDataStatistics'.  Range will not be clipped. This may result in some splits being empty.");
      return new HBaseMRRowRange();
    }

    final int cardinality = Math.max(stats.getMin().length, stats.getMax().length);
    return new HBaseMRRowRange(
        new ByteArrayId(
            getKeyFromBigInteger(new BigInteger(stats.getMin()).subtract(ONE), cardinality)),
        new ByteArrayId(
            getKeyFromBigInteger(new BigInteger(stats.getMax()).add(ONE), cardinality)));
  }
Example #2
0
  private static RowRangeHistogramStatistics<?> getRangeStats(
      final PrimaryIndex index,
      final List<DataAdapter<Object>> adapters,
      final AdapterStore adapterStore,
      final DataStatisticsStore store,
      final String[] authorizations) {
    RowRangeHistogramStatistics<?> singleStats = null;
    for (final DataAdapter<?> adapter : adapters) {
      final RowRangeHistogramStatistics<?> rowStat =
          (RowRangeHistogramStatistics<?>)
              store.getDataStatistics(
                  adapter.getAdapterId(),
                  RowRangeHistogramStatistics.composeId(index.getId()),
                  authorizations);
      if (singleStats == null) {
        singleStats = rowStat;
      } else {
        singleStats.merge(rowStat);
      }
    }

    return singleStats;
  }