Couchbase 2 - View on non JSON docs
Using the java client API :
I'm trying to query a view which contains non JSON docs (binary serialized Java Objects)
When executing the query (using the Java Client API - latest release) I'm getting the following exception:
Exception in thread "main" java.lang.ClassCastException: [my class name removed] cannot be cast to java.lang.String
at com.couchbase.client.protocol.views.ViewRowWithDocs.(ViewRowWithDocs.java:39)
at com.couchbase.client.internal.ViewFuture.get(ViewFuture.java:97)
at com.couchbase.client.internal.ViewFuture.get(ViewFuture.java:48)
at com.couchbase.client.internal.HttpFuture.get(HttpFuture.java:65)
at com.couchbase.client.CouchbaseClient.query(CouchbaseClient.java:584)
My Query instance is set to fetch the docs : query.setIncludeDocs(true)
When set to query.setIncludeDocs(false) - the query execution succeeds but in that case, I don't have the actual docs and I will have to perform an explicit get on each returned row.
Can you add support for this scenario in the java client?
Is this a formal Couchbase employee response? View query involves Disk I/O ?? I'm not sure about that. If your map can fully reside in memory I don't think that there is any IO involved.
I know that Views are slower than multi get due to the RESTful interface of view query as opposed to the binary protocol of single/multi get. But it has nothing to do with disk io.
Can someone from Couchbase provide answers to the above discussion / bug report?
You can read more about view performance here:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-opera...
I wasn't aware of that - thanks for pointing it out. I hope that the file system caching is in some way a prevention mechanism against seek IO.
In any case - the bug described above is still an issue and a Couchbase response should be kindly supplied here.
Hi,
thanks for bringing this up. I filed a ticket for this, where you can track the status too. http://www.couchbase.com/issues/browse/JCBC-125
I'm working on it!
Thanks,
Michael
Both john and daschl are part of Couchbase, Inc. Please feel free to email matt at couchbase if there's anything more I can do. We'll have more improvements to serving views in future releases.
Thanks!
Matt
It's actually likely to be faster to perform an explicit get or multi-get on the docs, since that will pull docs from memory and avoid disk I/O...