[ 
https://issues.apache.org/jira/browse/COUCHDB-2900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15196787#comment-15196787
 ] 

ASF GitHub Bot commented on COUCHDB-2900:
-----------------------------------------

GitHub user banjiewen opened a pull request:

    https://github.com/apache/couchdb-fabric/pull/43

    Support raw view collation

    COUCHDB-2900

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/banjiewen/couchdb-fabric 2900-raw-collation

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-fabric/pull/43.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #43
    
----
commit f83055642e7b08603c5c71b62ca20ef9bcd65ce3
Author: Benjamin Anderson <[email protected]>
Date:   2016-03-16T05:12:42Z

    Add sort_fun to view result collector record
    
    There's no reference to the #mrview when results are being streamed to
    the user, so we need a place to store the relevant fun while results are
    collected.
    
    COUCHDB-2900

commit 9be3c61e27fc3478e451283e7d802b1e7800550e
Author: Benjamin Anderson <[email protected]>
Date:   2016-03-16T05:17:41Z

    Support raw collation in reduce results
    
    Also simplify find_next_key/3 and avoid generating a new fun for every
    streamed key.
    
    COUCHDB-2900

commit e90569a4df2912c1fa1631c14f3973da51eca02f
Author: Benjamin Anderson <[email protected]>
Date:   2016-03-16T05:21:02Z

    Support raw collation in map results
    
    COUCHDB-2900

----


> CouchDB 2.0: raw collation order is not respected when a database has 
> multiple shards
> -------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-2900
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2900
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Will Holley
>            Priority: Blocker
>              Labels: regression
>             Fix For: 2.0.0
>
>
> In CouchDB 1.X, specifying raw collation in a view definition changes the 
> result order:
> {code}
> $ curl http://localhost:5984/nullsort -XPUT
> {"ok":true}
> $ curl http://localhost:5984/nullsort/_bulk_docs -XPOST 
> -H'Content-Type:application/json' -d '{"docs":[{"test":1},{"test":null}]}'
> [{"ok":true,"id":"a9f86d3c33d25c15de6eca8578001d98","rev":"1-ea7a185b492abc69a6c8e0358d244a98"},{"ok":true,"id":"a9f86d3c33d25c15de6eca8578002c25","rev":"1-9b2a5b981a9dd0ad1b3a3e826498e9bb"}]
> $ curl http://localhost:5984/nullsort -XPOST 
> -H'Content-Type:application/json' -d '{"_id": 
> "_design/test","views":{"nullsort":{"map": "function (doc) {emit(doc.test, 
> 1);}","options":{"collation": "raw"}}}}'
> {"ok":true,"id":"_design/test","rev":"1-2df3ab52426a7138b6898791024595d0"}
> $ curl http://localhost:5984/nullsort/_design/test/_view/nullsort
> {"total_rows":2,"offset":0,"rows":[
> {"id":"a9f86d3c33d25c15de6eca8578001d98","key":1,"value":1},
> {"id":"a9f86d3c33d25c15de6eca8578002c25","key":null,"value":1}
> ]}
> {code}
> In CouchDB 2.0, with n=1, q=4:
> {code}
> $ curl http://localhost:15984/nullsort -XPUT
> {"ok":true}
> $ curl http://localhost:15984/nullsort/_bulk_docs -XPOST 
> -H'Content-Type:application/json' -d '{"docs":[{"test":1},{"test":null}]}'
> [{"ok":true,"id":"51cf4c5a56f86f524b0e36f52800029d","rev":"1-ea7a185b492abc69a6c8e0358d244a98"},{"ok":true,"id":"51cf4c5a56f86f524b0e36f528000d9c","rev":"1-9b2a5b981a9dd0ad1b3a3e826498e9bb"}]
> $ curl http://localhost:15984/nullsort -XPOST 
> -H'Content-Type:application/json' -d '{"_id": 
> "_design/test","views":{"nullsort":{"map": "function (doc) {emit(doc.test, 
> 1);}","options":{"collation": "raw"}}}}'
> {"ok":true,"id":"_design/test","rev":"1-2df3ab52426a7138b6898791024595d0"}
> $ curl http://localhost:15984/nullsort/_design/test/_view/nullsort
> {"total_rows":2,"offset":0,"rows":[
> {"id":"51cf4c5a56f86f524b0e36f528000d9c","key":null,"value":1},
> {"id":"51cf4c5a56f86f524b0e36f52800029d","key":1,"value":1}
> ]}
> {code}
> Note that null is returned before 1.
> If q=1, the ordering matches CouchDB 1.X



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to