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);
}
}
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);
}
}
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);
}
}
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
}
}
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);
}
}
Aggregations