Search in sources :

Example 1 with MergeJoinMeta

use of org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta in project pentaho-kettle by pentaho.

the class MergeJoinDialog method getKeys1.

private void getKeys1() {
    MergeJoinMeta joinMeta = new MergeJoinMeta();
    getMeta(joinMeta);
    try {
        List<StreamInterface> infoStreams = joinMeta.getStepIOMeta().getInfoStreams();
        StepMeta stepMeta = infoStreams.get(0).getStepMeta();
        if (stepMeta != null) {
            RowMetaInterface prev = transMeta.getStepFields(stepMeta);
            if (prev != null) {
                BaseStepDialog.getFieldsFromPrevious(prev, wKeys1, 1, new int[] { 1 }, new int[] {}, -1, -1, null);
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "MergeJoinDialog.ErrorGettingFields.DialogTitle"), BaseMessages.getString(PKG, "MergeJoinDialog.ErrorGettingFields.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) MergeJoinMeta(org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 2 with MergeJoinMeta

use of org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta in project pentaho-kettle by pentaho.

the class MergeJoinDialog method getKeys2.

private void getKeys2() {
    MergeJoinMeta joinMeta = new MergeJoinMeta();
    getMeta(joinMeta);
    try {
        List<StreamInterface> infoStreams = joinMeta.getStepIOMeta().getInfoStreams();
        StepMeta stepMeta = infoStreams.get(1).getStepMeta();
        if (stepMeta != null) {
            RowMetaInterface prev = transMeta.getStepFields(stepMeta);
            if (prev != null) {
                BaseStepDialog.getFieldsFromPrevious(prev, wKeys2, 1, new int[] { 1 }, new int[] {}, -1, -1, null);
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "MergeJoinDialog.ErrorGettingFields.DialogTitle"), BaseMessages.getString(PKG, "MergeJoinDialog.ErrorGettingFields.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) MergeJoinMeta(org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Example 3 with MergeJoinMeta

use of org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta in project pentaho-metaverse by pentaho.

the class MetaverseValidationIT method testMergeJoinStepNode_duplicateFieldNames.

@Test
public void testMergeJoinStepNode_duplicateFieldNames() throws Exception {
    MergeJoinStepNode node = root.getMergeJoinStepNode();
    MergeJoinMeta meta = (MergeJoinMeta) getStepMeta(node);
    assertEquals(meta.getJoinType(), node.getJoinType());
    assertEquals(meta.getKeyFields1().length, node.getJoinFieldsLeft().size());
    assertEquals(meta.getKeyFields2().length, node.getJoinFieldsRight().size());
    Iterable<StreamFieldNode> usedFields = node.getStreamFieldNodesUses();
    for (StreamFieldNode usedField : usedFields) {
        boolean isOnLeft = node.getJoinFieldsLeft().contains(usedField.getName());
        boolean isOnRight = node.getJoinFieldsRight().contains(usedField.getName());
        assertTrue(isOnLeft || isOnRight);
        assertTrue(usedField.getFieldNodesThatIJoinTo() != null);
        assertTrue(usedField.getFieldNodesThatJoinToMe() != null);
    }
    Iterable<StreamFieldNode> outputFields = node.getOutputStreamFields();
    assertEquals(getExpectedOutputFieldCount(meta), getIterableSize(outputFields));
    for (StreamFieldNode outputField : outputFields) {
        // these should have derives links
        assertTrue(outputField.getFieldNodesThatDeriveMe() != null);
    }
}
Also used : MergeJoinMeta(org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta) StreamFieldNode(org.pentaho.metaverse.frames.StreamFieldNode) MergeJoinStepNode(org.pentaho.metaverse.frames.MergeJoinStepNode) Test(org.junit.Test)

Aggregations

MergeJoinMeta (org.pentaho.di.trans.steps.mergejoin.MergeJoinMeta)3 KettleException (org.pentaho.di.core.exception.KettleException)2 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)2 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)2 StepMeta (org.pentaho.di.trans.step.StepMeta)2 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 Test (org.junit.Test)1 MergeJoinStepNode (org.pentaho.metaverse.frames.MergeJoinStepNode)1 StreamFieldNode (org.pentaho.metaverse.frames.StreamFieldNode)1