Search in sources :

Example 1 with MultiSourceMetadataWrapper

use of org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper in project teiid by teiid.

the class TestValidator method testMultiSourceProcValue.

@Test
public void testMultiSourceProcValue() throws Exception {
    Set<String> models = new HashSet<String>();
    models.add("MultiModel");
    // $NON-NLS-1$
    helpValidate("exec MultiModel.proc('a', (select 1))", new String[] {}, new MultiSourceMetadataWrapper(RealMetadataFactory.exampleMultiBinding(), models));
}
Also used : MultiSourceMetadataWrapper(org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with MultiSourceMetadataWrapper

use of org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper in project teiid by teiid.

the class TestValidator method testDisallowUpdateOnMultisourceElement.

@Test
public void testDisallowUpdateOnMultisourceElement() throws Exception {
    Set<String> models = new HashSet<String>();
    models.add("pm1");
    // $NON-NLS-1$
    ValidatorReport report = helpValidateInModeler("pm1.vsp36", "UPDATE PM1.G1 set SOURCE_NAME='blah'", new MultiSourceMetadataWrapper(RealMetadataFactory.example1(), models));
    assertEquals(report.toString(), 1, report.getItems().size());
}
Also used : MultiSourceMetadataWrapper(org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with MultiSourceMetadataWrapper

use of org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper in project teiid by teiid.

the class TestValidator method testDisallowProjectIntoMultiSource.

/**
 * TODO: this should be allowable
 */
@Test
public void testDisallowProjectIntoMultiSource() throws Exception {
    Set<String> models = new HashSet<String>();
    models.add("pm1");
    // $NON-NLS-1$
    helpValidate("insert into pm1.g1 select pm1.g1.*, 1 from pm1.g1", new String[] { "pm1.g1" }, new MultiSourceMetadataWrapper(RealMetadataFactory.example1(), models));
}
Also used : MultiSourceMetadataWrapper(org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 4 with MultiSourceMetadataWrapper

use of org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper in project teiid by teiid.

the class TestValidator method testMultiSourceInsert.

@Test
public void testMultiSourceInsert() throws Exception {
    Set<String> models = new HashSet<String>();
    models.add("pm1");
    // $NON-NLS-1$
    helpValidate("insert into pm1.g1 (e1) values (1)", new String[] { "pm1.g1", "pm1.g1.SOURCE_NAME" }, new MultiSourceMetadataWrapper(RealMetadataFactory.example1(), models));
}
Also used : MultiSourceMetadataWrapper(org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 5 with MultiSourceMetadataWrapper

use of org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper in project teiid by teiid.

the class CompositeVDB method metadataLoadFinished.

public void metadataLoadFinished(boolean allowEnv) {
    if (this.metadataloadFinished) {
        return;
    }
    this.metadataloadFinished = true;
    MetadataStore mergedStore = getMetadataStore();
    // the order of the models is important for resolving ddl
    // TODO we might consider not using the intermediate MetadataStore
    List<Schema> schemas = mergedStore.getSchemaList();
    schemas.clear();
    for (ModelMetaData model : this.vdb.getModelMetaDatas().values()) {
        Schema s = mergedStore.getSchema(model.getName());
        if (s != null) {
            schemas.add(s);
        } else {
            mergedStore.getSchemas().remove(model.getName());
        }
    }
    if (this.children != null && !this.children.isEmpty()) {
        for (CompositeVDB child : this.children.values()) {
            MetadataStore childStore = child.getMetadataStore();
            if (childStore != null) {
                mergedStore.merge(childStore);
            }
        }
    }
    TransformationMetadata metadata = buildTransformationMetaData(mergedVDB, getVisibilityMap(), mergedStore, getUDF(), systemFunctions, this.additionalStores, allowEnv);
    QueryMetadataInterface qmi = metadata;
    Map<String, String> multiSourceModels = MultiSourceMetadataWrapper.getMultiSourceModels(mergedVDB);
    if (multiSourceModels != null && !multiSourceModels.isEmpty()) {
        qmi = new MultiSourceMetadataWrapper(metadata, multiSourceModels);
    }
    mergedVDB.addAttchment(QueryMetadataInterface.class, qmi);
    mergedVDB.addAttchment(TransformationMetadata.class, metadata);
    mergedVDB.addAttchment(MetadataStore.class, mergedStore);
}
Also used : CompositeMetadataStore(org.teiid.query.metadata.CompositeMetadataStore) MetadataStore(org.teiid.metadata.MetadataStore) MultiSourceMetadataWrapper(org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper) TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) Schema(org.teiid.metadata.Schema) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Aggregations

MultiSourceMetadataWrapper (org.teiid.dqp.internal.process.multisource.MultiSourceMetadataWrapper)5 HashSet (java.util.HashSet)4 Test (org.junit.Test)4 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)1 MetadataStore (org.teiid.metadata.MetadataStore)1 Schema (org.teiid.metadata.Schema)1 CompositeMetadataStore (org.teiid.query.metadata.CompositeMetadataStore)1 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)1 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)1