use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testAggNotParitioned.
@Test
public void testAggNotParitioned() throws Exception {
QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT max(phys.a) FROM MultiModel.Phys";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("y") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT MAX(g_0.a) FROM MultiModel.Phys AS g_0", new List<?>[] { Arrays.asList("y") });
ProcessorPlan plan = helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
TestOptimizer.checkNodeTypes(plan, new int[] { // Access
3, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
1, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
1 });
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiReplacementWithLimit1.
@Test
public void testMultiReplacementWithLimit1() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT a, b FROM MultiModel.Phys limit 1, 1";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("x", "z") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a AS c_0, g_0.b AS c_1 FROM MultiModel.Phys AS g_0 LIMIT 2", new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("y", "z"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("x", "z") });
RelationalPlan plan = (RelationalPlan) helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
assertTrue(plan.getRootNode() instanceof LimitNode);
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestAuthorizationValidationVisitor method testCreateForeignTemp.
@Test
public void testCreateForeignTemp() throws Exception {
DataPolicyMetadata dpm = exampleAuthSvc1();
dpm.setAllowCreateTemporaryTables(false);
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("create foreign temporary table x (id string) on bqt1", RealMetadataFactory.exampleBQTCached(), new String[] { "x" }, RealMetadataFactory.exampleBQTVDB(), dpm);
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("create foreign temporary table x (id string) on bqt1", RealMetadataFactory.exampleBQTCached(), new String[] {}, RealMetadataFactory.exampleBQTVDB(), examplePolicyBQT());
TempTableTestHarness harness = new TempTableTestHarness();
harness.setUp(RealMetadataFactory.exampleBQTCached(), new HardcodedDataManager());
harness.execute("create foreign temporary table x (id string) on bqt1", new List[] { Arrays.asList(0) });
helpTest("insert into x (id) values ('a')", harness.getMetadata(), new String[] { "x.id" }, RealMetadataFactory.exampleBQTVDB(), dpm);
// we have create on bqt1
helpTest("insert into x (id) values ('a')", harness.getMetadata(), new String[] {}, RealMetadataFactory.exampleBQTVDB(), examplePolicyBQT());
// we don't have read on bqt1
helpTest("select * from x", harness.getMetadata(), new String[] { "x.id" }, RealMetadataFactory.exampleBQTVDB(), examplePolicyBQT());
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestCallableStatement method testProcedurePlanCaching.
@Test
public void testProcedurePlanCaching() throws Exception {
// $NON-NLS-1$
String sql = "{? = call BQT_V.v_spTest9(?)}";
List values = new ArrayList();
values.add(1);
List[] expected = new List[1];
expected[0] = Arrays.asList(1);
HardcodedDataManager dataManager = new HardcodedDataManager();
dataManager.addData("ret = EXEC pm4.spTest9(1)", expected);
TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
use of org.teiid.query.processor.HardcodedDataManager in project teiid by teiid.
the class TestCallableStatement method testInvalidReturn.
@Test(expected = QueryResolverException.class)
public void testInvalidReturn() throws Exception {
// $NON-NLS-1$
String sql = "{? = call pm2.spTest8(?, ?)}";
List values = Arrays.asList(2);
List[] expected = new List[0];
HardcodedDataManager dataManager = new HardcodedDataManager();
TestPreparedStatement.helpTestProcessing(sql, values, expected, dataManager, RealMetadataFactory.exampleBQTCached(), true, RealMetadataFactory.exampleBQTVDB());
}
Aggregations