Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Bug with Split Fields step, I need to patch but want feedback

  1. #1
    DEinspanjer Guest

    Default Bug with Split Fields step, I need to patch but want feedback

    In the attached transformation, I attempt to split a field with the following value:
    foobar=10&bar=10

    On & into a new Integer field named bar relying on the ID "bar=" and removing the ID.

    The transformation fails on this because it sees the bar= of foobar= and thinks that is an acceptable match on the ID, and when it removes the ID, it leaves the foo part so the value it tries to parse into an int is "foo10".

    It does this because of this line in the code:
    114: if (pol[p]!=null && pol[p].indexOf(meta.getFieldID()[i])>=0) split=pol[p];

    If indexOf returns any value greater than 0 it succeeds. My first thought is that it should only match at the beginning of the split element, and this would fix my example, but the reason I'm writing this post instead of a simple bug with patch is that I figure it would also be good to handle the case of:
    Happy Value=2; Value=1;
    Split on ; with the ID "Value="

    The simple change of >=0 to ==0 would fail there because of the whitespace.

    So, how to fix that case? Do you need a checkbox to trim whitespace? Could I go with the easier patch of just arbitrarily trimming it in the ID lookup logic assuming that the user would never want the whitespace around?
    Attached Files Attached Files

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Doing something "arbitrarily" doesn't feel right

    Regards,
    Sven

  3. #3
    DEinspanjer Guest

    Default

    Well, the thing is, I really can't think of a case where a user would legitimately need leading/trailing spaces in conjunction with ID based delimited fields. That plus the detractor of having yet another checkbox led me to contemplate the arbitrary action.

  4. #4
    DEinspanjer Guest

    Default

    A patch and a mod plugin submitted in Jira:
    http://jira.pentaho.org/browse/PDI-707

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.