Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1dp
    • Fix Version/s: 1.1-dp4
    • Component/s: Core
    • Security Level: Public
    • Labels:
      None

      Description

      I am running couchbase server version 2.0.0 community edition (build-722) and the latest java couchbase client, couchbase-client-1.1-dp.jar

      I realize all this is developer preview however, this seems pretty basic stuff for dp4. Can you help?

      I have some simple test documents that look as follows

      { "account_id": "-2", "value": "2.00000000", "created_at": "2012-04-06 03:55:22", }

      and a simple view called counts in the transactions document defined as follows

      function (doc)

      { emit([doc.account_id, doc.created_at], parseFloat(doc.value)); }

      with a _stats reduce function

      I can correctly run queries using complex keys using the couchbase design view in the management interface, or issue requests from my browser / curl as follows

      http://127.0.0.1:8092/default/_design/dev_transactions/_view/counts?group_level=2&startkey=["-1","2012-04-06 01:28:30"]&endkey=["-1","2012-04-07 01:49:26"]&group=true&reduce=true&stale=false

      and get the correct response

      {"rows":[
      {"key":["-1","2012-04-06 03:55:21"],"value":{"sum":2,"count":1,"min":2,"max":2,"sumsqr":4}},
      {"key":["-1","2012-04-06 03:55:22"],"value":{"sum":3,"count":1,"min":3,"max":3,"sumsqr":9}},
      {"key":["-1","2012-04-06 03:55:33"],"value":{"sum":5,"count":2,"min":2,"max":3,"sumsqr":13}}
      ]
      }
      However when I try to do a range query from java I get a null result. If I leave off the range keys, everything works as would be expected.

      A null result looks to me as if the server did not respond. But, using the debugger I can tell that the url is correctly created. Any thoughts?

      CouchbaseClient couchbase = new CouchbaseClient(couchbaseURIs, "default", "");
      Query query = new Query();
      query.setRange("[\"-1\",\"2012-04-06 01:28:30\"]", "[\"-1\",\"2012-04-06 01:49:26\"]");
      query.setGroup(true, 2);
      query.setStale(Stale.FALSE);
      query.setReduce(true);
      query.setIncludeDocs(false);

      View view = couchbase.getView("transactions", "counts");
      if (view != null) {
      ViewResponse result = couchbase.query(view, query);
      ViewRow row;

      Iterator<ViewRow> itr = result.iterator();

      while(itr.hasNext())

      { row = itr.next(); System.out.println("Key: " + row.getKey()+ " : " + row.getValue()); }

      }
      }

      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        Hide
        TimSmith Tim Smith (Inactive) added a comment -

        See related JCBC-41 and JCBC-48

        Show
        TimSmith Tim Smith (Inactive) added a comment - See related JCBC-41 and JCBC-48
        Hide
        ingenthr Matt Ingenthron added a comment -

        Please verify this use case is handled with the new changes and addition of ComplexKey.

        Show
        ingenthr Matt Ingenthron added a comment - Please verify this use case is handled with the new changes and addition of ComplexKey.
        Hide
        daschl Michael Nitschinger added a comment -

        I guess this should be fixed with the recent additions, here is an example on how to do it:

        ComplexKey rangeStart = ComplexKey.of("-1", "2012-04-06 01:28:30");
        ComplexKey rangeEnd = ComplexKey.of("-1", "2012-04-07 01:49:26");
        Query query = new Query()
        .setRange(rangeStart, rangeEnd)
        .setGroup(true)
        .setGroupLevel(2)
        .setStale(Stale.FALSE)
        .setReduce(true)
        .setIncludeDocs(false);

        You can call the toString() method on the query and this prints the following query string: ?group_level=2&startkey=["-1","2012-04-06 01:28:30"]&endkey=["-1","2012-04-07 01:49:26"]&group=true&reduce=true&stale=false

        Which should be pretty much what we need in this case.

        Show
        daschl Michael Nitschinger added a comment - I guess this should be fixed with the recent additions, here is an example on how to do it: ComplexKey rangeStart = ComplexKey.of("-1", "2012-04-06 01:28:30"); ComplexKey rangeEnd = ComplexKey.of("-1", "2012-04-07 01:49:26"); Query query = new Query() .setRange(rangeStart, rangeEnd) .setGroup(true) .setGroupLevel(2) .setStale(Stale.FALSE) .setReduce(true) .setIncludeDocs(false); You can call the toString() method on the query and this prints the following query string: ?group_level=2&startkey= ["-1","2012-04-06 01:28:30"] &endkey= ["-1","2012-04-07 01:49:26"] &group=true&reduce=true&stale=false Which should be pretty much what we need in this case.
        Hide
        mikew Mike Wiederhold added a comment -

        Michael,

        If this issue is resolved then please close this bug as fixed and include the bug id for the Complex Key fix in the comments.

        Show
        mikew Mike Wiederhold added a comment - Michael, If this issue is resolved then please close this bug as fixed and include the bug id for the Complex Key fix in the comments.
        Hide
        daschl Michael Nitschinger added a comment -

        I'll close this one now - pleasw reopen it if the problem still exists.

        @Mike: we didn't have a jcbc ticket for the complexkey changes, but here is the github commit as a reference:
        https://github.com/couchbase/couchbase-java-client/commit/2178868be2bd3212d19e02943da26c72762509d3

        Show
        daschl Michael Nitschinger added a comment - I'll close this one now - pleasw reopen it if the problem still exists. @Mike: we didn't have a jcbc ticket for the complexkey changes, but here is the github commit as a reference: https://github.com/couchbase/couchbase-java-client/commit/2178868be2bd3212d19e02943da26c72762509d3
        Hide
        daschl Michael Nitschinger added a comment -

        Fixed/Implemented with the ComplexKey changes.

        Show
        daschl Michael Nitschinger added a comment - Fixed/Implemented with the ComplexKey changes.

          People

          • Assignee:
            daschl Michael Nitschinger
            Reporter:
            mikew Mike Wiederhold
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes