zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #24744
Re: [Merge] lp:~zorba-coders/zorba/use-dataguide into lp:zorba
Review: Needs Fixing
1. The following query constructs the wrong dataguide (and returns the wrong result):
jsoniq version "1.0";
declare variable $doc1 :=
"
{
\"foo\" : { \"name\" : \"moto\", \"price\" : 100 },
\"boo\" : { \"name\" : \"car\", \"price\" : 1000 }
}
";
let $v := exactly-one(jn:parse-json($doc1))
return
if ($v.foo.name eq "moto")
then
$v
else
()
2. The following query does not construct any dataguide at all, although it should:
jsoniq version "1.0";
import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
declare variable $test external := 1;
ddl:create(xs:QName("sales"));
dml:insert-last(xs:QName("sales"),
( { "product" : { "name" : "broiler",
"price" : 100
},
"category1" : { "category3" :
{ "category4" : "value4" }
}
}
)
);
(
exactly-one
(
if ($test)
then
dml:collection(xs:QName("sales"))[1]
else
dml:collection(xs:QName("sales"))[2]
)
).category1
3. Window variables are not taken into account in getClauseVar
4. The implementation of the JsonDataguide rule does too much copying and allocations of dataguides. I have the feeling that this is not necessary. For example, what about the following approach?
- There is only one dataguide_cb allocated per JsonDataguide application. It contains one entry for each json "source" encountered during the application of the rule.
- There is also a single map from expr* to std::vector<expr*>. The map contains one entry for each expr that may receive return json items coming from a json "source". The value of the entry is the set of "sources" for the key expr.
I may be missing something, but if this works, it will eliminate all allocations and copies.
--
https://code.launchpad.net/~zorba-coders/zorba/use-dataguide/+merge/176385
Your team Zorba Coders is subscribed to branch lp:zorba.
References