Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Custom Input Transformation Help:

  1. #1

    Default Custom Input Transformation Help:

    In our system we have a collection of values which we would like to create a custom Input transformation to produce rows of data which we want to have as a starting point for some of our ETL efforts going forward.

    I have looked at the RowGenerator, Append, TabeInput etc. but cannot figure out the precise way to go, mainly because I have not found any documentation for the RowMetaInterface.

    I have figured out the data and have built my collection in the StepDataInterface but how do I code the processRow to support it?

    This is a really dumb example, but in this case I have an one dimensional array of values that I want to push, this works, however I have yet to figure out how to make it a source, as it always has to have an initial getInputRow() or it fails.

    public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
    {
    meta = (MyMeta)smi;
    data = (MyData)sdi;

    Object[] r=getRow(); // get row, blocks when needed!
    if (data.onRow<data.myArray.length)
    {
    data.outputRowMeta = (RowMetaInterface)getInputRowMeta().clone();

    Object myValue = new String(data.myArray[data.onRow]);
    Object[] outputRow = RowDataUtil.addValueData(r, data.outputRowMeta.size()-1, myValue);
    putRow(data.outputRowMeta, outputRow); // copy row to possible alternate rowset(s).
    ++data.onRow;

    }
    else
    {
    setOutputDone();
    return false;
    }

    if (first)
    {
    first = false;

    data.outputRowMeta = (RowMetaInterface)getInputRowMeta().clone();
    meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
    }


    if (checkFeedback(linesRead)) logBasic("Linenr "+linesRead); // Some basic logging every 5000 rows.

    return true;
    }


    Thanks in advance!

    Marc Pike

  2. #2

    Default

    All I am basically looking for is how to add to the stream a collection of values within the processRows method of a plugin.

    Thanks in advance!

    Marc Pike

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

    Default

    Look e.g. at Add sequence or row generator for small steps... you have to change your metadata once, and then just add the data value to each row.

    Regards,
    Sven

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.