protected CompiledPlan compileAdHocPlan(String sql, DeterminismMode detMode) { CompiledPlan cp = null; try { cp = m_aide.compileAdHocPlan(sql, detMode); assertTrue(cp != null); } catch (Exception ex) { ex.printStackTrace(); fail(); } return cp; }
@Override protected void setUp() throws Exception { aide = new PlannerTestAideDeCamp( TestColumnTrimmingPlans.class.getResource("testplans-trimming-ddl.sql"), "testtrimmingplans"); // Set all tables to non-replicated. Cluster cluster = aide.getCatalog().getClusters().get("cluster"); CatalogMap<Table> tmap = cluster.getDatabases().get("database").getTables(); for (Table t : tmap) { t.setIsreplicated(false); } }
/** A helper here where the junit test can assert success */ private List<AbstractPlanNode> compileWithJoinOrderToFragments( String sql, int paramCount, boolean planForSinglePartition, String joinOrder) { List<AbstractPlanNode> pn = m_aide.compile( sql, paramCount, m_byDefaultInferPartitioning, m_byDefaultPlanForSinglePartition, joinOrder); assertTrue(pn != null); assertFalse(pn.isEmpty()); assertTrue(pn.get(0) != null); if (planForSinglePartition) { assertTrue(pn.size() == 1); } return pn; }
private AbstractPlanNode compile(String sql, int paramCount, boolean singlePartition) { List<AbstractPlanNode> pn = null; try { pn = aide.compile(sql, paramCount, singlePartition); } catch (NullPointerException ex) { // aide may throw NPE if no plangraph was created ex.printStackTrace(); fail(); } catch (Exception ex) { ex.printStackTrace(); fail(); } assertTrue(pn != null); assertFalse(pn.isEmpty()); assertTrue(pn.get(0) != null); return pn.get(0); }
protected void failToCompile(String sql, String... patterns) { int paramCount = countQuestionMarks(sql); try { List<AbstractPlanNode> unexpected = m_aide.compile( sql, paramCount, m_byDefaultInferPartitioning, m_byDefaultPlanForSinglePartition, null); printExplainPlan(unexpected); fail("Expected planner failure, but found success."); } catch (Exception ex) { String result = ex.toString(); for (String pattern : patterns) { if (!result.contains(pattern)) { fail("Did not find pattern '" + pattern + "' in error string '" + result + "'"); } } } }
Database getDatabase() { return m_aide.getDatabase(); }
@Override protected void tearDown() throws Exception { super.tearDown(); aide.tearDown(); }