Open peterborkuti opened 5 years ago
Hi Péter,
Thank you very much for the use case. It's true that I hadn't considered it yet. I think we'll need to do something novel here like adding the sort columns temporarily until after sorting after which we should remove them again, just to make sure the columns don't end up in the test-transformation. Cheers, Matt
I noticed that there is a similar problem at https://github.com/mattcasters/pentaho-pdi-dataset. Perhaps we can refer to this issue to find more context about the bug.
Dear Matt,
When I am using csv file input for a unit test which contains two columns (for example "id" and "a"), but I am using only one of them in the mapping (for example "a") and I choose the other ("id") for sorting, an exception occurs:
I debugged it and I think, here is the spot in the code: (DataSetCsvGroup.java from line 200)
sortIndexes will not be empty, but sortIndexes[0] will be -1 and this will cause and ArrayIndexOutOfBounds exception in outputRowMeta.compare.
You may ask, why want I sorting the csv file base on a field, which is not in the mapping, but it seemed to me a normal use case. For example, I wanted to test a transformation which adds two numbers together:
The input mapping would be the columns "a" and "b", sorted by "id" The golden mapping would be the columns "a", "b" and "c" sorted by "id".
I put all the files to reproduce this here: https://github.com/peterborkuti/pentaho-pdi-dataset-bug-01
Thank you for your wonderful plugin Péter