private static Scan getConfiguredScanForJob()

in java/dataproc-wordcount/src/main/java/com/example/bigtable/sample/CellCounter.java [218:241]


  private static Scan getConfiguredScanForJob(Configuration conf, String[] args) throws IOException {
    Scan s = new Scan();
    // Set Scan Versions
    s.setMaxVersions(Integer.MAX_VALUE);
    s.setCacheBlocks(false);
    // Set Scan Column Family
    if (conf.get(TableInputFormat.SCAN_COLUMN_FAMILY) != null) {
      s.addFamily(Bytes.toBytes(conf.get(TableInputFormat.SCAN_COLUMN_FAMILY)));
    }
    // Set RowFilter or Prefix Filter if applicable.
    Filter rowFilter = getRowFilter(args);
    if (rowFilter!= null) {
      LOG.info("Setting Row Filter for counter.");
      s.setFilter(rowFilter);
    }
    // Set TimeRange if defined
    long timeRange[] = getTimeRange(args);
    if (timeRange != null) {
      LOG.info("Setting TimeRange for counter.");
      s.setTimeRange(timeRange[0], timeRange[1]);
    }
    LOG.warn("Got the Scan: " + s);
    return s;
  }