Search in sources :

Example 11 with SplitCacheMap

use of io.prestosql.execution.SplitCacheMap in project boostkit-bigdata by kunpengcompute.

the class TestOrcCache method testCacheTableWithIsNullPredicate.

@Test
public void testCacheTableWithIsNullPredicate() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertQuerySucceeds("CACHE TABLE employee WHERE dob IS NULL");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("(dob IS NULL)"));
    assertQuerySucceeds("CACHE TABLE employee WHERE name IS NULL");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("(name IS NULL)"));
    assertQuerySucceeds("CACHE TABLE employee WHERE perf IS NULL");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("(perf IS NULL)"));
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Example 12 with SplitCacheMap

use of io.prestosql.execution.SplitCacheMap in project boostkit-bigdata by kunpengcompute.

the class TestOrcCache method testDropCacheWithNonExistPredicates.

@Test
public void testDropCacheWithNonExistPredicates() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertUpdate("CREATE TABLE test_drop_cache(id INTEGER, par INTEGER) WITH (partitioned_by = ARRAY['par'], format = 'ORC')");
    assertQuerySucceeds("CACHE TABLE test_drop_cache WHERE par = 0");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache").showPredicates().contains("(par = 0)"));
    assertQueryFails("DROP CACHE test_drop_cache WHERE par = 1", ".*?Cache predicate '\\(par = 1\\)' does not exist");
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Example 13 with SplitCacheMap

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

the class TestOrcCache method testCacheTableOnAllColumnTypes.

@Test
public void testCacheTableOnAllColumnTypes() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertQuerySucceeds("CACHE TABLE all_types WHERE _boolean = true");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_boolean = true)"));
    assertQueryOrdered("SELECT id, _boolean FROM all_types WHERE _boolean = true", "VALUES (0, true)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _tinyint = 0");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_tinyint = 0)"));
    assertQueryOrdered("SELECT id, _tinyint FROM all_types WHERE _tinyint = 0", "VALUES (0, 0)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _smallint = 0");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_smallint = 0)"));
    assertQueryOrdered("SELECT id, _smallint FROM all_types WHERE _smallint = 0", "VALUES (0, 0)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _integer = 0");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_integer = 0)"));
    assertQueryOrdered("SELECT id, _integer FROM all_types WHERE _integer = 0", "VALUES (0, 0)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _bigint = 0");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_bigint = 0)"));
    assertQueryOrdered("SELECT id, _bigint FROM all_types WHERE _bigint = 0", "VALUES (0, 0)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _float > FLOAT '6e-2'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_float > FLOAT '6e-2')"));
    assertQueryOrdered("SELECT id, _float FROM all_types WHERE _float > FLOAT '6e-2'", "VALUES (0, 2E-1)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _double = DOUBLE '0.2'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_double = DOUBLE '0.2')"));
    assertQueryOrdered("SELECT id, _double FROM all_types WHERE _double = DOUBLE '0.2'", "VALUES (0, 0.2)");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _date = DATE '1995-10-09'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_date = DATE '1995-10-09')"));
    assertQueryOrdered("SELECT id, _date FROM all_types WHERE _date = DATE '1995-10-09'", "VALUES (0, '1995-10-09')");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _timestamp = TIMESTAMP '1995-10-09 00:00:00'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_timestamp = TIMESTAMP '1995-10-09 00:00:00')"));
    assertQueryOrdered("SELECT id, _timestamp FROM all_types WHERE _timestamp = TIMESTAMP '1995-10-09 00:00:00'", "VALUES (0, '1995-10-09 00:00:00')");
    assertQuerySucceeds("CACHE TABLE all_types WHERE _varchar = 'jiahao'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.all_types").showPredicates().contains("(_varchar = 'jiahao')"));
    assertQueryOrdered("SELECT id, _varchar FROM all_types WHERE _varchar = 'jiahao'", "VALUES (0, 'jiahao')");
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Example 14 with SplitCacheMap

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

the class TestOrcCache method testCacheTableWithComplexPredicate.

@Test
public void testCacheTableWithComplexPredicate() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertQuerySucceeds("CACHE TABLE employee WHERE dob BETWEEN DATE '1980-01-01' AND DATE '2000-01-01' AND perf < DOUBLE '9.0'");
    assertQueryOrdered("SELECT * FROM employee WHERE dob BETWEEN DATE '1980-01-01' AND DATE '2000-01-01' AND perf < DOUBLE '9.0' ORDER BY id", "VALUES (0, 'Alice', '1995-10-09', 8.0), (4, 'Lenard', '1980-06-24', 8.8)");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("((dob BETWEEN DATE '1980-01-01' AND DATE '2000-01-01') AND (perf < DOUBLE '9.0'))"));
    assertQuerySucceeds("CACHE TABLE employee WHERE dob < DATE '1980-01-01' AND perf < DOUBLE '8.0'");
    assertQueryOrdered("SELECT * FROM employee WHERE dob < DATE '1980-01-01' AND perf < DOUBLE '8.0' ORDER BY id", "VALUES (6, 'Trump', '1945-08-15', 2.5)");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("((dob < DATE '1980-01-01') AND (perf < DOUBLE '8.0'))"));
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Example 15 with SplitCacheMap

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

the class TestOrcCache method testShowCacheAfterTableDeleted.

@Test
public void testShowCacheAfterTableDeleted() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertUpdate("CREATE TABLE test_show_cache(id INTEGER, par INTEGER) WITH (partitioned_by = ARRAY['par'], format = 'ORC')");
    assertQuerySucceeds("CACHE TABLE test_show_cache WHERE par = 0");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_show_cache").showPredicates().contains("(par = 0)"));
    assertUpdate("DROP TABLE test_show_cache");
    assertQueryFails("SHOW CACHE test_show_cache", ".*?Cache for table 'hive.tpch.test_show_cache' does not exist");
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Aggregations

SplitCacheMap (io.prestosql.execution.SplitCacheMap)20 Test (org.testng.annotations.Test)19 NodeTaskMap (io.prestosql.execution.NodeTaskMap)2 SplitKey (io.prestosql.execution.SplitKey)2 InternalNode (io.prestosql.metadata.InternalNode)2 Split (io.prestosql.metadata.Split)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Supplier (com.google.common.base.Supplier)1 Suppliers (com.google.common.base.Suppliers)1 HashMultimap (com.google.common.collect.HashMultimap)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Multimap (com.google.common.collect.Multimap)1 Logger (io.airlift.log.Logger)1 MockSplit (io.prestosql.MockSplit)1 RemoteTask (io.prestosql.execution.RemoteTask)1 SqlStageExecution (io.prestosql.execution.SqlStageExecution)1 NodeScheduler.randomizedNodes (io.prestosql.execution.scheduler.NodeScheduler.randomizedNodes)1 NodeScheduler.selectDistributionNodes (io.prestosql.execution.scheduler.NodeScheduler.selectDistributionNodes)1