Hitachi Vantara Pentaho Community Forums
Results 1 to 17 of 17

Thread: filter rows...couldn't convert string to integer

  1. #1
    Join Date
    Jul 2006
    Posts
    21

    Default filter rows...couldn't convert string to integer

    I've just converted to the latest 3.0 of PDI and I am having a problem with conditions in filter rows.

    Situation: I am bringing back an integer field from a database and then filtering rows based on the value of that field. Specifically I want only rows where the integer is '66'.

    I add a filter rows step and then add a condition where I compare the incoming field to the value '66'. I specify that 66 should be an integer and I use a conversion format of #.

    You can easily test to see what the value will be casted to right in the step (thanks!).

    However, when I run the transformation, I get an error "couldn't convert string to integer". For some reason PDI can do the conversion during the test but not at run time. Instead I get an error message of:
    Unparseable number: "66"

    Help?
    Last edited by wonggo; 11-19-2007 at 12:05 PM.

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

    Default

    Make a small test ktr without using databases and attach that to the thread.

    Regards,
    Sven

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Probably using an older RC.

  4. #4
    Join Date
    Jul 2006
    Posts
    21

    Default

    I'm using Kettle-3.0.0.GA

    I found a fix and a reproducible test case.

    1) Bring an integer field back from a database table
    2) send that to a 'filter row' step where you compare it to an integer, declared as an integer.

    When you run it, you get the message "unable to convert string to integer"

    3) Change the declared type of the comparison value in the filter rows step to 'string'

    Run it again and same error message

    4) Explicitly save the transformation

    This time the transform runs correctly

    5) Change the declared type of the comparison value back to integer (just for kicks)

    The transformation still runs.


    I was able to solve my originally problem by explicitly saving the transform.

  5. #5
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Listen to Sven: make a small test case. I'm not sure you're making a lot of sense to me ;-)

    Thanks in advance!

    Cheers,

    Matt

  6. #6
    Join Date
    Jul 2006
    Posts
    21

    Default

    Here's the sample ktr. I've attached a sample data file too. Apologies for the hardcoded path in the input file step.

    Hopefully you will see the same behavior I did.

    1) Run the transform as is....fails with an 'couldn't convert string to integer error'

    2) Explicit save the transform...same behavior when you run

    3) Change the data type of the test value to 'integer'....transform still fails with the same error

    4) Save the transform explicitly...this time the transform works when you go to run it.

    Hope this will make more sense when you try it.

    Thanks
    Attached Files Attached Files

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

    Default

    I don't get your error when I run the transformation

    Regards,
    Sven

  8. #8
    Join Date
    Oct 2007
    Posts
    15

    Default test

    I tested it in the way you described, and had no problems.

    I am however running on a Windows platform using 3.0, from your path, I assume you are running linux.

  9. #9
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    No problem on Linux either.

    wonggo, please run "Pan.bat -version" and give us the output ;-)

    Cheers,

    Matt

  10. #10
    Join Date
    Jul 2006
    Posts
    21

    Default

    pan.sh since I am on linux. Here you go:

    INFO 20-11 10:16:51,741 (LogWriter.javarintln:403) -Pan - Kettle version 3.0.0, build 500, build date : Wed Nov 14 14:59:11 EST 2007

  11. #11
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    I have to tell you, this is super-weird.

    Can you see if exchanging these files in the lib/ directory makes a change:

    http://kettle3.s3.amazonaws.com/kettle-ui-swt-3.0.jar
    http://kettle3.s3.amazonaws.com/kettle-engine-3.0.jar

    Just to make sure I'm not chasing a ghost here...

    Cheers,
    Matt

  12. #12
    Join Date
    Jul 2006
    Posts
    21

    Default

    will do...might take me a couple of hours to get around to it.

  13. #13
    Join Date
    Jul 2006
    Posts
    21

    Default

    Ok, I copied across the new jar files. Unfortunately the same problem.

    First time I run the test transformation (input file>filter rows> dummy)
    I get the error message "couldn't convert string to integer". The screen shot is attached.

    As before, I can get rid of the problem by change the type of the comparison value to integer and explicitly saving before running.
    Attached Images Attached Images  

  14. #14
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    It was not very nice of you to hide the fact that it was a repository problem you had.
    Tsk tsk tsk.

    Thanks in any case, I'll look into it.

    Matt

  15. #15
    Join Date
    Jul 2006
    Posts
    21

    Default

    Apologies if I mislead you. Despite the error message, it was not clear to me that this was a repository issue. After all, I am seeing the error with new transformations (as opposed to loaded ones) so I didn't expect that anything would need to be loaded from the repository.

    Since you mentioned this, I did some more investigation. I found that another transformation, previously written, that does the same sort of comparison failed to load with the same error message "couldn't convert...."

    I took a backup of the repository and then went into the metadata and manually changed r_value.value_type for the value in question to 'integer' and I was able to load and run my transformation.

  16. #16
    Join Date
    Nov 1999
    Posts
    9,729

    Default Fix

    Replaces these files in lib/ :

    http://kettle3.s3.amazonaws.com/kettle-ui-swt-3.0.jar
    http://kettle3.s3.amazonaws.com/kettle-engine-3.0.jar

    Let me know what happens, either here or in bug PDI-505.

    Thanks,
    Matt

  17. #17
    Join Date
    Nov 1999
    Posts
    459

    Default

    I can confirm for my use case, this one is fixed in 3.0.1: http://jira.pentaho.org/browse/PDI-505

    Cheers,
    Jens

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.