According to CsvSortOptions.Builder the order of constructor arguments is:
public Builder(long datalength, Comparator<CSVRecord> cmp, int maxTmpFiles, long maxMemory)
The README code sample states:
import com.google.code.externalsorting.CsvExternalSort;
import com.google.code.externalsorting.CsvSortOptions;
// provide a comparator
Comparator<CSVRecord> comparator = (op1, op2) -> op1.get(0).compareTo(op2.get(0));
//... inputfile: input file name
//... outputfile: output file name
//...provide sort options
CsvSortOptions sortOptions = new CsvSortOptions
.Builder(CsvExternalSort.DEFAULTMAXTEMPFILES, comparator, 1, CsvExternalSort.estimateAvailableMemory())
.charset(Charset.defaultCharset())
.distinct(false)
.numHeader(1)
.skipHeader(false)
.format(CSVFormat.DEFAULT)
.build();
// next two lines sort the lines from inputfile to outputfile
List<File> sortInBatch = CsvExternalSort.sortInBatch(file, null, sortOptions);;
CsvExternalSort.mergeSortedFiles(sortInBatch, outputfile, sortOptions, true);
Should the first argument use another constant and the third argument replaced with CsvExternalSort.DEFAULTMAXTEMPFILES?
According to CsvSortOptions.Builder the order of constructor arguments is:
The README code sample states:
Should the first argument use another constant and the third argument replaced with CsvExternalSort.DEFAULTMAXTEMPFILES?