[ 
https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jason Smith updated COUCHDB-1228:
---------------------------------

    Attachment: 
B.0004-Support-correct-key-range-semantics-for-raw-collatio.patch
                B.0003-Whitespace-and-comment-clarification.patch
                
B.0002-Refactor-parse-temp-view-parameters-after-the-view-i.patch
                B.0001-Export-the-official-is-less-than-btree-predictate.patch

Second patch set ("B" series). Developed against 1.1.x, rebased to trunk for 
your convenience but untested since I didn't bother rebuilding libjs.

Now, when checking view ranges, an is-less-than predicate (callback) is 
required.

For normal views, the callback uses couch_btree:less directly from the view 
object, which presumably knows the correct collation algorithm.

For temporary views, I made a minor change to first instantiate the view 
objects, and then check for range validity, again using the view's #btree.less 
function. I confirmed that this works for normal and raw collation in temporary 
views, however I could not find an obvious place in the test suite to add the 
unit tests.

For _all_docs queries, the http handler simply hard-codes a raw collation 
function and passes that to the range checker.

> Key range error apparently ignores view collation
> -------------------------------------------------
>
>                 Key: COUCHDB-1228
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1228
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.1
>         Environment: Debian
>            Reporter: Victor Nicollet
>             Fix For: 1.1.1
>
>         Attachments: 0001-Whitespace-and-comment-clarification.patch, 
> 0002-Unit-tests-for-proper-key-range-support-during-raw-c.patch, 
> 0003-Support-correct-key-range-semantics-for-raw-collatio.patch, 
> B.0001-Export-the-official-is-less-than-btree-predictate.patch, 
> B.0002-Refactor-parse-temp-view-parameters-after-the-view-i.patch, 
> B.0003-Whitespace-and-comment-clarification.patch, 
> B.0004-Support-correct-key-range-semantics-for-raw-collatio.patch, 
> trunk.0001-Whitespace-and-comment-clarification.patch, 
> trunk.0002-Unit-tests-for-proper-key-range-support-during-raw-c.patch, 
> trunk.0003-Support-correct-key-range-semantics-for-raw-collatio.patch
>
>
> I have created a view (no reduce function) with "options":{"collation":"raw"} 
> and emit documents with keys "A", "C" and "b". Running a request on that view 
> with no parameters, I get as expected all three documents in order "A", "C" 
> and "b" as required by the raw collation (instead of "A", "b", "C" for the 
> default ICU collation).
> However, when I run a request with start key "B" and end key "a", I expect 
> the "C" document to be returned alone (as "B" < "C" < "a") but couchDB 
> responds:
> { "error": "query_parse_error", "reason": "No rows can match your key range, 
> reverse your start_key and end_key or set descending=true" }
> This error would make sense if I had been using the default ICU collation, 
> where "B" > "a", but with the raw collation the reverse ("B" > "a") is true. 
> It looks as if the key order warning does not take the view collation into 
> account.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to