samedi 25 octobre 2014

analize plain query tree java - with scope local


Vote count:

0




Sorry for that subject, I didn't find a better title. I have a tree structure generic, here's a my "node" class:



class NodePlainQuery{
private String label;
private List<NodePlainQuery> subNode = null;
private int level;
private boolean isCondition = false;
..
... getters, setters, ....
}


I recovered the query plan for a view and I create the tree. Ex.



1 Unique
2 Subquery
3 Hash Join [o.order_id = ot.order_id]
4 Seq Scan on c_ordertax ot
5 Hash
6 Seq Scan on c_order o
7 Subquery
8 Seq Scan on c_order
9 Subquery
10 Nested Loop Cond: (p.m_product_id = bl.m_product_id)
11 Hash Join (bl.c_bpartner_id = ol.c_bpartner_id) AND (pp.type = bl.type)
12 Hash
13 Hash Join (ol.c_bpartner_id= pp.c_bpartner_id)
14 Seq Scan on c_bpartner_product pp
15 Seq Scan on c_bpartner ol
16 Filter bp.id is not null
17 Seq Scan on c_bpartner_location bl
18 Index Scan using m_product_pkey on m_product p


To analyze the conditions such as Cond: (p.m_product_id = bl.m_product_id) I need the nodes Seq Scan and Index Scan in its sub-tree.


I need of post order traversal tree, for evaluate the nodes condition, it returns to the parent node scans / index seq.


I tried to implement:



public List<NodePlainQuery view (Tree s){
List<NodePlainQuery> scopeLocal = new ArrayList<NodePlainQuery>();
for (Tree<NodePlainQuery> ss : s.getSubTree()) {
scopeLocal.addAll(view (ss));
}
if ( s.getData().getLabel().contains("Seq Scan") ||
s.getData().getLabel().contains("Index Scan") ) {
scopeLocal.add(s.getData());
}

if (s.getData().type.contains("Cond")) {
.... evaluate node ....
return scopeLocal;
}
return null
}


in this way but it does not work because when I evaluate line 6 the scopeLocal is [c_ordertax] instead of [].


Any information would be greatly appreciated.



asked 58 secs ago







analize plain query tree java - with scope local

Aucun commentaire:

Enregistrer un commentaire