You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Aaron Greenspan (JIRA)" <ji...@apache.org> on 2013/07/09 08:19:51 UTC

[jira] [Commented] (SOLR-2907) java.lang.IllegalArgumentException: deltaQuery has no column to resolve to declared primary key pk='ITEM_ID, CATEGORY_ID'

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

Aaron Greenspan commented on SOLR-2907:
---------------------------------------

I just ran into this in Solr 4.3.0. The error message is extremely confusing. The situation I encountered involved an SQL query where there WAS an "id" field defined in the main "query" query, as well as a "field" with column="id" and name="id" and yet I would keep getting the error...

deltaQuery has no column to resolve to declared primary key pk='id'

It turns out that what this really means is that a useless field called "id" (or whatever the primary key is set to) also has to be in the "deltaQuery" query itself, even if you never reference a field called "id" from the deltaQuery (which I don't). I only reference a field called something else, e.g. blahid, from the deltaQuery. Why deltaQuery needs this redundant field when it's apparently never used is beyond me. Or if there is a good reason, this error message should definitely be changed given that this has been an open ticket for two years.
                
> java.lang.IllegalArgumentException: deltaQuery has no column to resolve to declared primary key pk='ITEM_ID, CATEGORY_ID'
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-2907
>                 URL: https://issues.apache.org/jira/browse/SOLR-2907
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler, Schema and Analysis
>    Affects Versions: 3.4
>            Reporter: Alan Baker
>
> We are using solr for our site and ran into this error in our own schema and I was able to reproduce it using the dataimport example code in the solr project.  We do not get this error in SOLR 1.4 only started seeing it as we are working to upgrade to 3.4.0.  It fails when delta-importing linked tables.
> Complete trace:
> Nov 18, 2011 5:21:02 PM org.apache.solr.handler.dataimport.DataImporter doDeltaImport
> SEVERE: Delta Import Failed
> java.lang.IllegalArgumentException: deltaQuery has no column to resolve to declared primary key pk='ITEM_ID, CATEGORY_ID'
> 	at org.apache.solr.handler.dataimport.DocBuilder.findMatchingPkColumn(DocBuilder.java:849)
> 	at org.apache.solr.handler.dataimport.DocBuilder.collectDelta(DocBuilder.java:900)
> 	at org.apache.solr.handler.dataimport.DocBuilder.collectDelta(DocBuilder.java:879)
> 	at org.apache.solr.handler.dataimport.DocBuilder.doDelta(DocBuilder.java:285)
> 	at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:179)
> 	at org.apache.solr.handler.dataimport.DataImporter.doDeltaImport(DataImporter.java:390)
> 	at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:429)
> 	at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)
> I used this dataConfig from the wiki on the data import:
> <dataConfig>
>     <dataSource driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:./example-DIH/hsqldb/ex" user="sa" />
>     <document>
>    <entity  name="item" pk="ID" 
>    			query="select * from item" 
>             deltaImportQuery="select * from item where ID=='${dataimporter.delta.id}'"
>             deltaQuery="select id from item where last_modified &gt; '${dataimporter.last_index_time}'">
>             <entity name="item_category" pk="ITEM_ID, CATEGORY_ID"
>                     query="select CATEGORY_ID from item_category where ITEM_ID='${item.ID}'"
>                     deltaQuery="select ITEM_ID, CATEGORY_ID from item_category where last_modified > '${dataimporter.last_index_time}'"
>                     parentDeltaQuery="select ID from item where ID=${item_category.ITEM_ID}">
>                 
>         		<entity name="category" pk="ID"
>                         query="select DESCRIPTION as cat from category where ID = '${item_category.CATEGORY_ID}'"
>                         deltaQuery="select ID from category where last_modified &gt; '${dataimporter.last_index_time}'"
>                         parentDeltaQuery="select ITEM_ID, CATEGORY_ID from item_category where CATEGORY_ID=${category.ID}"/>
>             	</entity>
>         </entity>
>         
>     </document>
> </dataConfig>
> To reproduce use the data config from above and set the dataimport.properties last update times to before the last_modifed date in the example data.  I my case I had to set the year to 1969.  Then run a delta-import and the exception occurs.  Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org