Pentaho 将不同的元数据发送到不同的目标流-PDI

Pentaho 将不同的元数据发送到不同的目标流-PDI,pentaho,kettle,pdi,Pentaho,Kettle,Pdi,我有两个目标流(匹配和不匹配),定义如下: @Override public StepIOMetaInterface getStepIOMeta() { StepMeta stepMeta = new StepMeta(); if (ioMeta == null) { ioMeta = new StepIOMeta(true, false, false, false, false, true); StreamInterface matchS

我有两个目标流(匹配和不匹配),定义如下:

@Override
public StepIOMetaInterface getStepIOMeta() {

    StepMeta stepMeta = new StepMeta();


    if (ioMeta == null) {
        ioMeta = new StepIOMeta(true, false, false, false, false, true);

        StreamInterface matchStream = new Stream(StreamType.TARGET, null, "Matches", StreamIcon.TARGET, null);
        StreamInterface mismatchStream = new Stream(StreamType.TARGET, null, "Mismatches", StreamIcon.TARGET, null);

        ioMeta.addStream(matchStream);
        ioMeta.addStream(mismatchStream);

    }

    return ioMeta;
}
我想向这两个目标发送不同的元数据。从前面的步骤接收元数据。对于匹配,它需要是两个输入流的串联,对于不匹配,只需要第一个输入流

我被困在如何为两个目标流分别定义元数据上

感谢您的帮助。

List targets=getStepIOMeta().getTargetStreams();
 List<StreamInterface> targets=getStepIOMeta().getTargetStreams();    
      List<StreamInterface> infos=getStepIOMeta().getInfoStreams();   
       if ( info != null ) 
     {
           if(targets!=null)
            {

if(nextStep.getName().equals(targets.get(0).getStepname()))  
                    {
                        if ( info != null ) {  
                              for ( int i = 0; i < info.length; i++ ) {  
                                if ( info[i] != null ) {  
                                  r.mergeRowMeta( info[i] );  
                                }
                              }
                            }
                    }
                    if(nextStep.getName().equals(targets.get(1).getStepname()))
                    {
                        if ( info != null ) {  
                              if ( info.length > 0 && info[0] != null ) {   
                                r.mergeRowMeta( info[0] );  
                              }   
                            }  
                    }
                    if(nextStep.getName().equals(targets.get(2).getStepname()))
                    {
                        if ( info != null ) {
                              if ( info.length > 0 && info[0] != null ) {
                                r.mergeRowMeta( info[1] );
                              }
                            }  
                    }

            }
List infos=getStepIOMeta().getInfoStreams(); 如果(信息!=null) { 如果(目标!=null) { if(nextStep.getName().equals(targets.get(0.getStepname())) { 如果(info!=null){ 对于(int i=0;i0&&info[0]!=null){ r、 mergeRowMeta(信息[0]); } } } if(nextStep.getName().equals(targets.get(2.getStepname())) { 如果(信息!=null){ 如果(info.length>0&&info[0]!=null){ r、 mergeRowMeta(信息[1]); } } } }
这应该添加到getFields方法中,以便将元数据传递给目标步骤,但要做到这一点,您应该拥有目标列表并知道它们的名称,以便可以从第一步获取元数据并传递给目标