Search in sources :

Example 11 with SqlQueryManager

use of io.prestosql.execution.SqlQueryManager in project hetu-core by openlookeng.

the class TestCachedSqlQueryExecution method testExecutionPlanCacheDisabled.

@Test
public void testExecutionPlanCacheDisabled() throws Exception {
    setupWithExecutionPlanCacheDisabled(TPCH_SESSION);
    SqlQueryManager manager = (SqlQueryManager) queryRunner.getCoordinator().getQueryManager();
    Plan plan1 = getPlan(TEST_SQL, manager);
    Plan plan2 = getPlan(TEST_SQL, manager);
    assertNotSame(plan1.getStatsAndCosts(), plan2.getStatsAndCosts());
}
Also used : Plan(io.prestosql.sql.planner.Plan) SqlQueryManager(io.prestosql.execution.SqlQueryManager) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest)

Example 12 with SqlQueryManager

use of io.prestosql.execution.SqlQueryManager in project hetu-core by openlookeng.

the class TestCachedSqlQueryExecution method testExecutionPlanCacheEnabledMulti.

@Test
public void testExecutionPlanCacheEnabledMulti() throws Exception {
    setupWithExecutionPlanCacheEnabled(TPCH_SESSION);
    SqlQueryManager manager = (SqlQueryManager) queryRunner.getCoordinator().getQueryManager();
    Plan plan1 = getPlan(TEST_SQL, manager);
    Plan plan2 = getPlan(TEST_SQL, manager);
    Plan plan3 = getPlan(TEST_SQL, manager);
    Plan plan4 = getPlan(TEST_SQL, manager);
    assertSame(plan1.getStatsAndCosts(), plan2.getStatsAndCosts());
    assertSame(plan2.getStatsAndCosts(), plan3.getStatsAndCosts());
    assertSame(plan3.getStatsAndCosts(), plan4.getStatsAndCosts());
}
Also used : Plan(io.prestosql.sql.planner.Plan) SqlQueryManager(io.prestosql.execution.SqlQueryManager) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest)

Example 13 with SqlQueryManager

use of io.prestosql.execution.SqlQueryManager in project hetu-core by openlookeng.

the class TestCachedSqlQueryExecution method testExecutionPlanCacheWithFunctions.

@Test
public void testExecutionPlanCacheWithFunctions() throws Exception {
    setupWithExecutionPlanCacheEnabled(TPCH_SESSION);
    SqlQueryManager manager = (SqlQueryManager) queryRunner.getCoordinator().getQueryManager();
    String query = "EXPLAIN SELECT * FROM orders";
    Plan plan1 = getPlan(TEST_SQL, manager);
    Plan plan2 = getPlan(query, manager);
    Plan plan3 = getPlan(TEST_SQL, manager);
    Plan plan4 = getPlan(TEST_SQL, manager);
    assertNotSame(plan1.getStatsAndCosts(), plan2.getStatsAndCosts());
    assertSame(plan1.getStatsAndCosts(), plan3.getStatsAndCosts());
    assertSame(plan3.getStatsAndCosts(), plan4.getStatsAndCosts());
}
Also used : Plan(io.prestosql.sql.planner.Plan) SqlQueryManager(io.prestosql.execution.SqlQueryManager) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest)

Example 14 with SqlQueryManager

use of io.prestosql.execution.SqlQueryManager in project hetu-core by openlookeng.

the class TestCachedSqlQueryExecution method testCreateTable.

@Test
public void testCreateTable() throws Exception {
    setupWithExecutionPlanCacheEnabled(DEFAULT_SESSION);
    TestingMetadata metadata = new TestingMetadata();
    queryRunner.installPlugin(new TestPlugin(metadata));
    queryRunner.createCatalog("test", "test");
    SqlQueryManager manager = (SqlQueryManager) queryRunner.getCoordinator().getQueryManager();
    String query1 = "CREATE TABLE nation AS SELECT * FROM tpch.tiny.nation";
    String query2 = "SELECT * FROM nation";
    String query3 = "SELECT * FROM tpch.tiny.nation";
    String query4 = "SELECT COUNT(*) FROM tpch.tiny.orders";
    Plan plan1 = getPlan(query1, manager);
    Plan plan2 = getPlan(query2, manager);
    Plan plan3 = getPlan(query3, manager);
    Plan plan4 = getPlan(query4, manager);
    assertNotNull(plan1);
    assertNotNull(plan2);
    assertNotNull(plan4);
    assertNotSame(plan2.getStatsAndCosts(), plan3.getStatsAndCosts());
}
Also used : TestingMetadata(io.prestosql.testing.TestingMetadata) Plan(io.prestosql.sql.planner.Plan) SqlQueryManager(io.prestosql.execution.SqlQueryManager) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest)

Example 15 with SqlQueryManager

use of io.prestosql.execution.SqlQueryManager in project hetu-core by openlookeng.

the class TestCachedSqlQueryExecution method testExecutionPlanCacheNestedStatementsWithCurrentTime.

@Test
public void testExecutionPlanCacheNestedStatementsWithCurrentTime() throws Exception {
    setupWithExecutionPlanCacheEnabled(TPCH_SESSION);
    SqlQueryManager manager = (SqlQueryManager) queryRunner.getCoordinator().getQueryManager();
    String testSql = "SELECT  5, COUNT(*) FROM (SELECT CURRENT_TIME, * FROM tpch.tiny.orders GROUP BY clerk, orderkey, custkey, totalprice, orderstatus, orderdate, orderpriority, shippriority, comment) WHERE TOTALPRICE > 1";
    Plan plan1 = getPlan(testSql, manager);
    Plan plan2 = getPlan(testSql, manager);
    assertNotSame(plan1.getStatsAndCosts(), plan2.getStatsAndCosts());
}
Also used : Plan(io.prestosql.sql.planner.Plan) SqlQueryManager(io.prestosql.execution.SqlQueryManager) Test(org.testng.annotations.Test) AfterTest(org.testng.annotations.AfterTest)

Aggregations

SqlQueryManager (io.prestosql.execution.SqlQueryManager)19 Plan (io.prestosql.sql.planner.Plan)19 AfterTest (org.testng.annotations.AfterTest)19 Test (org.testng.annotations.Test)19 TestingMetadata (io.prestosql.testing.TestingMetadata)10 SchemaTableName (io.prestosql.spi.connector.SchemaTableName)6 MaterializedResult (io.prestosql.testing.MaterializedResult)4 MaterializedRow (io.prestosql.testing.MaterializedRow)4