use of org.teiid.client.plan.PlanNode in project teiid by teiid.
the class ProcessorPlan method getDescriptionProperties.
public PlanNode getDescriptionProperties() {
PlanNode props = new PlanNode(this.getClass().getSimpleName());
props.addProperty(PROP_OUTPUT_COLS, AnalysisRecord.getOutputColumnProperties(getOutputElements()));
return props;
}
use of org.teiid.client.plan.PlanNode in project teiid by teiid.
the class AssignmentInstruction method getDescriptionProperties.
public PlanNode getDescriptionProperties() {
// $NON-NLS-1$
PlanNode props = new PlanNode("ASSIGNMENT");
props.addProperty(PROP_VARIABLE, this.variable.toString());
if (this.expression != null) {
AnalysisRecord.addLanaguageObjects(props, PROP_EXPRESSION, Arrays.asList(this.expression));
}
return props;
}
use of org.teiid.client.plan.PlanNode in project teiid by teiid.
the class TestResultsMessage method example.
public static ResultsMessage example() {
ResultsMessage message = new ResultsMessage();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
message.setColumnNames(new String[] { "A", "B", "C", "D" });
message.setDataTypes(new String[] { DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.BIG_INTEGER, DataTypeManager.DefaultDataTypes.BIG_INTEGER });
message.setFinalRow(200);
message.setFirstRow(1);
message.setLastRow(100);
List parameters = new ArrayList();
parameters.add(new ParameterInfo(ParameterInfo.IN, 0));
parameters.add(new ParameterInfo(ParameterInfo.RESULT_SET, 5));
message.setParameters(parameters);
PlanNode planDescs = new PlanNode("test");
// $NON-NLS-1$ //$NON-NLS-2$
planDescs.addProperty("key1", "val1");
// $NON-NLS-1$ //$NON-NLS-2$
planDescs.addProperty("key2", "val2");
// $NON-NLS-1$ //$NON-NLS-2$
planDescs.addProperty("key3", "val3");
// $NON-NLS-1$ //$NON-NLS-2$
planDescs.addProperty("key4", "val4");
message.setPlanDescription(planDescs);
List results = new ArrayList();
// $NON-NLS-1$
results.add(new BigInteger("100"));
// $NON-NLS-1$
results.add(new BigInteger("200"));
// $NON-NLS-1$
results.add(new BigInteger("300"));
// $NON-NLS-1$
results.add(new BigInteger("400"));
message.setResults(new List[] { results });
List warnings = new ArrayList();
// $NON-NLS-1$
warnings.add(new Exception("warning1"));
// $NON-NLS-1$
warnings.add(new Exception("warning2"));
message.setWarnings(warnings);
return message;
}
use of org.teiid.client.plan.PlanNode 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 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"));
}
Aggregations