step.setClusterSchema( null ); step.setClusterSchema( clusterSchema );
private static StepMeta createTestMeta() throws Exception { StepMetaInterface stepMetaInterface = mock( AbstractStepMeta.class ); when( stepMetaInterface.clone() ).thenReturn( stepMetaInterface ); StepMeta meta = new StepMeta( STEP_ID, "stepname", stepMetaInterface ); meta.setSelected( true ); meta.setDistributes( false ); meta.setCopiesString( "2" ); meta.setLocation( 1, 2 ); meta.setDraw( true ); meta.setDescription( "description" ); meta.setTerminator( true ); meta.setClusterSchemaName( "clusterSchemaName" ); boolean shouldDistribute = rand.nextBoolean(); meta.setDistributes( shouldDistribute ); if ( shouldDistribute ) { meta.setRowDistribution( selectRowDistribution() ); } Map<String, Map<String, String>> attributes = new HashMap<String, Map<String, String>>(); Map<String, String> map1 = new HashMap<String, String>(); map1.put( "1", "1" ); Map<String, String> map2 = new HashMap<String, String>(); map2.put( "2", "2" ); attributes.put( "qwerty", map1 ); attributes.put( "asdfg", map2 ); meta.setAttributesMap( attributes ); meta.setStepPartitioningMeta( createStepPartitioningMeta( "stepMethod", "stepSchema" ) ); meta.setTargetStepPartitioningMeta( createStepPartitioningMeta( "targetMethod", "targetSchema" ) ); meta.setClusterSchema( new ClusterSchema( "cluster_schema", Collections.<SlaveServer>emptyList() ) ); return meta; }
stepMeta.setClusterSchema( clusterSchema ); break;
/** * Create a copy of a step from the original transformation for use in the a slave transformation. If the step is * partitioned, the partitioning will be changed to "schemaName (slave)" * * @param stepMeta * The step to copy / clone. * @return a copy of the specified step for use in a slave transformation. */ private StepMeta addSlaveCopy( TransMeta transMeta, StepMeta stepMeta, SlaveServer slaveServer ) { StepMeta copy = (StepMeta) stepMeta.clone(); if ( copy.isPartitioned() ) { StepPartitioningMeta stepPartitioningMeta = copy.getStepPartitioningMeta(); PartitionSchema partitionSchema = stepPartitioningMeta.getPartitionSchema(); String slavePartitionSchemaName = createSlavePartitionSchemaName( partitionSchema.getName() ); PartitionSchema slaveSchema = transMeta.findPartitionSchema( slavePartitionSchemaName ); if ( slaveSchema != null ) { stepPartitioningMeta.setPartitionSchema( slaveSchema ); } // Always just start a single copy on the slave server... // Otherwise the confusion w.r.t. to partitioning & re-partitioning would be complete. // copy.setCopies( 1 ); } // Remove the clustering information on the slave transformation step // We don't need it anymore, it only confuses. // copy.setClusterSchema( null ); transMeta.addStep( copy ); return copy; }