Search in sources :

Example 6 with BasicSourceCapabilities

use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.

the class TestPreparedStatementBatchedUpdate method testUpdateVarNumCmds.

/**
 * Test prepared statements that use batched updates using the same prepared
 * command with varying number of commands in the batch.
 * <p>
 * The test verifies that no errors occur when planning and executing the
 * same batched command SQL with varying number of batched command parameter
 * value sets.  For example, if the first executeBatch() call were to occur
 * with two batched commands a repeated call with only one batched command
 * should not result in an error during planning or execution.
 * <p>
 * The test also verifies that the correct SQL is pushed to the data manager
 * to verify that the parameter substitution occurred and is correct and the
 * correct number of statements made it to the data manager for the respective
 * batch command.
 * <p>
 * The batched command "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?"
 * will appear as:
 * <p>
 * UPDATE pm1.g1 SET pm1.g1.e1='a', pm1.g1.e3=false WHERE pm1.g1.e2=0
 * UPDATE pm1.g1 SET pm1.g1.e1=null, pm1.g1.e3=false WHERE pm1.g1.e2=1
 * <p>
 * UPDATE pm1.g1 SET pm1.g1.e1='a', pm1.g1.e3=false WHERE pm1.g1.e2=0
 * <p>
 * UPDATE pm1.g1 SET pm1.g1.e1='a', pm1.g1.e3=false WHERE pm1.g1.e2=0
 * UPDATE pm1.g1 SET pm1.g1.e1=null, pm1.g1.e3=false WHERE pm1.g1.e2=1
 * UPDATE pm1.g1 SET pm1.g1.e1='c', pm1.g1.e3=true WHERE pm1.g1.e2=4
 * UPDATE pm1.g1 SET pm1.g1.e1='b', pm1.g1.e3=true WHERE pm1.g1.e2=5
 * <p>
 * The result should be that three commands are in the plan cache and
 * no plan creation, validation, or execution errors will occur and
 * a predetermined set of queries were executed in the data manager.
 *
 * @throws Exception
 */
@Test
public void testUpdateVarNumCmds() throws Exception {
    // Create query
    // $NON-NLS-1$
    String preparedSql = "UPDATE pm1.g1 SET pm1.g1.e1=?, pm1.g1.e3=? WHERE pm1.g1.e2=?";
    // Create a testable prepared plan cache
    SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
    // Construct data manager with data
    FakeDataManager dataManager = new FakeDataManager();
    TestProcessor.sampleData1(dataManager);
    // Source capabilities must support batched updates
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
    caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm1", caps);
    // Something to hold our final query list
    List<String> finalQueryList = new ArrayList<String>(13);
    // Create expected results
    // first command should result in 2 rows affected
    // second command should result in 2 rows affected
    List<?>[] expected = new List[] { Arrays.asList(new Object[] { new Integer(2) }), Arrays.asList(new Object[] { new Integer(2) }) };
    // batch with two commands
    ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a", Boolean.FALSE, new Integer(0) })));
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { null, Boolean.FALSE, new Integer(1) })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1"));
    // Create the plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
    // Repeat with different number of commands in batch
    // Create expected results
    // first command should result in 2 rows affected
    expected = new List[] { Arrays.asList(new Object[] { new Integer(2) }) };
    // batch with one command
    values = new ArrayList<ArrayList<Object>>(1);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a", Boolean.FALSE, new Integer(0) })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0"));
    // Use the cached plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
    // Repeat with different number of commands in batch
    // Create expected results
    // first command should result in 2 rows affected
    // second command should result in 2 rows affected
    // third command should result in 0 rows affected
    // fourth command should result in 0 rows affected
    expected = new List[] { Arrays.asList(new Object[] { new Integer(2) }), Arrays.asList(new Object[] { new Integer(2) }), Arrays.asList(new Object[] { new Integer(0) }), Arrays.asList(new Object[] { new Integer(0) }) };
    // batch with four commands
    values = new ArrayList<ArrayList<Object>>(4);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a", Boolean.FALSE, new Integer(0) })));
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { null, Boolean.FALSE, new Integer(1) })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "c", Boolean.TRUE, new Integer(4) })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "b", Boolean.TRUE, new Integer(5) })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = null, e3 = FALSE WHERE pm1.g1.e2 = 1"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = TRUE WHERE pm1.g1.e2 = 4"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 5"));
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
    // Verify all the queries that were run
    // $NON-NLS-1$
    assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries());
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) FakeDataManager(org.teiid.query.processor.FakeDataManager) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 7 with BasicSourceCapabilities

use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.

the class TestPreparedStatementBatchedUpdate method testBatchedUpdatePushdown2.

/**
 * Test batch handling when a function cannot be pushed
 */
@Test
public void testBatchedUpdatePushdown2() throws Exception {
    // TODO: just use straight ddl
    TransformationMetadata metadata = RealMetadataFactory.example1Cached();
    // $NON-NLS-1$
    String preparedSql = "insert into pm1.g1 (e1) values (? + 1)";
    // Create a testable prepared plan cache
    SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
    // Construct data manager with data
    HardcodedDataManager dataManager = new HardcodedDataManager(metadata);
    dataManager.addData("INSERT INTO g1 (e1) VALUES ('4')", Arrays.asList(1));
    dataManager.addData("INSERT INTO g1 (e1) VALUES ('6')", Arrays.asList(1));
    // Source capabilities must support batched updates
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
    caps.setFunctionSupport(SourceSystemFunctions.CONVERT, false);
    caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm1", caps);
    // batch with two commands
    ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(3)));
    values.add(new ArrayList<Object>(Arrays.asList(5)));
    List<?>[] expected = new List[] { Arrays.asList(1), Arrays.asList(1) };
    // Create the plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, metadata, prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) HardcodedDataManager(org.teiid.query.processor.HardcodedDataManager) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 8 with BasicSourceCapabilities

use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.

the class TestPreparedStatementBatchedUpdate method testUpdateVarNumCmds_Virtual.

/**
 * Test prepared statements that use batched updates using the same prepared
 * command with varying number of commands in the batch.  Update is
 * performed against a view model instead of a source model.
 * <p>
 * The test verifies that no errors occur when planning and executing the
 * same batched command SQL with varying number of batched command parameter
 * value sets.  For example, if the first executeBatch() call were to occur
 * with two batched commands a repeated call with only one batched command
 * should not result in an error during planning or execution.
 * <p>
 * The test also verifies that the correct SQL is pushed to the data manager
 * to verify that the parameter substitution occurred and is correct and the
 * correct number of statements made it to the data manager for the respective
 * batch command.
 * <p>
 * The batched command "UPDATE vm1.g1 SET vm1.g1.e1=?, vm1.g1.e3=? WHERE vm1.g1.e2=?"
 * will appear as:
 * <p>
 * UPDATE pm1.g1 SET e1='a', e3=false WHERE pm1.g1.e2=0
 * UPDATE pm1.g1 SET e1='b', e3=true WHERE pm1.g1.e2=1
 * <p>
 * UPDATE pm1.g1 SET e1='c', e3=false WHERE pm1.g1.e2=1
 * <p>
 * UPDATE pm1.g1 SET e1='d', e3=false WHERE pm1.g1.e2=1
 * UPDATE pm1.g1 SET e1='e', e3=false WHERE pm1.g1.e2=0
 * UPDATE pm1.g1 SET e1='f', e3=true WHERE pm1.g1.e2=2
 * UPDATE pm1.g1 SET e1='g', e3=true WHERE pm1.g1.e2=3
 * <p>
 * The result should be that three commands are in the plan cache and
 * no plan creation, validation, or execution errors will occur and
 * a predetermined set of queries were executed in the data manager.
 *
 * @throws Exception
 */
@Test
public void testUpdateVarNumCmds_Virtual() throws Exception {
    // Create query
    // $NON-NLS-1$
    String preparedSql = "UPDATE vm1.g1 SET vm1.g1.e1=?, vm1.g1.e3=? WHERE vm1.g1.e2=?";
    // Create a testable prepared plan cache
    SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
    // Construct data manager with data
    FakeDataManager dataManager = new FakeDataManager();
    TestProcessor.sampleData1(dataManager);
    // Source capabilities must support batched updates
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
    caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm1", caps);
    // Something to hold our final query list
    List<String> finalQueryList = new ArrayList<String>(13);
    // Create expected results
    List<?>[] expected = new List[] { Arrays.asList(2), Arrays.asList(2) };
    // batch with two commands
    ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "a", Boolean.FALSE, new Integer(0) })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "b", Boolean.TRUE, new Integer(1) })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'a', e3 = FALSE WHERE pm1.g1.e2 = 0"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'b', e3 = TRUE WHERE pm1.g1.e2 = 1"));
    // Create the plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
    // Repeat with different number of commands in batch
    expected = new List[] { Arrays.asList(new Object[] { new Integer(2) }) };
    // batch with one command
    values = new ArrayList<ArrayList<Object>>(1);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "c", Boolean.FALSE, new Integer(1) })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'c', e3 = FALSE WHERE pm1.g1.e2 = 1"));
    // Use the cached plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
    // Repeat with different number of commands in batch
    expected = new List[] { Arrays.asList(2), Arrays.asList(2), Arrays.asList(1), Arrays.asList(1) };
    // batch with four commands
    values = new ArrayList<ArrayList<Object>>(4);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "d", Boolean.FALSE, new Integer(1) })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "e", Boolean.FALSE, new Integer(0) })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "f", Boolean.TRUE, new Integer(2) })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { "g", Boolean.TRUE, new Integer(3) })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'd', e3 = FALSE WHERE pm1.g1.e2 = 1"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'e', e3 = FALSE WHERE pm1.g1.e2 = 0"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'f', e3 = TRUE WHERE pm1.g1.e2 = 2"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e1 = 'g', e3 = TRUE WHERE pm1.g1.e2 = 3"));
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
    // Verify all the queries that were run
    // $NON-NLS-1$
    assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries());
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) FakeDataManager(org.teiid.query.processor.FakeDataManager) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 9 with BasicSourceCapabilities

use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.

the class TestPreparedStatementBatchedUpdate method testUpdateSameNumCmds_Virtual.

/**
 * Test prepared statements that use batched updates using the same prepared
 * command with same number of commands in the batch.  Update is performed
 * against a view model instead of a source model.
 * <p>
 * The test verifies that no errors occur when planning and executing the
 * same batched command SQL with the same number of batched command parameter
 * value sets.  For example, if the first executeBatch() call were to occur
 * with two batched commands a repeated call with two batched commands
 * should not result in an error during planning or execution and the value
 * used in the second batched command should be used instead of any values
 * from the first batched command.
 * <p>
 * The test also verifies that the correct SQL is pushed to the data manager
 * to verify that the parameter substitution occurred and is correct and the
 * correct number of statements made it to the data manager for the respective
 * batch command.
 * <p>
 * The batched command "UPDATE vm1.g1 SET vm1.g1.e2=? WHERE vm1.g1.e1=?"
 * will appear as:
 * <p>
 * UPDATE pm1.g1 SET e2=0 WHERE pm1.g1.e1='a'
 * UPDATE pm1.g1 SET e2=1 WHERE pm1.g1.e1='b'
 * <p>
 * UPDATE pm1.g1 SET e2=2 WHERE pm1.g1.e1='c'
 * UPDATE pm1.g1 SET e2=3 WHERE pm1.g1.e1='d'
 * <p>
 * The result should be that one command is in the plan cache and
 * no plan creation, validation, or execution errors will occur and
 * a predetermined set of queries were executed in the data manager.
 *
 * @throws Exception
 */
@Test
public void testUpdateSameNumCmds_Virtual() throws Exception {
    // Create query
    // $NON-NLS-1$
    String preparedSql = "UPDATE vm1.g1 SET vm1.g1.e2=? WHERE vm1.g1.e1=?";
    // Create a testable prepared plan cache
    SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0);
    // Construct data manager with data
    FakeDataManager dataManager = new FakeDataManager();
    TestProcessor.sampleData1(dataManager);
    // Source capabilities must support batched updates
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
    caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm1", caps);
    // Something to hold our final query list
    List<String> finalQueryList = new ArrayList<String>();
    // Create expected results
    List<?>[] expected = new List[] { Arrays.asList(3), Arrays.asList(1) };
    // batch with two commands
    ArrayList<ArrayList<Object>> values = new ArrayList<ArrayList<Object>>(2);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(0), "a" })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(1), "b" })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 0 WHERE pm1.g1.e1 = 'a'"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 1 WHERE pm1.g1.e1 = 'b'"));
    // Create the plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, false, RealMetadataFactory.example1VDB());
    // Repeat
    expected = new List[] { Arrays.asList(1), Arrays.asList(0) };
    // batch with two commands
    values = new ArrayList<ArrayList<Object>>(1);
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(2), "c" })));
    // $NON-NLS-1$
    values.add(new ArrayList<Object>(Arrays.asList(new Object[] { new Integer(3), "d" })));
    // Add our expected queries to the final query list
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 2 WHERE pm1.g1.e1 = 'c'"));
    // $NON-NLS-1$
    finalQueryList.add(new String("UPDATE pm1.g1 SET e2 = 3 WHERE pm1.g1.e1 = 'd'"));
    // Use the cached plan and process the query
    TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, RealMetadataFactory.example1Cached(), prepPlanCache, false, false, true, RealMetadataFactory.example1VDB());
    // Verify all the queries that were run
    // $NON-NLS-1$
    assertEquals("Unexpected queries executed -", finalQueryList, dataManager.getQueries());
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) FakeDataManager(org.teiid.query.processor.FakeDataManager) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 10 with BasicSourceCapabilities

use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.

the class TestDQPCore method testSourceConcurrency.

@Test
public void testSourceConcurrency() throws Exception {
    // setup default of 2
    agds.setSleep(100);
    BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
    bsc.setFunctionSupport(SourceSystemFunctions.CONCAT, true);
    agds.setCaps(bsc);
    StringBuffer sql = new StringBuffer();
    int branches = 20;
    for (int i = 0; i < branches; i++) {
        if (i > 0) {
            sql.append(" union all ");
        }
        sql.append("select stringkey || " + i + " from bqt1.smalla");
    }
    // sql.append(" limit 2");
    helpExecute(sql.toString(), "a", 1, false);
    // there's isn't a hard guarantee that only two requests will get started
    assertTrue(agds.getExecuteCount().get() <= 6);
    // 20 concurrent
    core.setUserRequestSourceConcurrency(20);
    agds.getExecuteCount().set(0);
    helpExecute(sql.toString(), "a", 2, false);
    assertTrue(agds.getExecuteCount().get() > 10 && agds.getExecuteCount().get() <= 20);
    // serial
    core.setUserRequestSourceConcurrency(1);
    agds.getExecuteCount().set(0);
    helpExecute(sql.toString(), "a", 3, false);
    // there's two since 1 is smaller than the expected batch
    assertTrue(agds.getExecuteCount().get() <= 2);
}
Also used : BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) Test(org.junit.Test)

Aggregations

BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)826 Test (org.junit.Test)780 FakeCapabilitiesFinder (org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder)525 ProcessorPlan (org.teiid.query.processor.ProcessorPlan)357 DefaultCapabilitiesFinder (org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder)277 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)210 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)163 List (java.util.List)135 CommandContext (org.teiid.query.util.CommandContext)104 Command (org.teiid.query.sql.lang.Command)73 HardcodedDataManager (org.teiid.query.processor.HardcodedDataManager)53 ArrayList (java.util.ArrayList)34 BigInteger (java.math.BigInteger)33 Schema (org.teiid.metadata.Schema)18 AggregateSymbol (org.teiid.query.sql.symbol.AggregateSymbol)16 Table (org.teiid.metadata.Table)15 CapabilitiesFinder (org.teiid.query.optimizer.capabilities.CapabilitiesFinder)12 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)12 RelationalPlan (org.teiid.query.processor.relational.RelationalPlan)11 BatchedUpdateCommand (org.teiid.query.sql.lang.BatchedUpdateCommand)10