Closed Tom-hayden closed 3 years ago
I had a look at solving this but it looks like I will not have time to finish this bug at this point in time. My approach consisted of updating inSetConstraintDto to include the isWeightedSet field and to populate it when the set was being read in the CsvFileInputReader.
Once this is done, it is possible to create either a inSetConstraint or an inWeightedSetConstraint as necessary
Adding an additional UniformList that extends DistributedList might also be a good idea.
Bug report
Description of the bug
Currently a field can contain two inset constraints both which specify weightings. However this is a contradiction and should be marked as one.
Related to https://github.com/finos/datahelix/issues/1705
Steps to reproduce:
Using the profile:
and the csv files
weightedSet1.csv:
weightedSet2.csv:
nonWeightedSet.csv
Run the profile with the command generate --max-rows=1000 --replace --profile-file=D:\path\to\datahelix\profile.json --output-path=D:\path\to\datahelix\out.csv --output-format=csv --generation-type=RANDOM --set-from-file-directory=D:\path\to\datahelix\
Expected result:
What did you expect to happen? The profile is marked as fully contradictory and no data is produced.
Actual result:
Data is produced.
Additional Context
As part of this fix, it would be useful to separate out InSetConstraint into InWeightedSetConstraint or something similar. They are two distinct constraints and should be treated as such in the code base