Search in sources :

Example 1 with SplitCacheMap

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

the class TestOrcCache method testDropCacheOnMultipleTables.

@Test
public void testDropCacheOnMultipleTables() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertQuerySucceeds("CACHE TABLE test_drop_cache_1 WHERE p1 = 1");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache_1").showPredicates().contains("(p1 = 1)"));
    assertQuerySucceeds("CACHE TABLE test_drop_cache_2 WHERE p3 = 3");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache_2").showPredicates().contains("(p3 = 3)"));
    assertQuerySucceeds("CACHE TABLE test_drop_cache_2 WHERE p3 = 4");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache_2").showPredicates().contains("(p3 = 4)"));
    assertQuerySucceeds("CACHE TABLE test_drop_cache_1 WHERE p2 = 2");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache_1").showPredicates().contains("(p2 = 2)"));
    assertQuerySucceeds("DROP CACHE test_drop_cache_1");
    assertEquals(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache_1"), null);
    assertQuerySucceeds("DROP CACHE test_drop_cache_2");
    assertEquals(splitCacheMap.tableCacheInfoMap().get("hive.tpch.test_drop_cache_2"), null);
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Example 2 with SplitCacheMap

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

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 3 with SplitCacheMap

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

the class TestOrcCache method testShowCache.

@Test
public void testShowCache() {
    SplitCacheMap splitCacheMap = SplitCacheMap.getInstance();
    assertQuerySucceeds("CACHE TABLE employee WHERE dob BETWEEN DATE '1980-01-01' AND DATE '2000-01-01'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("(dob BETWEEN DATE '1980-01-01' AND DATE '2000-01-01')"));
    assertQuerySucceeds("CACHE TABLE employee WHERE perf > DOUBLE '9.0'");
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("(dob BETWEEN DATE '1980-01-01' AND DATE '2000-01-01')"));
    assertTrue(splitCacheMap.tableCacheInfoMap().get("hive.tpch.employee").showPredicates().contains("(perf > DOUBLE '9.0')"));
}
Also used : SplitCacheMap(io.prestosql.execution.SplitCacheMap) Test(org.testng.annotations.Test)

Example 4 with SplitCacheMap

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

the class TestOrcCache method testCacheTableWithIsNotNullPredicate.

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

Example 5 with SplitCacheMap

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

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)

Aggregations

SplitCacheMap (io.prestosql.execution.SplitCacheMap)11 Test (org.testng.annotations.Test)10 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