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)"));
}
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");
}
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')");
}
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'))"));
}
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");
}
Aggregations