QueryResultParser.parseFirstRow() expects row's props to be ordered #98

Closed
svilendobrev opened this Issue Dec 5, 2012 · 3 comments

Comments

Projects
None yet
3 participants
@svilendobrev

namely, it expects the "value" to be last in the row.
which isn't guaranteed as row is a json object and it's attributes are unordered by definition.

the issue comes with TouchDB which makes rows as plain Maps and when json-serialized, order of keys in them vary, e.g. "key "is after "value".
Hence the queryView( query, some.POJOclass.to.map.to) never succeeds.

@helun

This comment has been minimized.

Show comment Hide comment
@helun

helun Dec 6, 2012

Owner

the QueryResultParser should be rewritten so that it can parse rows with keys in any order.
A workaround is to use this method instead:

ViewResult queryView(ViewQuery query);

it does not parse the view result in the same manner.

Owner

helun commented Dec 6, 2012

the QueryResultParser should be rewritten so that it can parse rows with keys in any order.
A workaround is to use this method instead:

ViewResult queryView(ViewQuery query);

it does not parse the view result in the same manner.

@pgelinas

This comment has been minimized.

Show comment Hide comment
@pgelinas

pgelinas Dec 10, 2012

Contributor

If TouchDB doesn't guarantee the order of the fields inside a row, then it probably does not guarantee the order of the "header" fields (offset, total_rows and rows). I've seen quite a lot of places in Ektorp that assumes the order of JSON returned by CouchDB.

Contributor

pgelinas commented Dec 10, 2012

If TouchDB doesn't guarantee the order of the fields inside a row, then it probably does not guarantee the order of the "header" fields (offset, total_rows and rows). I've seen quite a lot of places in Ektorp that assumes the order of JSON returned by CouchDB.

pgelinas added a commit to pgelinas/Ektorp that referenced this issue Dec 11, 2012

helun added a commit that referenced this issue Dec 12, 2012

Merge pull request #100 from pgelinas/fix-issue-98
Rewrite of QueryResultParser to fix issue #98.
@svilendobrev

This comment has been minimized.

Show comment Hide comment
@svilendobrev

svilendobrev Dec 13, 2012

it uses java hashmaps for json-objects and they have somewhat random order.
so anything relying on json-objects being ordered won't work.

btw i have tried the latest source, seems to work now. fixed is also another related issue with doc vs value guessing.

it uses java hashmaps for json-objects and they have somewhat random order.
so anything relying on json-objects being ordered won't work.

btw i have tried the latest source, seems to work now. fixed is also another related issue with doc vs value guessing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment