You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Victor Nicollet (JIRA)" <ji...@apache.org> on 2011/07/20 11:45:03 UTC

[jira] [Created] (COUCHDB-1228) Key range error apparently ignores view collation

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


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

        

Re: [jira] [Resolved] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by Jason Smith <jh...@iriscouch.com>.
On Thu, Aug 11, 2011 at 1:45 PM, Paul Joseph Davis (JIRA)
<ji...@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Paul Joseph Davis resolved COUCHDB-1228.
> ----------------------------------------
>
>       Resolution: Fixed
>    Fix Version/s:     (was: 1.1.1)
>                   1.2

Thanks! Would it be possible to backport this to 1.1.x so it can make
the 1.1.1 release? (I actually developed it against 1.1.x
unintentionally).

-- 
Iris Couch

[jira] [Commented] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080714#comment-13080714 ] 

Paul Joseph Davis commented on COUCHDB-1228:
--------------------------------------------

The unintuitive part here is the optimizations we make when map functions are byte identical. Ie, if you have the same map function and a number of different reduce functions, then we only write one btree to disk for that map function. Its basically a short comming in how we define map/reduce function pairs.

But the bottom line is that even if you have say three pairs of m/r functions, but the m function is identical in all three, then all three are represented as a single #view{} record. Its basically {MapFun, [{ReduceName, ReduceFun} | RestRedFuns], OtherMetaStuff}.

The {reduce, N, Lang, View} tuple is just wrapped around a #view{} record to indicate which reduce function is being referred to. Of course this could've been defined as -record(reduce, {nth, language, view}). but wasn't for some reason long ago. Bottom line is that all of those reduce functions and the underlying map function have an identical sort ordering, so all you're doing is extracting the view to get at that info.

(Side note, when I said byte-identical map function, they also have to have identical view options values as well)

> 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, 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

        

[jira] [Updated] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Attachment: 0003-Support-correct-key-range-semantics-for-raw-collatio.patch
                0002-Unit-tests-for-proper-key-range-support-during-raw-c.patch

Proposed patch with unit tests

> 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
>
>
> 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

        

[jira] [Commented] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080330#comment-13080330 ] 

Jason Smith commented on COUCHDB-1228:
--------------------------------------

This bug also prevents a query for all user documents in the _users database.

    $ curl -i 'localhost:5984/_users/_all_docs?startkey="org.couchdb.user%3a"&endkey="org.couchdb.user%3b"'
    HTTP/1.1 400 Bad Request
    Server: CouchDB/1.1.0 (Erlang OTP/R14B02)
    Date: Sat, 06 Aug 2011 02:03:00 GMT
    Content-Type: text/plain;charset=utf-8
    Content-Length: 133
    Cache-Control: must-revalidate

    {"error":"query_parse_error","reason":"No rows can match your key range, reverse your start_key and end_key or set descending=true"}

> 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
>
>
> 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

        

[jira] [Updated] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson updated COUCHDB-1228:
-----------------------------------

    Fix Version/s: 1.1.1

> 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
>
>
> 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

        

[jira] [Updated] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Attachment: 0001-Whitespace-and-comment-clarification.patch

Prep for real work

> 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
>
>
> 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

        

[jira] [Updated] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Attachment: trunk.0003-Support-correct-key-range-semantics-for-raw-collatio.patch
                trunk.0002-Unit-tests-for-proper-key-range-support-during-raw-c.patch
                trunk.0001-Whitespace-and-comment-clarification.patch

Original patches are against 1.1.x. Next patch set is against trunk.

> 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, 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

        

[jira] [Updated] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
     [ 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

        

[jira] [Commented] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Bob Dionne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080394#comment-13080394 ] 

Bob Dionne commented on COUCHDB-1228:
-------------------------------------

Looks like the problem is in couch_httpd_view:warn_on_empty_key_range, it makes use of couch_view:less_json as the default instead of taking the collation option into account.

Shouldn't be too hard to fix in the view case but I'm not sure how to handle the case of _all_docs

> 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
>
>
> 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

        

[jira] [Commented] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080518#comment-13080518 ] 

Paul Joseph Davis commented on COUCHDB-1228:
--------------------------------------------

@Jason,

Looks pretty good. Though I'd implement collation_for_view slightly differently:

    collationv_for_view({reduce, _N, _Lang, View}) ->
        collation_for_view(View);
    collation_for_view(View) ->
        fun(A, B) ->
            couch_btree:less(View#view.btree, A, B)
        end.

You'll need to export couch_btree:less, but that's no biggy. I think this should simplify the rest of the collation logic further down. Only tricky thing is for _all_docs to just remember and pass fun(A, B) -> A < B end. instead of raw as the Collation thing.

> 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, 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

        

[jira] [Commented] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080417#comment-13080417 ] 

Paul Joseph Davis commented on COUCHDB-1228:
--------------------------------------------

@Bob

Quite right. Though that code will have to poke into the design doc to handle that warning case. I'm not sure what _all_docs has to do with it. It only uses raw collation.

> 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
>
>
> 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

        

[jira] [Commented] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Jason Smith (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080706#comment-13080706 ] 

Jason Smith commented on COUCHDB-1228:
--------------------------------------

Thanks, Paul. I will submit another patch set.

I was not totally confident about the {reduce, _N, _Lang, View} stuff. It comes from code like this:

https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_httpd_view.erl#L35-50

Would you mind briefly explaining what that code is doing? The `ReduceView` is that {reduce, N, Lang, View} tuple, but that is not a record from couch_db.hrl; it is simply built on the fly

https://github.com/apache/couchdb/blob/trunk/src/couchdb/couch_view.erl#L144-148

Thanks!

> 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, 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

        

[jira] [Resolved] (COUCHDB-1228) Key range error apparently ignores view collation

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis resolved COUCHDB-1228.
----------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.1.1)
                   1.2

Fixed as of r1156509

> 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.2
>
>         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