Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Random Delimiter in CSV Parser #545

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SijieMei
Copy link

@SijieMei SijieMei commented Nov 6, 2024

Issue

test testDelimiterDiscovery randomly failed due to the output is not "1", "2;2", "3;3", "4;a" but "1,2", "2,3", "3,4", "a".

Reason

In the CSV Parser, we use several rules to determine the delimiter. like if the optional delimiter exists in all rows or how many times the delimiter exists in the current row. If there are two optional delimiters met all rules with the same weight, they will remain in the method "pickDelimiter" in "CsvFormatDetector.java". Since we use a HashSet to store all delimiters, one delimiter will be randomly output.

Change

Use LinkedHashSet instead of HashSet so the out delimiter will be the same in different runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant