Search in sources :

Example 6 with KettleRowException

use of org.pentaho.di.core.exception.KettleRowException in project pentaho-kettle by pentaho.

the class Append method processRow.

public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
    meta = (AppendMeta) smi;
    data = (AppendData) sdi;
    Object[] input = null;
    if (data.processHead) {
        input = getRowFrom(data.headRowSet);
        if (input == null) {
            // Switch to tail processing
            data.processHead = false;
            data.processTail = true;
        } else {
            if (data.outputRowMeta == null) {
                data.outputRowMeta = data.headRowSet.getRowMeta();
            }
        }
    }
    if (data.processTail) {
        input = getRowFrom(data.tailRowSet);
        if (input == null) {
            setOutputDone();
            return false;
        }
        if (data.outputRowMeta == null) {
            data.outputRowMeta = data.tailRowSet.getRowMeta();
        }
        if (data.firstTail) {
            data.firstTail = false;
            // read the first row of the tail.
            try {
                checkInputLayoutValid(data.headRowSet.getRowMeta(), data.tailRowSet.getRowMeta());
            } catch (KettleRowException e) {
                throw new KettleException(BaseMessages.getString(PKG, "Append.Exception.InvalidLayoutDetected"), e);
            }
        }
    }
    if (input != null) {
        putRow(data.outputRowMeta, input);
    }
    if (checkFeedback(getLinesRead())) {
        if (log.isBasic()) {
            logBasic(BaseMessages.getString(PKG, "AppendRows.LineNumber") + getLinesRead());
        }
    }
    return true;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleRowException(org.pentaho.di.core.exception.KettleRowException)

Aggregations

KettleRowException (org.pentaho.di.core.exception.KettleRowException)6 KettleException (org.pentaho.di.core.exception.KettleException)3 KettleStepException (org.pentaho.di.core.exception.KettleStepException)3 CheckResult (org.pentaho.di.core.CheckResult)2 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)2 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)2 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)2 IOException (java.io.IOException)1 Hashtable (java.util.Hashtable)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 MessageBox (org.eclipse.swt.widgets.MessageBox)1 Database (org.pentaho.di.core.database.Database)1 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 KettleMissingPluginsException (org.pentaho.di.core.exception.KettleMissingPluginsException)1 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)1 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1 Point (org.pentaho.di.core.gui.Point)1 RowMeta (org.pentaho.di.core.row.RowMeta)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1