use of org.teiid.query.optimizer.capabilities.CapabilitiesFinder in project teiid by teiid.
the class TestAggregateProcessing method testSidewaysCorrelationBelowAggregation.
@Test
public void testSidewaysCorrelationBelowAggregation() throws Exception {
String sql = "select e1 from (SELECT sc.e1 FROM pm1.g1 sc, table(exec pm1.vsp21(sc.e2+1) ) as f ) as x group by e1";
// $NON-NLS-1$
Command command = helpParse(sql);
CapabilitiesFinder capFinder = TestOptimizer.getGenericFinder();
HardcodedDataManager dataManager = new HardcodedDataManager();
// $NON-NLS-1$
dataManager.addData(// $NON-NLS-1$
"SELECT g_0.e2, g_0.e1 FROM pm1.g1 AS g_0", new List[] { // $NON-NLS-1$
Arrays.asList(1, "1"), // $NON-NLS-1$
Arrays.asList(2, "2") });
// $NON-NLS-1$
dataManager.addData(// $NON-NLS-1$
"SELECT g_0.e1, g_0.e2 FROM pm1.g1 AS g_0", new List[] { // $NON-NLS-1$
Arrays.asList("2", 2) });
ProcessorPlan plan = helpGetPlan(command, RealMetadataFactory.example1Cached(), capFinder);
List[] expected = new List[] { Arrays.asList("1"), Arrays.asList("2") };
helpProcess(plan, dataManager, expected);
}
use of org.teiid.query.optimizer.capabilities.CapabilitiesFinder in project teiid by teiid.
the class TestSQLXMLProcessing method testStaxComment.
@Test
public void testStaxComment() throws Exception {
// $NON-NLS-1$
String sql = "select * from xmltable('/*:Person/phoneNumber' passing cast(? as xml) columns x string path 'type', y string path 'number') as x";
List<?>[] expected = new List<?>[] { Arrays.asList(null, "8881112222") };
XMLInputFactory factory = XMLInputFactory.newFactory();
XMLEventReader reader = factory.createXMLEventReader(new StringReader("<Person><!--hello--><phoneNumber><number>8881112222</number></phoneNumber></Person>"));
XMLType value = new XMLType(new StAXSQLXML(new StAXSource(reader)));
value.setType(Type.DOCUMENT);
Command command = helpParse(sql);
CommandContext context = createCommandContext();
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
context.setMetadata(metadata);
CapabilitiesFinder capFinder = new DefaultCapabilitiesFinder();
ProcessorPlan plan = helpGetPlan(command, metadata, capFinder, context);
setParameterValues(Arrays.asList(value), command, context);
doProcess(plan, dataManager, expected, context);
}
Aggregations