cwensel/cascading — pull request #27 by grighetto (2013-12-21 07:10:34+00:00)
Title: RegexSplitter doesn't work when Fields are declared

The documentation for RegexSplitter on http://docs.cascading.org/cascading/1.2/userguide/html/ch07s06.html says that "If a known number of values will emerge from this function, it can declare field names. In this case, if the splitter encounters more split values than field names, the remaining values will be discarded".
But that's not what actually happens.

Let's say I have the following input value, AAAA:BBBB, and I want to split on the colon and keep only the first part, so I'd do something like this, new RegexSplitter( new Fields("A"), ":" ). But what I get as result in the A Field is the whole string, AAAA:BBBB (whereas the expected result was just AAAA).
I fixed this issue by taking into account the number of fields passed in the constructor and added one more unit test.