Source:
<code>public final Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { Map<String, List<String>> tagQueries = new HashMap<>(); Long start = null; Long end = null; TimeseriesDB.AggregationOperation aggregationOperation = TimeseriesDB.AggregationOperation.NONE; Set<String> groupByFields = new HashSet<>(); for (String field : fields) { if (field.startsWith(timestampKey)) { String[] timestampParts = field.split(tagPairDelimiter); if (!timestampParts[1].contains(queryTimeSpanDelimiter)) { return Status.NOT_IMPLEMENTED; } String[] rangeParts = timestampParts[1].split(queryTimeSpanDelimiter); start = Long.valueOf(rangeParts[0]); end = Long.valueOf(rangeParts[1]); } else if (field.startsWith(groupByKey)) { String groupBySpecifier = field.split(tagPairDelimiter)[1]; <START> aggregationOperation = TimeseriesDB.AggregationOperation.valueOf(groupBySpecifier); <END> } else if (field.startsWith(downsamplingKey)) { String downsamplingSpec = field.split(tagPairDelimiter)[1]; if (!downsamplingSpec.equals(downsamplingFunction.toString() + downsamplingInterval.toString())) { System.err.print("Downsampling specification for Scan did not match configured downsampling"); } } else { String[] queryParts = field.split(tagPairDelimiter); if (queryParts.length == 1) { System.err.println("Grouping by arbitrary series is currently not supported"); groupByFields.add(field); } else { tagQueries.computeIfAbsent(queryParts[0], k -> new ArrayList<>()).add(queryParts[1]); } } } return scan(table, start, end, tagQueries, downsamplingFunction, downsamplingInterval, timestampUnit); }</code><technical_language>nice wrap this in a DBException WorkloadException group in enum</technical_language>

Target:
public final Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { Map<String, List<String>> tagQueries = new HashMap<>(); TimeseriesDB.AggregationOperation aggregationOperation = TimeseriesDB.AggregationOperation.NONE; Set<String> groupByFields = new HashSet<>(); boolean rangeSet = false; long start = 0; long end = 0; for (String field : fields) { if (field.startsWith(timestampKey)) { String[] timestampParts = field.split(tagPairDelimiter); if (!timestampParts[1].contains(queryTimeSpanDelimiter)) { return Status.NOT_IMPLEMENTED; } String[] rangeParts = timestampParts[1].split(queryTimeSpanDelimiter); rangeSet = true; start = Long.valueOf(rangeParts[0]); end = Long.valueOf(rangeParts[1]); } else if (field.startsWith(groupByKey)) { String groupBySpecifier = field.split(tagPairDelimiter)[1]; aggregationOperation = TimeseriesDB.AggregationOperation.valueOf(groupBySpecifier); } else if (field.startsWith(downsamplingKey)) { String downsamplingSpec = field.split(tagPairDelimiter)[1]; if (!downsamplingSpec.equals(downsamplingFunction.toString() + downsamplingInterval.toString())) { System.err.print("Downsampling specification for Scan did not match configured downsampling"); return Status.BAD_REQUEST; } } else { String[] queryParts = field.split(tagPairDelimiter); if (queryParts.length == 1) { System.err.println("Grouping by arbitrary series is currently not supported"); groupByFields.add(field); } else { tagQueries.computeIfAbsent(queryParts[0], k -> new ArrayList<>()).add(queryParts[1]); } } } if (!rangeSet) { return Status.BAD_REQUEST; } return scan(table, start, end, tagQueries, downsamplingFunction, downsamplingInterval, timestampUnit); }