Search in sources :

Example 26 with TeiidException

use of org.teiid.core.TeiidException in project teiid by teiid.

the class TestProcessor method sampleData2b.

public static void sampleData2b(FakeDataManager dataMgr, QueryMetadataInterface metadata) {
    try {
        dataMgr.registerTuples(metadata, "pm1.g1", new List[] { // $NON-NLS-1$
        Arrays.asList(new Object[] { "aa ", new Integer(0), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "bb   ", new Integer(1), Boolean.TRUE, null }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "cc  ", new Integer(2), Boolean.FALSE, new Double(0.0) }) });
        dataMgr.registerTuples(metadata, "pm2.g1", new List[] { // $NON-NLS-1$
        Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }) });
        dataMgr.registerTuples(metadata, "pm4.g1", new List[] { // $NON-NLS-1$
        Arrays.asList(new Object[] { "aa ", new Integer(0), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "bb   ", new Integer(1), Boolean.TRUE, null }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "cc  ", new Integer(2), Boolean.FALSE, new Double(0.0) }) });
    } catch (TeiidException e) {
        throw new RuntimeException(e);
    }
}
Also used : BigInteger(java.math.BigInteger) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) TeiidException(org.teiid.core.TeiidException)

Example 27 with TeiidException

use of org.teiid.core.TeiidException in project teiid by teiid.

the class TestProcessor method sampleDataBQT_defect11682.

/**
 * Just want to register two rows of all the integral types to test AVG
 * @param dataMgr
 * @since 4.2
 */
private void sampleDataBQT_defect11682(FakeDataManager dataMgr) {
    QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
    try {
        List[] tuples = new List[2];
        for (int i = 1; i <= tuples.length; i++) {
            int index = i - 1;
            tuples[index] = new ArrayList(17);
            // IntKey
            tuples[index].add(new Integer(i));
            tuples[index].add(null);
            tuples[index].add(new Integer(i));
            tuples[index].add(null);
            tuples[index].add(new Float(i));
            tuples[index].add(new Long(i));
            tuples[index].add(new Double(i));
            tuples[index].add(new Byte((byte) i));
            tuples[index].add(null);
            tuples[index].add(null);
            tuples[index].add(null);
            tuples[index].add(null);
            tuples[index].add(null);
            tuples[index].add(new Short((short) i));
            // $NON-NLS-1$
            tuples[index].add(new BigInteger(i + ""));
            // $NON-NLS-1$
            tuples[index].add(new BigDecimal(i + ".0"));
            tuples[index].add(null);
        }
        // $NON-NLS-1$
        dataMgr.registerTuples(metadata, "bqt1.smalla", tuples);
    } catch (TeiidException e) {
        throw new RuntimeException(e);
    }
}
Also used : BigDecimal(java.math.BigDecimal) TeiidException(org.teiid.core.TeiidException) BigInteger(java.math.BigInteger) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) BigInteger(java.math.BigInteger) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface)

Example 28 with TeiidException

use of org.teiid.core.TeiidException in project teiid by teiid.

the class TestProcessor method sampleData2a.

private void sampleData2a(FakeDataManager dataMgr) {
    QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
    try {
        dataMgr.registerTuples(metadata, "pm1.g1", new List[] { // $NON-NLS-1$
        Arrays.asList(new Object[] { "a", new Integer(0), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "b", new Integer(1), Boolean.TRUE, null }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "c", new Integer(2), Boolean.FALSE, new Double(0.0) }) });
        dataMgr.registerTuples(metadata, "pm2.g1", new List[] { // $NON-NLS-1$
        Arrays.asList(new Object[] { "b", new Integer(0), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "b", new Integer(7), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "d", new Integer(3), Boolean.TRUE, new Double(7.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "e", new Integer(1), Boolean.TRUE, null }) });
        dataMgr.registerTuples(metadata, "pm4.g1", new List[] { // $NON-NLS-1$
        Arrays.asList(new Object[] { "aa", new Integer(0), Boolean.FALSE, new Double(2.0) }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "bb", new Integer(1), Boolean.TRUE, null }), // $NON-NLS-1$
        Arrays.asList(new Object[] { "cc", new Integer(2), Boolean.FALSE, new Double(0.0) }) });
    } catch (TeiidException e) {
        throw new RuntimeException(e);
    }
}
Also used : BigInteger(java.math.BigInteger) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) TeiidException(org.teiid.core.TeiidException)

Example 29 with TeiidException

use of org.teiid.core.TeiidException in project teiid by teiid.

the class TestProcessor method testUpdateNonDeterministic.

@Test
public void testUpdateNonDeterministic() {
    String sql = "update pm1.g2 set e1 = (with u (id) as (select uuid()) select id from u) where e1 = 'xxxx'";
    FakeDataManager dataManager = new FakeDataManager();
    sampleData1(dataManager);
    BasicSourceCapabilities caps = getTypicalCapabilities();
    ProcessorPlan plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(caps));
    helpProcess(plan, dataManager, new List[] { Arrays.asList(0) });
    // same as above
    sql = "update pm1.g2 set e1 = (select uuid()) where e1 = 'xxxx'";
    plan = helpGetPlan(sql, RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(caps));
    helpProcess(plan, dataManager, new List[] { Arrays.asList(0) });
    sql = "update pm1.g2 set e1 = uuid() where e1 = 'xxxx'";
    try {
        helpGetPlan(helpParse(sql), RealMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(caps), createCommandContext());
        fail();
    } catch (TeiidException e) {
    // no primary key
    }
}
Also used : BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) DefaultCapabilitiesFinder(org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder) TeiidException(org.teiid.core.TeiidException) Test(org.junit.Test)

Example 30 with TeiidException

use of org.teiid.core.TeiidException in project teiid by teiid.

the class TestProcessor method sampleDataBQTSmall.

private void sampleDataBQTSmall(FakeDataManager dataMgr) {
    QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
    try {
        List[] tuples = new List[1];
        for (int i = 0; i < tuples.length; i++) {
            tuples[i] = new ArrayList(17);
            tuples[i].add(new Integer(i));
            for (int j = 0; j < 16; j++) {
                tuples[i].add(null);
            }
        }
        // $NON-NLS-1$
        dataMgr.registerTuples(metadata, "bqt1.smalla", tuples);
    } catch (TeiidException e) {
        throw new RuntimeException(e);
    }
}
Also used : BigInteger(java.math.BigInteger) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) TeiidException(org.teiid.core.TeiidException)

Aggregations

TeiidException (org.teiid.core.TeiidException)85 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)26 ArrayList (java.util.ArrayList)14 Test (org.junit.Test)13 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)10 SQLException (java.sql.SQLException)9 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)8 BigInteger (java.math.BigInteger)6 Column (org.teiid.metadata.Column)6 Command (org.teiid.query.sql.lang.Command)6 TranslatorException (org.teiid.translator.TranslatorException)6 IOException (java.io.IOException)5 TeiidProcessingException (org.teiid.core.TeiidProcessingException)5 List (java.util.List)4 EdmEntityType (org.apache.olingo.commons.api.edm.EdmEntityType)4 ODataApplicationException (org.apache.olingo.server.api.ODataApplicationException)4 TeiidComponentException (org.teiid.core.TeiidComponentException)4 UpdateResponse (org.teiid.odata.api.UpdateResponse)4 Update (org.teiid.query.sql.lang.Update)4 SocketTimeoutException (java.net.SocketTimeoutException)3