I have a data stream with the following structure
user_id (integer)
user_name (string)
The user_id is anything between 100 and 65536. I want to add a target_user_id (integer) field according to the following logic:
- If
user_idis in range 1000..9999, then let thetarget_user_idfield be equal to theuser_id - If not, then fill
target_user_idwith something in range 1000..9999 without causing a conflict. Preferably the lowest possible.
The length of the stream is under 9000. The user_id field is unique in the original stream.
I am not sure what Kettle environment you are using but a general procedure could be as follows:
Process each input stream record with user_id not in 1000..9999 by:
get the lowest unused user_id by executing a SQL query (DBLookup)
Update this record with the current user_name (use Update)
Hope this helps