protected void dropTables() throws Exception { for(TxnCommandsBaseForTests.Table t : TxnCommandsBaseForTests.Table.values()) { runStatementOnDriver("drop table if exists " + t); } } @After
/** * We have to use a different query to check results for Vectorized tests because to get the * file name info we need to use {@link org.apache.hadoop.hive.ql.metadata.VirtualColumn#FILENAME} * which will currently make the query non-vectorizable. This means we can't check the file name * for vectorized version of the test. */ protected void checkResult(String[][] expectedResult, String query, boolean isVectorized, String msg, Logger LOG) throws Exception{ List<String> rs = runStatementOnDriver(query); checkExpected(rs, expectedResult, msg + (isVectorized ? " vect" : ""), LOG, !isVectorized); assertVectorized(isVectorized, query); } void dropTable(String[] tabs) throws Exception {
/** * Runs Vectorized Explain on the query and checks if the plan is vectorized as expected * @param vectorized {@code true} - assert that it's vectorized */ void assertVectorized(boolean vectorized, String query) throws Exception { List<String> rs = runStatementOnDriver("EXPLAIN VECTORIZATION DETAIL " + query); for(String line : rs) { if(line != null && line.contains("Execution mode: vectorized")) { Assert.assertTrue("Was vectorized when it wasn't expected", vectorized); return; } } Assert.assertTrue("Din't find expected 'vectorized' in plan", !vectorized); } /**
d.setMaxRows(10000); dropTables(); runStatementOnDriver("create table " + Table.ACIDTBL + "(a int, b int) clustered by (a) into " + BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')"); runStatementOnDriver("create table " + Table.ACIDTBLPART + "(a int, b int) partitioned by (p string) clustered by (a) into " + BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')"); runStatementOnDriver("create table " + Table.NONACIDORCTBL + "(a int, b int) clustered by (a) into " + BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='false')"); runStatementOnDriver("create table " + Table.NONACIDORCTBL2 + "(a int, b int) clustered by (a) into " + BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='false')"); runStatementOnDriver("create temporary table " + Table.ACIDTBL2 + "(a int, b int, c int) clustered by (c) into " + BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')"); runStatementOnDriver("create table " + Table.NONACIDNONBUCKET + "(a int, b int) stored as orc TBLPROPERTIES ('transactional'='false')");