US and Worldwide: +1 (866) 660-7555
Results 1 to 1 of 1

Thread: Hashcode calculation in Javascript Step or UDJC

  1. #1
    Join Date
    Sep 2011
    Posts
    5

    Default Hashcode calculation in Javascript Step or UDJC

    I got to calculate programmatically the same hashcode value as generated dimension one created by the combination lookup update step (CLU) (Use hashcode? option)
    I have a doubt,
    In kettle 4.1.0 hashcode of CLU calculation its done by using Arrays.hashcode or oldXORHashCode method??

    I've tried this but it doesn't work
    import java.util.Arrays;
    public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
    {
    Object[] r = getRow();
    if (r == null) {
    setOutputDone();
    return false;
    }


    if (first)
    {
    first = false;
    }
    r = createOutputRow(r, getInputRowMeta().size());

    Long id = get(Fields.In, "id").getInteger(r);
    String level1 = get(Fields.In, "level_1").getString(r);
    String level2 = get(Fields.In, "level_2").getString(r);
    String level3 = get(Fields.In, "level_3").getString(r);
    String level4 = get(Fields.In, "level_4").getString(r);
    get(Fields.Out, "hashcode").setValue(r,new Long(Arrays.hashCode(new Object []{id, level1, level2, level3, level4})));


    // Send the row on to the next step.
    putRow(data.outputRowMeta, r);
    return true;
    }

    PS: sorry about my english
    Last edited by ccverak; 01-26-2012 at 09:24 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •