/** * Generates specific XML (sometimes called 'attribute-oriented XML'). Like this: * * <pre> * <Join condition="EMP.DEPTNO = DEPT.DEPTNO"> * <Project expr1="x + y" expr2="42"> * <TableAccess table="SALES.EMPS"> * </Join> * </pre> * * @param rel Relational expression * @param terms Names of the attributes of the plan * @param values Values of the attributes of the plan */ private void explainSpecific(RelNode rel, String[] terms, Object[] values) { RelNode[] inputs = rel.getInputs(); RexNode[] children = rel.getChildExps(); assert terms.length == (inputs.length + children.length + values.length) : "terms.length=" + terms.length + " inputs.length=" + inputs.length + " children.length=" + children.length + " values.length=" + values.length; String tagName = rel.getRelTypeName(); xmlOutput.beginBeginTag(tagName); xmlOutput.attribute("id", rel.getId() + ""); int j = 0; for (int i = 0; i < children.length; i++) { RexNode child = children[i]; xmlOutput.attribute(terms[inputs.length + j++], child.toString()); } for (int i = 0; i < values.length; i++) { Object value = values[i]; if (value != null) { xmlOutput.attribute(terms[inputs.length + j++], value.toString()); } } xmlOutput.endBeginTag(tagName); level++; for (int i = 0; i < inputs.length; i++) { RelNode child = inputs[i]; child.explain(this); } level--; }