Search in sources :

Example 51 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class TransPartitioningTest method prepareStepMetas_cl1_cl2.

/**
 * This is a case when we have 2 steps, but partitioned differently
 *
 * @throws KettlePluginException
 */
private void prepareStepMetas_cl1_cl2() throws KettlePluginException {
    StepMeta dummy1 = new StepMeta(ONE, null);
    StepMeta dummy2 = new StepMeta(TWO, null);
    PartitionSchema schema1 = new PartitionSchema("p1", Arrays.asList(new String[] { PID1, PID2 }));
    PartitionSchema schema2 = new PartitionSchema("p2", Arrays.asList(new String[] { PID1, PID2 }));
    StepPartitioningMeta partMeta1 = new StepPartitioningMeta("Mirror to all partitions", schema1);
    StepPartitioningMeta partMeta2 = new StepPartitioningMeta("Mirror to all partitions", schema2);
    partMeta1.setPartitionSchemaName(schema1.getName());
    partMeta2.setPartitionSchemaName(schema2.getName());
    dummy1.setStepPartitioningMeta(partMeta1);
    dummy2.setStepPartitioningMeta(partMeta2);
    chain.add(dummy1);
    chain.add(dummy2);
    for (StepMeta item : chain) {
        item.setStepMetaInterface(new DummyTransMeta());
    }
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) StepPartitioningMeta(org.pentaho.di.trans.step.StepPartitioningMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)

Example 52 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class TransPartitioningTest method prepareStepMetas_cl1_cl1.

/**
 * This case simulates when we do have 2 step partitioned with one same partitioner We want to get a 'swim-lanes'
 * transformation
 *
 * @throws KettlePluginException
 */
private void prepareStepMetas_cl1_cl1() throws KettlePluginException {
    StepMeta dummy1 = new StepMeta(ONE, null);
    StepMeta dummy2 = new StepMeta(TWO, null);
    PartitionSchema schema = new PartitionSchema("p1", Arrays.asList(new String[] { PID1, PID2 }));
    // for delayed binding StepPartitioning meta does not achieve
    // schema name when using in constructor so we have to set it
    // explicitly. See equals implementation for StepPartitioningMeta.
    StepPartitioningMeta partMeta = new StepPartitioningMeta("Mirror to all partitions", schema);
    // that is what I am talking about:
    partMeta.setPartitionSchemaName(schema.getName());
    dummy1.setStepPartitioningMeta(partMeta);
    dummy2.setStepPartitioningMeta(partMeta);
    chain.add(dummy1);
    chain.add(dummy2);
    for (StepMeta item : chain) {
        item.setStepMetaInterface(new DummyTransMeta());
    }
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) StepPartitioningMeta(org.pentaho.di.trans.step.StepPartitioningMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) DummyTransMeta(org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)

Example 53 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class PurRepositoryIT method doesNotChangeFileWhenFailsToRename_partitions.

@Test
public void doesNotChangeFileWhenFailsToRename_partitions() throws Exception {
    final PartitionSchema schema1 = new PartitionSchema();
    final PartitionSchema schema2 = new PartitionSchema();
    try {
        testDoesNotChangeFileWhenFailsToRename(schema1, schema2, new Callable<RepositoryElementInterface>() {

            @Override
            public RepositoryElementInterface call() throws Exception {
                return repository.loadPartitionSchema(schema2.getObjectId(), null);
            }
        });
    } finally {
        repository.deletePartitionSchema(schema1.getObjectId());
        repository.deletePartitionSchema(schema2.getObjectId());
    }
}
Also used : RepositoryElementInterface(org.pentaho.di.repository.RepositoryElementInterface) PartitionSchema(org.pentaho.di.partition.PartitionSchema) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) BeansException(org.springframework.beans.BeansException) MetaStoreNamespaceExistsException(org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException) MetaStoreDependenciesExistsException(org.pentaho.metastore.api.exceptions.MetaStoreDependenciesExistsException) SAXException(org.xml.sax.SAXException) KettleException(org.pentaho.di.core.exception.KettleException) SAXParseException(org.xml.sax.SAXParseException) Test(org.junit.Test)

Example 54 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class PurRepository_SharedObjects_IT method partition.

private static PartitionSchema partition() {
    PartitionSchema schema = new PartitionSchema();
    schema.setName("testPartitionSchema");
    return schema;
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema)

Example 55 with PartitionSchema

use of org.pentaho.di.partition.PartitionSchema in project pentaho-kettle by pentaho.

the class SlaveStepCopyPartitionDistributionTest method equalsDifferentStepsTest.

@Test
public void equalsDifferentStepsTest() {
    SlaveStepCopyPartitionDistribution other = new SlaveStepCopyPartitionDistribution();
    List<PartitionSchema> schemas = new ArrayList<>();
    schemas.add(new PartitionSchema());
    other.setOriginalPartitionSchemas(schemas);
    Assert.assertFalse(slaveStep.equals(other));
}
Also used : PartitionSchema(org.pentaho.di.partition.PartitionSchema) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

PartitionSchema (org.pentaho.di.partition.PartitionSchema)74 KettleException (org.pentaho.di.core.exception.KettleException)26 TransMeta (org.pentaho.di.trans.TransMeta)19 StepMeta (org.pentaho.di.trans.step.StepMeta)19 ClusterSchema (org.pentaho.di.cluster.ClusterSchema)18 SlaveServer (org.pentaho.di.cluster.SlaveServer)18 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)17 StepPartitioningMeta (org.pentaho.di.trans.step.StepPartitioningMeta)17 Test (org.junit.Test)16 ArrayList (java.util.ArrayList)15 ObjectId (org.pentaho.di.repository.ObjectId)14 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)10 List (java.util.List)8 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)8 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)6 StringObjectId (org.pentaho.di.repository.StringObjectId)6 PartitionSchemaDialog (org.pentaho.di.ui.partition.dialog.PartitionSchemaDialog)6 MessageBox (org.eclipse.swt.widgets.MessageBox)5 Point (org.pentaho.di.core.gui.Point)5 IOException (java.io.IOException)4