[jira] Updated: (SOLR-1870) Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable)
[ https://issues.apache.org/jira/browse/SOLR-1870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hoss Man updated SOLR-1870: --- Attachment: SOLR-1870-test.patch SOLR-1870.patch Noble: the newly updated SOLR-1870-test.patch demonstrates the concern i have for your fix: if the JavaBinCodec has support for Iterator and Iterable, but the JavaBinUpdateRequestCodec makes assumptions about Iterators only being used for streaming docs, then if people add Field values containing Custom objects that implement Iterable but are not actually Collection then the JavaBinUpdateRequestCodec will marshal them correctly, but it will have a ClassCastException when unmarshaling them -- ditto for people who want to add lazy Iterators as field values. I don't disagree that making JavaBinCodec support Collection is a good idea in general, but it doesn't fix the root problem -- i think we need both changes. The latest SOLR-1870.patch incorporates both my suggested fix for JavaBinUpdateRequestCodec, as well as your change to JavaBinCodec (with my suggested tweak of replacing List with Collection in the if tree), and all of the tests i've previously posted (ie: SOLR-1870-test.patch is for illustrative purposes only, it's not needed) what do you think? Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable) Key: SOLR-1870 URL: https://issues.apache.org/jira/browse/SOLR-1870 Project: Solr Issue Type: Bug Components: clients - java, update Affects Versions: 1.4 Reporter: Prasanna Ranganathan Fix For: 1.4.1, 3.1, 4.0 Attachments: SOLR-1870-test.patch, SOLR-1870-test.patch, SOLR-1870.patch, SOLR-1870.patch, SOLR-1870.patch When the field type of a field in a SolrInputDocument is a Collection based on the Set interface, the JavaBinUpdate request fails. It works when sending the document data over XML. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] Updated: (SOLR-1870) Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable)
[ https://issues.apache.org/jira/browse/SOLR-1870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hoss Man updated SOLR-1870: --- Fix Version/s: 1.4.1 3.1 4.0 we should try to get this into 1.4.1 if we can get consensus on the fix. Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable) Key: SOLR-1870 URL: https://issues.apache.org/jira/browse/SOLR-1870 Project: Solr Issue Type: Bug Components: clients - java, update Affects Versions: 1.4 Reporter: Prasanna Ranganathan Fix For: 1.4.1, 3.1, 4.0 Attachments: SOLR-1870-test.patch, SOLR-1870-test.patch, SOLR-1870.patch, SOLR-1870.patch, SOLR-1870.patch When the field type of a field in a SolrInputDocument is a Collection based on the Set interface, the JavaBinUpdate request fails. It works when sending the document data over XML. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] Updated: (SOLR-1870) Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable)
[ https://issues.apache.org/jira/browse/SOLR-1870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Noble Paul updated SOLR-1870: - Attachment: SOLR-1870.patch fixing JavabinCodec to write collection as array Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable) Key: SOLR-1870 URL: https://issues.apache.org/jira/browse/SOLR-1870 Project: Solr Issue Type: Bug Components: clients - java, update Affects Versions: 1.4 Reporter: Prasanna Ranganathan Attachments: SOLR-1870-test.patch, SOLR-1870.patch, SOLR-1870.patch When the field type of a field in a SolrInputDocument is a Collection based on the Set interface, the JavaBinUpdate request fails. It works when sending the document data over XML. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. - To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] Updated: (SOLR-1870) Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable)
[ https://issues.apache.org/jira/browse/SOLR-1870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Hoss Man updated SOLR-1870: --- Description: When the field type of a field in a SolrInputDocument is a Collection based on the Set interface, the JavaBinUpdate request fails. It works when sending the document data over XML. was: When the field type of a field in a SolrInputDocument is a Collection based on the Set interface, the JavaBinUpdate request fails. It works when sending the document data over XML. I encountered this error when updating my indexer to write documents in the binary format. I initially got a ClassCastException and after digging into it found the likely cause for it. The following piece of code added to 'public void simple() throws IOException' method in TestUpdateRequestCodec.java illustrates the error. doc = new SolrInputDocument(); CollectionString foobar = new HashSetString(); foobar.add(baz1); foobar.add(baz2); doc.addField(foobar,foobar); updateRequest.add(doc); The test fails for any Collection derived from the Set interface but will work if the Collection is a List / Array or other types. The stack trace is as follows: java.lang.ClassCastException: java.lang.String at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readIterator(JavaBinUpdateRequestCodec.java:121) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:210) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readNamedList(JavaBinUpdateRequestCodec.java:107) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:175) at org.apache.solr.common.util.JavaBinCodec.readArray(JavaBinCodec.java:405) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:171) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readIterator(JavaBinUpdateRequestCodec.java:119) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:210) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readNamedList(JavaBinUpdateRequestCodec.java:107) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:175) at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:101) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec.unmarshal(JavaBinUpdateRequestCodec.java:126) at org.apache.solr.client.solrj.request.TestUpdateRequestCodec.simple(TestUpdateRequestCodec.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:99) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) The error most likely is in the way javabin codec encodes Sets. In the public boolean writeKnownType(Object val) method in JavaBinCodec.java, a Set is recognized as an instance of iterable and the writeIterator method is called. I briefly looked at the writeIterator and readIterator methods and was unable to pinpoint the error. I also looked at the javabin encoded byte stream (not exactly a good way to debug..) and it did not look like it was right. Moving Prasanna's original stack trace and verbose details into comment and reformatting... {quote} I encountered this error when updating my indexer to write documents in the binary format. I initially got a ClassCastException and after digging into it found the likely cause for it. The following piece of code added to 'public void simple() throws IOException' method in TestUpdateRequestCodec.java illustrates the error. {code} doc = new SolrInputDocument(); CollectionString
[jira] Updated: (SOLR-1870) Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable)
[ https://issues.apache.org/jira/browse/SOLR-1870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Prasanna Ranganathan updated SOLR-1870: --- Summary: Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable) (was: JavaBinUpdateRequestCodec (and javabin codec) fails when the field type of a multivalued field is a Set (or any type that is identified as an instance of iterable) ) Binary Update Request (javabin) fails when the field type of a multivalued SolrInputDocument field is a Set (or any type that is identified as an instance of iterable) Key: SOLR-1870 URL: https://issues.apache.org/jira/browse/SOLR-1870 Project: Solr Issue Type: Bug Components: update Affects Versions: 1.4 Reporter: Prasanna Ranganathan Priority: Minor When the field type of a field in a SolrInputDocument is a Collection based on the Set interface, the JavaBinUpdate request fails. It works when sending the document data over XML. I encountered this error when updating my indexer to write documents in the binary format. I initially got a ClassCastException and after digging into it found the likely cause for it. The following piece of code added to 'public void simple() throws IOException' method in TestUpdateRequestCodec.java illustrates the error. doc = new SolrInputDocument(); CollectionString foobar = new HashSetString(); foobar.add(baz1); foobar.add(baz2); doc.addField(foobar,foobar); updateRequest.add(doc); The test fails for any Collection derived from the Set interface but will work if the Collection is a List / Array or other types. The stack trace is as follows: java.lang.ClassCastException: java.lang.String at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readIterator(JavaBinUpdateRequestCodec.java:121) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:210) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readNamedList(JavaBinUpdateRequestCodec.java:107) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:175) at org.apache.solr.common.util.JavaBinCodec.readArray(JavaBinCodec.java:405) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:171) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readIterator(JavaBinUpdateRequestCodec.java:119) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:210) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$2.readNamedList(JavaBinUpdateRequestCodec.java:107) at org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:175) at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:101) at org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec.unmarshal(JavaBinUpdateRequestCodec.java:126) at org.apache.solr.client.solrj.request.TestUpdateRequestCodec.simple(TestUpdateRequestCodec.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:99) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) The error most likely is in the way javabin codec encodes Sets. In the public boolean writeKnownType(Object val) method in