You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/05/03 17:48:32 UTC

[GitHub] dubee commented on a change in pull request #3588: Make count with skip to work with CouchDB

dubee commented on a change in pull request #3588: Make count with skip to work with CouchDB
URL: https://github.com/apache/incubator-openwhisk/pull/3588#discussion_r185884555
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/database/CouchDbRestStore.scala
 ##########
 @@ -315,19 +315,14 @@ class CouchDbRestStore[DocumentAbstraction <: DocumentSerializer](dbProtocol: St
     val start = transid.started(this, LoggingMarkers.DATABASE_QUERY, s"[COUNT] '$dbName' searching '$table")
 
     val f = client
-      .executeView(firstPart, secondPart)(
-        startKey = startKey,
-        endKey = endKey,
-        skip = Some(skip),
-        stale = stale,
-        reduce = true)
+      .executeView(firstPart, secondPart)(startKey = startKey, endKey = endKey, stale = stale, reduce = true)
       .map {
         case Right(response) =>
           val rows = response.fields("rows").convertTo[List[JsObject]]
 
           val out = if (!rows.isEmpty) {
             assert(rows.length == 1, s"result of reduced view contains more than one value: '$rows'")
-            rows.head.fields("value").convertTo[Long]
+            rows.head.fields("value").convertTo[Long] - skip
 
 Review comment:
   @chetanmeh, what happens if skip > value?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services