Here are the logical and optimized plans for Query 6. There is some issue with the plans. There needs to be some operator between child and count. Since child sends out empty sequences and the count aggregate function counts all the empty sequences giving a very large value.

FINE: Logical Plan:

distribute result [%0->$$16] – |UNPARTITIONED|

unnest $$16 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$15

] – |UNPARTITIONED|

subplan {

aggregate [$$15] <- [function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

sequence, Args:[

%0->$$14

]] – |UNPARTITIONED|

assign [$$14] <- [function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

count, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <item*>, Args:[

%0->$$13

]

]] – |UNPARTITIONED|

assign [$$13] <- [function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

sort-distinct-nodes-asc-or-atomics, Args:[

%0->$$12

]] – |UNPARTITIONED|

subplan {

aggregate [$$12] <- [function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

sequence, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

child <element(NameTest({}item,

{http://www.w3.org/2001/XMLSchema}

anyType, nilled) >, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <node*>, Args:[

%0->$$10

]

]

]] – |UNPARTITIONED|

unnest $$10 at $$11 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$8

] – |UNPARTITIONED|

assign [$$9] <- [function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

count, Args:[

%0->$$8

]] – |UNPARTITIONED|

nested tuple source – |UNPARTITIONED|

} – |UNPARTITIONED|

subplan {

aggregate [$$8] <- [function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

sequence, Args:[

function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

descendant-or-self, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <node*>, Args:[

%0->$$6

]

]

]] – |UNPARTITIONED|

unnest $$6 at $$7 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$4

] – |UNPARTITIONED|

assign [$$5] <- [function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

count, Args:[

%0->$$4

]] – |UNPARTITIONED|

nested tuple source – |UNPARTITIONED|

} – |UNPARTITIONED|

assign [$$4] <- [vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <item >, Args:[

%0->$$3

]] – |UNPARTITIONED|

unnest $$3 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$2

] – |UNPARTITIONED|

assign [$$2] <- [function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

doc, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

promote <

{http://www.w3.org/2001/XMLSchema}

string?>, Args:[

function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

data, Args:[

%0->$$1

]

]

]] – |UNPARTITIONED|

assign [$$1] <- [

{http://www.w3.org/2001/XMLSchema}

string : ../regions.xml] – |UNPARTITIONED|

nested tuple source – |UNPARTITIONED|

} – |UNPARTITIONED|

empty-tuple-source – |UNPARTITIONED|

INFO: Optimized Plan:

distribute result [%0->$$42]

– DISTRIBUTE_RESULT |UNPARTITIONED|

exchange

– ONE_TO_ONE_EXCHANGE |UNPARTITIONED|

unnest $$42 <- vxquery:

{urn:org.apache.vxquery.operators-ext}

child <text >, Args:[

%0->$$36

]

– UNNEST |UNPARTITIONED|

unnest $$36 <- vxquery:

{urn:org.apache.vxquery.operators-ext}

child <element(NameTest({}name,

{http://www.w3.org/2001/XMLSchema}

anyType, nilled) >, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <node*>, Args:[

%0->$$31

]

]

– UNNEST |UNPARTITIONED|

unnest $$31 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$18

]

– UNNEST |UNPARTITIONED|

select (function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

contains, Args:[

function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

string, Args:[

function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

exactly-one, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <item*>, Args:[

%0->$$23

]

]

]



{http://www.w3.org/2001/XMLSchema}

string : gold

])

– STREAM_SELECT |UNPARTITIONED|

subplan {

aggregate [$$23] <- [function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

sequence, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

child <element(NameTest({}description,

{http://www.w3.org/2001/XMLSchema}

anyType, nilled) >, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <node*>, Args:[

%0->$$21

]

]

]]

– AGGREGATE |UNPARTITIONED|

unnest $$21 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$18

]

– UNNEST |UNPARTITIONED|

nested tuple source

– NESTED_TUPLE_SOURCE |UNPARTITIONED|

}

– SUBPLAN |UNPARTITIONED|

unnest $$18 <- vxquery:

{urn:org.apache.vxquery.operators-ext}

descendant-or-self <element(NameTest({}item,

{http://www.w3.org/2001/XMLSchema}

anyType, nilled) >, Args:[

%0->$$10

]

– UNNEST |UNPARTITIONED|

unnest $$10 <- vxquery:

{urn:org.apache.vxquery.operators-ext}

child <element(NameTest({}site,

{http://www.w3.org/2001/XMLSchema}

anyType, nilled) >, Args:[

vxquery:

{urn:org.apache.vxquery.operators-ext}

treat <node*>, Args:[

%0->$$5

]

]

– UNNEST |UNPARTITIONED|

unnest $$5 <- function-call: vxquery:

{urn:org.apache.vxquery.operators-ext}

iterate, Args:[

%0->$$3

]

– UNNEST |UNPARTITIONED|

assign [$$3] <- [function-call: vxquery:

{http://www.w3.org/2005/xpath-functions}

doc, Args:[



{http://www.w3.org/2001/XMLSchema}

string : ../auction.xml

]]

– ASSIGN |UNPARTITIONED|

empty-tuple-source

– EMPTY_TUPLE_SOURCE |UNPARTITIONED|