Class DelimFrequencySampler

java.lang.Object
io.nosqlbench.virtdata.library.basics.shared.distributions.DelimFrequencySampler
All Implemented Interfaces:
LongFunction<String>

public class DelimFrequencySampler extends Object implements LongFunction<String>
Takes a CSV with sample data and generates random values based on the relative frequencies of the values in the file. The CSV file must have headers which can be used to find the named columns. I.E. take the following imaginary `animals.csv` file: animal,count,country puppy,1,usa puppy,2,colombia puppy,3,senegal kitten,2,colombia `CSVFrequencySampler('animals.csv', animal)` will return `puppy` or `kitten` randomly. `puppy` will be 3x more frequent than `kitten`. `CSVFrequencySampler('animals.csv', country)` will return `usa`, `colombia`, or `senegal` randomly. `colombia` will be 2x more frequent than `usa` or `senegal`. Use this function to infer frequencies of categorical values from CSVs.
  • Constructor Details

    • DelimFrequencySampler

      public DelimFrequencySampler(String filename, String columnName, char delimiter)
      Create a sampler of strings from the given delimited file. The delimited file must have plain headers as its first line.
      Parameters:
      filename - The name of the file to be read into the sampler buffer
      columnName - The name of the column to be sampled
      delimiter - delimmiter
  • Method Details