org.apache.accumulo.core.iterators.IteratorEnvironment Java Examples

The following examples show how to use org.apache.accumulo.core.iterators.IteratorEnvironment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SingleEntryFilterIterator.java    From geowave with Apache License 2.0 6 votes vote down vote up
@Override
public void init(
    final SortedKeyValueIterator<Key, Value> source,
    final Map<String, String> options,
    final IteratorEnvironment env) throws IOException {

  final String adapterIdStr = options.get(ADAPTER_ID);
  final String dataIdsStr = options.get(DATA_IDS);
  if (adapterIdStr == null) {
    throw new IllegalArgumentException(
        "'adapterid' must be set for " + SingleEntryFilterIterator.class.getName());
  }
  if (dataIdsStr == null) {
    throw new IllegalArgumentException(
        "'dataid' must be set for " + SingleEntryFilterIterator.class.getName());
  }

  adapterId = BaseEncoding.base64Url().decode(adapterIdStr);
  dataIds = decodeIDs(dataIdsStr);
  final String wholeRowEncodedStr = options.get(WHOLE_ROW_ENCODED_KEY);
  // default to whole row encoded if not specified
  wholeRowEncoded =
      ((wholeRowEncodedStr == null) || !wholeRowEncodedStr.equals(Boolean.toString(false)));
  super.init(source, options, env);
}
 
Example #2
Source File: ShardUidMappingIterator.java    From datawave with Apache License 2.0 6 votes vote down vote up
public ShardUidMappingIterator(ShardUidMappingIterator iter, IteratorEnvironment env) {
    super(iter, env);
    this.columnFamilies = (iter.columnFamilies == null ? null : new ArrayList<>(iter.columnFamilies));
    this.inclusive = iter.inclusive;
    this.cacheBaseUidKey = (iter.cacheBaseUidKey == null ? null : new Key(iter.cacheBaseUidKey));
    for (Map.Entry<Key,ByteArrayOutputStream> entry : iter.cache.entrySet()) {
        this.cache.put(entry.getKey(), entry.getValue());
    }
    this.cacheTopKey = (iter.cacheTopKey == null ? null : new Key(iter.cacheTopKey));
    this.cacheTopValue = (iter.cacheTopValue == null ? null : new Value(iter.cacheTopValue.get()));
    this.lastSeekParams = null;
    if (iter.lastSeekParams != null) {
        this.lastSeekParams = new SeekParams();
        this.lastSeekParams.range = new Range(iter.lastSeekParams.range);
        this.lastSeekParams.inclusive = iter.lastSeekParams.inclusive;
        if (iter.lastSeekParams.columnFamilies != null) {
            this.lastSeekParams.columnFamilies = new ArrayList<>(iter.lastSeekParams.columnFamilies);
        }
    }
}
 
Example #3
Source File: DocumentIndexIntersectingIterator.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
  TextColumn[] terms = decodeColumns(options.get(columnOptionName));
  boolean[] prefixes = decodeBooleans(options.get(columnPrefix));
  ctxt = decodeContext(options.get(context));
  
  if(ctxt != null) {
      hasContext = true;
  }

 
  
  if (terms.length < 2) {
    throw new IllegalArgumentException("IntersectionIterator requires two or more columns families");
  }
  
  sources = new TermSource[terms.length];
  sources[0] = new TermSource(source, terms[0]);
  for (int i = 1; i < terms.length; i++) {
      //log.info("For decoded column " + i + " column family is " + terms[i].getColumnFamily() + " and qualifier is " + terms[i].getColumnQualifier());
    sources[i] = new TermSource(source.deepCopy(env), terms[i]);
    sources[i].isPrefix = prefixes[i];
  }
  sourcesCount = terms.length;
}
 
Example #4
Source File: RowTimestampFilter.java    From vertexium with Apache License 2.0 6 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    if (options == null) {
        throw new IllegalArgumentException(TIMESTAMPS + " is required");
    }

    super.init(source, options, env);

    String timestampOptions = options.get(TIMESTAMPS);
    if (timestampOptions == null) {
        throw new IllegalArgumentException(TIMESTAMPS + " is required");
    }
    timestamps = new HashMap<>();
    for (String timestampOption : timestampOptions.split(";")) {
        String[] parts = timestampOption.split(":");
        if (parts.length != 5) {
            throw new IllegalArgumentException(TIMESTAMPS + " is invalid. Expected 5 parts found " + parts.length + ": " + timestampOption);
        }
        Text rowKey = new Text(OptionsUtils.hexToBytes(parts[0]));
        Long startTimestamp = OptionsUtils.parseLong(parts[1]);
        Boolean startInclusive = OptionsUtils.parseBoolean(parts[2]);
        Long endTimestamp = OptionsUtils.parseLong(parts[3]);
        Boolean endInclusive = OptionsUtils.parseBoolean(parts[4]);
        timestamps.put(rowKey, new Timestamp(startTimestamp, startInclusive, endTimestamp, endInclusive));
    }
}
 
Example #5
Source File: BooleanTreeIterator.java    From rya with Apache License 2.0 6 votes vote down vote up
private SortedKeyValueIterator<Key, Value> createIterator(SimpleNode root, SortedKeyValueIterator<Key, Value> source,
        IteratorEnvironment env) {
    // if the root is only a single term, wrap it in an expression node
    if (root instanceof ASTTerm) {
        ASTExpression expression = new ASTExpression(QueryParserTreeConstants.JJTEXPRESSION);
        expression.setNotFlag(false);
        expression.setType(ASTExpression.AND);

        pushChild(expression, root);
        root.jjtSetParent(expression);

        root = expression;
    }

    // Pre-process the tree to compensate for iterator specific issues with certain topologies
    preProcessTree(root);

    // Build an iterator tree
    return createIteratorRecursive(root, source, env);
}
 
Example #6
Source File: TimeLimitingFilter.java    From accumulo-recipes with Apache License 2.0 6 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    threshold = -1;
    if (options == null)
        throw new IllegalArgumentException(TTL + " must be set for TimeLimitingFilter");

    String ttl = options.get(TTL);
    if (ttl == null)
        throw new IllegalArgumentException(TTL + " must be set for TimelimitingFilter");

    threshold = Long.parseLong(ttl);

    String time = options.get(CURRENT_TIME);
    if (time != null)
        currentTime = Long.parseLong(time);
    else
        currentTime = System.currentTimeMillis();

    // add sanity checks for threshold and currentTime?
}
 
Example #7
Source File: MinMaxIterator.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
    src = source;
    
    String min = options.get(MIN_OPT);
    if (min != null) {
        this.min = new Text(min);
    } else {
        throw new IOException(new IllegalArgumentException("mmi.min must be set for MinMaxIterator."));
    }
    
    String max = options.get(MAX_OPT);
    if (max != null) {
        this.max = new Text(max);
    } else {
        throw new IOException(new IllegalArgumentException("mmi.max must be set for MinMaxIterator."));
    }
    
    log.trace("MinMaxIterator initialized with [min=" + min + ", max=" + max + "]");
}
 
Example #8
Source File: GarbageCollectionIterator.java    From fluo with Apache License 2.0 6 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options,
    IteratorEnvironment env) throws IOException {

  if (env.getIteratorScope() == IteratorScope.scan) {
    throw new IllegalArgumentException();
  }
  this.source = source;
  isFullMajc = env.getIteratorScope() == IteratorScope.majc && env.isFullMajorCompaction();

  String oats = options.get(GC_TIMESTAMP_OPT);
  if (oats != null) {
    gcTimestamp = Long.valueOf(oats);
  } else {
    String zookeepers = options.get(ZOOKEEPER_CONNECT_OPT);
    if (zookeepers == null) {
      throw new IllegalArgumentException("A configuration item for GC iterator was not set");
    }
    gcTimestamp = ZookeeperUtil.getGcTimestamp(zookeepers);
  }
}
 
Example #9
Source File: ExtractIterator.java    From OSTMap with Apache License 2.0 5 votes vote down vote up
@Override
public SortedKeyValueIterator<Key, Value> deepCopy(IteratorEnvironment env) {
    ExtractIterator copy = null;
    try {
        copy = this.getClass().newInstance();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    return copy;
}
 
Example #10
Source File: BooleanLogicIterator.java    From accumulo-recipes with Apache License 2.0 5 votes vote down vote up
public BooleanLogicIterator(BooleanLogicIterator other, IteratorEnvironment env) {
    if (other.sourceIterator != null) {
        this.sourceIterator = other.sourceIterator.deepCopy(env);
    }
    keyParser = new FieldIndexKeyParser();
    rangerators = new ArrayList<BooleanLogicTreeNode>();
    log.debug("Congratulations, you've reached the BooleanLogicIterator");
}
 
Example #11
Source File: BucketRollupIterator.java    From accumulo-recipes with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);

    if (options.containsKey("bucketSize")) {
        bucketSize = BucketSize.valueOf(options.get("bucketSize"));
    }
}
 
Example #12
Source File: FieldIndexOnlyQueryIterator.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
    if (log.isTraceEnabled()) {
        log.trace("QueryIterator init()");
    }
    
    if (!validateOptions(options)) {
        throw new IllegalArgumentException("Could not initialize QueryIterator with " + options);
    }
    
    // Parse & flatten the query
    try {
        script = JexlASTHelper.parseAndFlattenJexlQuery(this.getQuery());
    } catch (ParseException e) {
        throw new IOException("Could not parse the JEXL query: '" + this.getQuery() + "'", e);
    }
    
    this.documentOptions = options;
    this.myEnvironment = env;
    
    if (collectTimingDetails) {
        trackingSpan = new QuerySpan(getStatsdClient());
        this.source = new SourceTrackingIterator(trackingSpan, source);
    } else {
        this.source = source;
    }
    
    this.fiAggregator = new IdentityAggregator(null, null);
    
    this.sourceForDeepCopies = this.source.deepCopy(this.myEnvironment);
    
}
 
Example #13
Source File: FieldAgeOffFilter.java    From datawave with Apache License 2.0 5 votes vote down vote up
/**
 * Required by the {@code FilterRule} interface. Used to initialize the the {@code FilterRule} implementation
 *
 * @param options
 *            {@code Map} object containing the TTL, TTL_UNITS, and MATCHPATTERN for the filter rule.
 * @param iterEnv
 * @see datawave.iterators.filter.AgeOffConfigParams
 */
public void init(FilterOptions options, IteratorEnvironment iterEnv) {
    if (options == null) {
        throw new IllegalArgumentException("FilterOptions can not be null");
    }
    String scanStartStr = options.getOption(AgeOffConfigParams.SCAN_START_TIMESTAMP);
    long scanStart = scanStartStr == null ? System.currentTimeMillis() : Long.parseLong(scanStartStr);
    this.init(options, scanStart, iterEnv);
}
 
Example #14
Source File: AccumuloTableIterable.java    From datawave with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
public AccumuloTableIterable(final SortedKeyValueIterator<Key,Value> source, final IteratorEnvironment env, final Map<String,String> options,
                Predicate<Key> filter, Equality eq, EventDataQueryFilter evaluationFilter, boolean includeChildCount, boolean includeParent) {
    this.source = source;
    this.environment = env;
    this.options = (null != options) ? options : (Map) Collections.emptyMap();
    this.filter = filter;
    this.eq = eq;
    this.evaluationFilter = evaluationFilter;
    this.includeChildCount = includeChildCount;
    this.includeParent = includeParent;
}
 
Example #15
Source File: WholeRowAggregationIterator.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(
    final SortedKeyValueIterator<Key, Value> source,
    final Map<String, String> options,
    final IteratorEnvironment env) throws IOException {
  WholeRowAggregationIterator.super.init(source, options, env);
}
 
Example #16
Source File: ReadAheadIterator.java    From accumulo-recipes with Apache License 2.0 5 votes vote down vote up
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    validateOptions(options);
    this.source = source;
    queue = new ArrayBlockingQueue<QueueElement>(queueSize);
    thread = new ProducerThread(this.source);
    t = new Thread(thread, "ReadAheadIterator-SourceThread");
    t.start();
}
 
Example #17
Source File: MergingVisibilityCombiner.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(
    final SortedKeyValueIterator<Key, Value> source,
    final Map<String, String> options,
    final IteratorEnvironment env) throws IOException {
  super.init(source, options, env);
  final String encodedColumns = getColumnOptionValue(options);
  if (encodedColumns.length() == 0) {
    throw new IllegalArgumentException("The column must not be empty");
  }
  combiners = new ColumnSet(Lists.newArrayList(Splitter.on(",").split(encodedColumns)));
}
 
Example #18
Source File: AndIterator.java    From accumulo-recipes with Apache License 2.0 5 votes vote down vote up
public AndIterator(AndIterator other, IteratorEnvironment env) {
    if (other.sources != null) {
        sourcesCount = other.sourcesCount;
        sources = new TermSource[sourcesCount];
        for (int i = 0; i < sourcesCount; i++) {
            sources[i] = new TermSource(other.sources[i].iter.deepCopy(env), other.sources[i].dataLocation, other.sources[i].term);
        }
    }
}
 
Example #19
Source File: HasAuthorizationFilter.java    From vertexium with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    authorizationToMatch = options.get(SETTING_AUTHORIZATION_TO_MATCH);
    Set<String> filterStrings = SetOfStringsEncoder.decodeFromString(options.get(SETTING_FILTERS));
    List<ElementFilter> filtersCollection = new ArrayList<>();
    for (String filterString : filterStrings) {
        filtersCollection.add(ElementFilter.valueOf(filterString));
    }
    filters = EnumSet.copyOf(filtersCollection);
    matchCache = new HashMap<>();
}
 
Example #20
Source File: NumericIndexStrategyFilterIterator.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(
    final SortedKeyValueIterator<Key, Value> source,
    final Map<String, String> options,
    final IteratorEnvironment env) throws IOException {
  this.source = source;
  if (options == null) {
    throw new IllegalArgumentException(
        "Arguments must be set for " + NumericIndexStrategyFilterIterator.class.getName());
  }
  try {
    if (options.containsKey(INDEX_STRATEGY_KEY)) {
      final String idxStrategyStr = options.get(INDEX_STRATEGY_KEY);
      final byte[] idxStrategyBytes = ByteArrayUtils.byteArrayFromString(idxStrategyStr);
      indexStrategy = (NumericIndexStrategy) URLClassloaderUtils.fromBinary(idxStrategyBytes);
      partitionKeyLength = indexStrategy.getPartitionKeyLength();
    } else {
      throw new IllegalArgumentException(
          "'"
              + INDEX_STRATEGY_KEY
              + "' must be set for "
              + NumericIndexStrategyFilterIterator.class.getName());
    }
    if (options.containsKey(COORDINATE_RANGE_KEY)) {
      final String coordRangeStr = options.get(COORDINATE_RANGE_KEY);
      final byte[] coordRangeBytes = ByteArrayUtils.byteArrayFromString(coordRangeStr);
      final ArrayOfArrays arrays = new ArrayOfArrays();
      arrays.fromBinary(coordRangeBytes);
      rangeCache = RangeLookupFactory.createMultiRangeLookup(arrays.getCoordinateArrays());
    } else {
      throw new IllegalArgumentException(
          "'"
              + COORDINATE_RANGE_KEY
              + "' must be set for "
              + NumericIndexStrategyFilterIterator.class.getName());
    }
  } catch (final Exception e) {
    throw new IllegalArgumentException(e);
  }
}
 
Example #21
Source File: StatsCombiner.java    From accumulo-examples with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
    IteratorEnvironment env) throws IOException {
  super.init(source, options, env);

  if (options.containsKey(RADIX_OPTION))
    radix = Integer.parseInt(options.get(RADIX_OPTION));
  else
    radix = 10;
}
 
Example #22
Source File: BooleanTreeIterator.java    From rya with Apache License 2.0 5 votes vote down vote up
private AndingIterator getSimpleAndingIterator(ASTTerm node, SortedKeyValueIterator<Key, Value> source, IteratorEnvironment env) {
    Validate.isTrue(!node.isNotFlag(), "Simple Anding node must not have \"not\" flag set");

    AndingIterator anding = new AndingIterator();
    anding.addSource(source, env, getTermColFam(node), false);
    return anding;
}
 
Example #23
Source File: PropogatingIteratorTest.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoAggregatorWithDeepCopy() throws IOException {
    TreeMultimap<Key,Value> map = TreeMultimap.create();
    
    map.put(newKey(SHARD, FIELD_TO_AGGREGATE, "abc"), new Value(createValueWithUid("abc.0").build().toByteArray()));
    map.put(newKey(SHARD, FIELD_TO_AGGREGATE, "abc"), new Value(createValueWithRemoveUid("abc.0").build().toByteArray()));
    
    map.put(newKey(SHARD, FIELD_TO_AGGREGATE, "abd"), new Value(createValueWithUid("abc.3").build().toByteArray()));
    
    SortedMultiMapIterator data = new SortedMultiMapIterator(map);
    
    PropogatingIterator iter = new PropogatingIterator();
    Map<String,String> options = Maps.newHashMap();
    
    IteratorEnvironment env = new MockIteratorEnvironment(false);
    
    iter.init(data, options, env);
    iter = iter.deepCopy(env);
    
    iter.seek(new Range(), Collections.emptyList(), false);
    
    Assert.assertTrue(iter.hasTop());
    
    Key topKey = iter.getTopKey();
    
    Assert.assertEquals(newKey(SHARD, FIELD_TO_AGGREGATE, "abc"), topKey);
    validateUids(iter.getTopValue(), "abc.0");
    iter.next();
    Assert.assertEquals(newKey(SHARD, FIELD_TO_AGGREGATE, "abc"), topKey);
    validateRemoval(iter.getTopValue(), "abc.0");
    iter.next();
    topKey = iter.getTopKey();
    Assert.assertEquals(newKey(SHARD, FIELD_TO_AGGREGATE, "abd"), topKey);
    
}
 
Example #24
Source File: EdgeFilterIterator.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(org.apache.accumulo.core.iterators.SortedKeyValueIterator<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Value> source,
                java.util.Map<java.lang.String,java.lang.String> options, org.apache.accumulo.core.iterators.IteratorEnvironment env)
                throws java.io.IOException {
    super.init(source, options, env);
    initOptions(options);
}
 
Example #25
Source File: MatchingKeySkippingIterator.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    String o = options.get(NUM_SCANS_STRING_NAME);
    numscans = o == null ? 10 : Integer.parseInt(o);
    delimiter = options.get(ROW_DELIMITER_OPTION);
    if (null != delimiter) {
        comparator = new RowPrefixComparator(delimiter);
    }
}
 
Example #26
Source File: TLDQueryIterator.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
    if (log.isTraceEnabled()) {
        log.trace("TLDQueryIterator init()");
    }
    
    // extract SeekingQueryPlanner fields if available
    if (options.get(SeekingQueryPlanner.MAX_FIELD_HITS_BEFORE_SEEK) != null) {
        maxFieldHitsBeforeSeek = Integer.parseInt(options.get(SeekingQueryPlanner.MAX_FIELD_HITS_BEFORE_SEEK));
    }
    
    if (options.get(SeekingQueryPlanner.MAX_KEYS_BEFORE_SEEK) != null) {
        maxKeysBeforeSeek = Integer.parseInt(options.get(SeekingQueryPlanner.MAX_KEYS_BEFORE_SEEK));
    }
    
    super.init(source, options, env);
    
    super.fiAggregator = new TLDFieldIndexAggregator(getNonEventFields(), getFIEvaluationFilter(), maxKeysBeforeSeek);
    
    // Replace the fieldIndexKeyDataTypeFilter with a chain of "anded" index-filtering predicates.
    // If no other predicates are configured via the indexfiltering.classes property, the method
    // simply returns the existing fieldIndexKeyDataTypeFilter value. Otherwise, the returned value
    // contains an "anded" chain of newly configured predicates following the existing
    // fieldIndexKeyDataTypeFilter value (assuming it is defined with something other than the default
    // "ALWAYS_TRUE" KeyIdentity.Function).
    fieldIndexKeyDataTypeFilter = parseIndexFilteringChain(new SourcedOptions<>(source, env, options));
    
    disableIndexOnlyDocuments = false;
}
 
Example #27
Source File: WholeRowAggregationIterator.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(
    final SortedKeyValueIterator<Key, Value> source,
    final Map<String, String> options,
    final IteratorEnvironment env) throws IOException {
  aggregationIterator = new AggregationIterator();
  aggregationIterator.setParent(new WholeRowAggregationParent());
  aggregationIterator.setOptions(options);
  aggregationIterator.queryFilterIterator = new QueryFilterIterator();
  aggregationIterator.queryFilterIterator.setOptions(options);
  super.init(source, options, env);
}
 
Example #28
Source File: GlobalIndexDataTypeFilter.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    
    int i = 1;
    while (options.containsKey(DATA_TYPE + i)) {
        dataTypes.add(options.get(DATA_TYPE + i));
        i++;
    }
    if (log.isDebugEnabled()) {
        log.debug("Set the data type filter to " + dataTypes);
    }
}
 
Example #29
Source File: NumericIndexStrategyFilterIterator.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public SortedKeyValueIterator<Key, Value> deepCopy(final IteratorEnvironment env) {
  final NumericIndexStrategyFilterIterator iterator = new NumericIndexStrategyFilterIterator();
  iterator.indexStrategy = indexStrategy;
  iterator.rangeCache = rangeCache;
  iterator.source = source.deepCopy(env);
  return iterator;
}
 
Example #30
Source File: CutoffIntersectingIterator.java    From accumulo-examples with Apache License 2.0 5 votes vote down vote up
private void setMax(IteratorEnvironment sampleEnv, Map<String,String> options) {
  String cutoffValue = options.get("cutoff");
  SamplerConfiguration sampleConfig = sampleEnv.getSamplerConfiguration();

  // Ensure the sample was constructed in an expected way. If the sample is not built as expected,
  // then can not draw conclusions based on sample.
  requireNonNull(cutoffValue, "Expected cutoff option is missing");
  validateSamplerConfig(sampleConfig);

  int modulus = Integer.parseInt(sampleConfig.getOptions().get("modulus"));

  sampleMax = Math.round(Float.parseFloat(cutoffValue) / modulus);
}