@Test public void testGetFieldsEmptyInput() throws Exception { RowMeta outputRowMeta = new RowMeta(); MergeJoinMeta meta = new MergeJoinMeta(); RowMeta inputRow1 = new RowMeta(); ValueMetaInteger field1_row1 = new ValueMetaInteger( "field1" ); field1_row1.setOrigin( "inputStep1" ); inputRow1.addValueMeta( field1_row1 ); ValueMetaString field2_row1 = new ValueMetaString( "field2" ); field2_row1.setOrigin( "inputStep1" ); inputRow1.addValueMeta( field2_row1 ); RowMeta inputRow2 = new RowMeta(); ValueMetaString field1_row2 = new ValueMetaString( "field1" ); field1_row2.setOrigin( "inputStep2" ); inputRow2.addValueMeta( field1_row2 ); ValueMetaString field3_row2 = new ValueMetaString( "field3" ); field3_row2.setOrigin( "inputStep2" ); inputRow2.addValueMeta( field3_row2 ); StepMeta stepMeta = new StepMeta( "Merge", meta ); meta.getFields( outputRowMeta, "Merge Join", new RowMetaInterface[]{ inputRow1, inputRow2 }, stepMeta, new Variables(), null, null ); assertNotNull( outputRowMeta ); assertFalse( outputRowMeta.isEmpty() ); assertEquals( 4, outputRowMeta.size() ); List<ValueMetaInterface> vmi = outputRowMeta.getValueMetaList(); assertNotNull( vmi ); ValueMetaInterface field1 = outputRowMeta.getValueMeta( 0 ); assertNotNull( field1 ); assertEquals( "field1", field1.getName() ); assertTrue( field1 instanceof ValueMetaInteger ); assertEquals( "inputStep1", field1.getOrigin() ); ValueMetaInterface field2 = outputRowMeta.getValueMeta( 1 ); assertNotNull( field2 ); assertEquals( "field2", field2.getName() ); assertTrue( field2 instanceof ValueMetaString ); assertEquals( "inputStep1", field2.getOrigin() ); ValueMetaInterface field1_1 = outputRowMeta.getValueMeta( 2 ); assertNotNull( field1_1 ); assertEquals( "field1_1", field1_1.getName() ); assertTrue( field1_1 instanceof ValueMetaString ); assertEquals( "Merge Join", field1_1.getOrigin() ); ValueMetaInterface field3 = outputRowMeta.getValueMeta( 3 ); assertNotNull( field3 ); assertEquals( "field3", field3.getName() ); assertTrue( field3 instanceof ValueMetaString ); assertEquals( "inputStep2", field3.getOrigin() ); }
public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null ) { for ( int i = 0; i < info.length; i++ ) { if ( info[i] != null ) { r.mergeRowMeta( info[i], name ); } } } for ( int i = 0; i < r.size(); i++ ) { ValueMetaInterface vmi = r.getValueMeta( i ); if ( vmi != null && Utils.isEmpty( vmi.getName() ) ) { vmi.setOrigin( name ); } } return; }
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null ) { for ( int i = 0; i < info.length; i++ ) { if ( info[i] != null ) { r.mergeRowMeta( info[i], name ); } } } for ( int i = 0; i < r.size(); i++ ) { ValueMetaInterface vmi = r.getValueMeta( i ); if ( vmi != null && Utils.isEmpty( vmi.getName() ) ) { vmi.setOrigin( name ); } } return; } }
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null ) { for ( int i = 0; i < info.length; i++ ) { if ( info[i] != null ) { r.mergeRowMeta( info[i], name ); } } } for ( int i = 0; i < r.size(); i++ ) { ValueMetaInterface vmi = r.getValueMeta( i ); if ( vmi != null && Utils.isEmpty( vmi.getName() ) ) { vmi.setOrigin( name ); } } return; } MergeJoinMeta(); }
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null ) { for ( int i = 0; i < info.length; i++ ) { if ( info[i] != null ) { r.mergeRowMeta( info[i], name ); } } } for ( int i = 0; i < r.size(); i++ ) { ValueMetaInterface vmi = r.getValueMeta( i ); if ( vmi != null && Utils.isEmpty( vmi.getName() ) ) { vmi.setOrigin( name ); } } return; } MergeJoinMeta(); String getJoinType(); void setJoinType( String joinType ); String[] getKeyFields1(); void setKeyFields1( String[] keyFields1 ); String[] getKeyFields2(); void setKeyFields2( String[] keyFields2 ); boolean excludeFromRowLayoutVerification(); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrKeys1, int nrKeys2 ); Object clone(); String getXML(); void setDefault(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void searchInfoAndTargetSteps( List<StepMeta> steps ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
                     RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
                     Repository repository, IMetaStore metaStore ); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
                                Trans trans ); StepDataInterface getStepData(); StepIOMetaInterface getStepIOMeta(); void resetStepIoMeta(); TransformationType[] getSupportedTransformationTypes(); }
MergeJoinMeta extends BaseStepMeta implements StepMetaInterface { public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( info != null ) { for ( int i = 0; i < info.length; i++ ) { if ( info[i] != null ) { r.mergeRowMeta( info[i], name ); } } } for ( int i = 0; i < r.size(); i++ ) { ValueMetaInterface vmi = r.getValueMeta( i ); if ( vmi != null && Utils.isEmpty( vmi.getName() ) ) { vmi.setOrigin( name ); } } return; } MergeJoinMeta(); String getJoinType(); void setJoinType( String joinType ); String[] getKeyFields1(); void setKeyFields1( String[] keyFields1 ); String[] getKeyFields2(); void setKeyFields2( String[] keyFields2 ); boolean excludeFromRowLayoutVerification(); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrKeys1, int nrKeys2 ); Object clone(); String getXML(); void setDefault(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void searchInfoAndTargetSteps( List<StepMeta> steps ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
                     RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
                     Repository repository, IMetaStore metaStore ); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr,
                                Trans trans ); StepDataInterface getStepData(); StepIOMetaInterface getStepIOMeta(); void resetStepIoMeta(); TransformationType[] getSupportedTransformationTypes(); static final String[] join_types; static final boolean[] one_optionals; static final boolean[] two_optionals; }