use of org.teiid.client.plan.PlanNode.Property in project teiid by teiid.
the class TestQueryPlans method testShowPlan.
@Test
public void testShowPlan() throws Exception {
Statement s = conn.createStatement();
s.execute("set showplan on");
ResultSet rs = s.executeQuery("select * from all_tables");
assertNull(s.unwrap(TeiidStatement.class).getDebugLog());
rs = s.executeQuery("show plan");
assertTrue(rs.next());
assertEquals(rs.getMetaData().getColumnType(1), Types.CLOB);
assertTrue(rs.getString(1).startsWith("ProjectNode"));
SQLXML plan = rs.getSQLXML(2);
assertTrue(plan.getString().startsWith("<?xml"));
assertNull(rs.getObject("DEBUG_LOG"));
assertNotNull(rs.getObject("PLAN_TEXT"));
s.execute("SET showplan debug");
rs = s.executeQuery("select * from all_tables");
assertNotNull(s.unwrap(TeiidStatement.class).getDebugLog());
PlanNode node = s.unwrap(TeiidStatement.class).getPlanDescription();
Property p = node.getProperty(AnalysisRecord.PROP_DATA_BYTES_SENT);
assertEquals("20", p.getValues().get(0));
rs = s.executeQuery("show plan");
assertTrue(rs.next());
assertNotNull(rs.getObject("DEBUG_LOG"));
s.execute("SET showplan off");
rs = s.executeQuery("select * from all_tables");
assertNull(s.unwrap(TeiidStatement.class).getPlanDescription());
assertTrue(rs.next());
}
use of org.teiid.client.plan.PlanNode.Property in project teiid by teiid.
the class TestQueryPlans method testShowPlanMultibatch.
@Test
public void testShowPlanMultibatch() throws Exception {
Statement s = conn.createStatement();
s.execute("set showplan debug");
ResultSet rs = s.executeQuery("with x as( select * from sys.columns limit 50) select * from x t1, x t2");
int count = 0;
while (rs.next()) {
count++;
}
assertEquals(2500, count);
rs = s.executeQuery("show plan");
assertTrue(rs.next());
assertEquals(rs.getMetaData().getColumnType(2), Types.SQLXML);
String string = rs.getSQLXML(2).getString();
PlanNode node = PlanNode.fromXml(string);
Property p = node.getProperty("Statistics");
assertTrue(p.getValues().contains("Node Output Rows: 2500"));
}