scalding icon indicating copy to clipboard operation
scalding copied to clipboard

disabling strict line handling with Csv

Open ljrittle opened this issue 12 years ago • 2 comments

So, having written scalding code for various new internal productions, I have (finally) started porting over some of our prior Pig code base to scalding. This has yielded a wondrous set of new issues to consider.

Is this code, at the "application-level" or "job-level", (and barring a patch to scalding-core) the only/best way to handle short/long Csv lines in a Source?

OR, was it an oversight that e.g. override val strict : Boolean = false, was not added to the core Csv implementation when the DelimitedScheme trait was updated to include strict?

Regards, Loren

// By default, Csv halts the job if a line contains a mismatched field count // We define NonStrictCsv which otherwise mirrors Csv to add strict==false import cascading.tap.SinkMode import cascading.tuple.Fields

case class NonStrictCsv(p : String, override val separator : String = ",", override val fields : Fields = Fields.ALL, override val skipHeader : Boolean = false, override val writeHeader : Boolean = false, override val quote : String =""", override val strict : Boolean = false, override val sinkMode: SinkMode = SinkMode.REPLACE) extends FixedPathSource(p) with DelimitedScheme

ljrittle avatar Mar 06 '14 20:03 ljrittle

I kind of think we should let people make these kinds of classes on their own. I am concerned about making it too easy to ignore bad data.

Any automatic data cleaning needs a lot of thought.

johnynek avatar Mar 06 '14 21:03 johnynek

OK (and fully agreed on the data cleaning issue; funny to note that the person that provided the data files in question with the particular code I was translating swore to me the all lines had equal field counts/meanings - a quick review of addTrap() output convinced me otherwise ;-). Just wanted an expert opinion on whether replicating so much library code just to add one option was indeed correct here (and yes, it did make me think about the problem a bit more). Thanks, Loren

ljrittle avatar Mar 06 '14 23:03 ljrittle