Skip to content

Fuzzy matching against csv header#62

Open
phact wants to merge 8 commits into
brianmhess:masterfrom
phact:fuzzy
Open

Fuzzy matching against csv header#62
phact wants to merge 8 commits into
brianmhess:masterfrom
phact:fuzzy

Conversation

@phact

@phact phact commented Dec 6, 2016

Copy link
Copy Markdown
Contributor

No description provided.

@phact

phact commented Dec 6, 2016

Copy link
Copy Markdown
Contributor Author

To test run ./fuzzy_load.sh

catch (IllegalArgumentException e){
System.err.println("Could not connect to the cluster, check your hosts");
//e.printStackTrace();
System.exit(0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.exit should really be avoided, why not throw an IOException like on line 461?

Same thing below

if (boolFalse.equalsIgnoreCase(toparse))
return new Boolean("FALSE");
throw new ParseException("Boolean was not TRUE (" + boolTrue + ") or FALSE (" + boolFalse + ")", 0);
throw new ParseException("Boolean was not TRUE (" + boolTrue + ") or FALSE (" + boolFalse + ")" + " it was "+ toparse, 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would read better with some punctuation, ex:
+ ". It was "+ toparse

List<String> columnNames = cdp.getColumnNames();
try {
String header = reader.readLine();
//this didn' work

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or revisit?

}
resultColumns[i]=currentColumn;
i++;
columnNames.remove(columnNames.contains(currentColumn));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

columnNames.contains(...) returns a boolean; passing any boolean to columnNames.remove(...) will have no effect

Perhaps this was meant to remove currentColumn from columnNames if it exists in the list. In this case it is fine to just call columnNames.remove(currentColumn)

if (delimiter == null){
delimiter = ",";
}
List<String> headerList = Arrays.asList(header.split(delimiter));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When performing a basic split, it won't account for the various CSV edge cases. Would be more robust to use a CSV parser to do the split (like Univocity, used elsewhere in this project)

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.

2 participants