You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Gunnlaugur Thor Briem (JIRA)" <ji...@apache.org> on 2014/02/13 13:39:20 UTC

[jira] [Commented] (SOLR-5597) ClassCastException occurs when importing CLOB-fields using SqlEntityProcessor and SortedMapBackedCache

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

Gunnlaugur Thor Briem commented on SOLR-5597:
---------------------------------------------

Same error occurs with a field of type integer. I suggest changing title to “DataImportHandler fails if integer column used as key or value in cache”. I'm working around this by casting all columns involved to TEXT:

{code:xml}
<entity name="parent" dataSource="d" query="SELECT id, xyz, child_id::TEXT FROM parent;">
  <entity name="child" dataSource="d" query="SELECT id::TEXT, abc FROM child;"
          processor="CachedSqlEntityProcessor"
          where="id=par.child_id"/>
</entity>
{code}

(As the use of the legacy CachedSqlEntityProcessor suggests, I encountered this while trying an upgrade from Solr 3.5, where integer columns were working.)

> ClassCastException occurs when importing CLOB-fields using SqlEntityProcessor and SortedMapBackedCache
> ------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-5597
>                 URL: https://issues.apache.org/jira/browse/SOLR-5597
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.6
>            Reporter: Henrik Wingerei
>
> Using the SqlEntityProcessor with the SortedMapBackedCache as cache implementation, gives the following ClassCastException when trying to import a field of type oracle.sql.CLOB.
> 2014-01-02 09:32:19,143 [ERROR] [Thread-54] Exception in entity : <field-name>:java.lang.ClassCastException: oracle.sql.CLOB cannot be cast to java.lang.Comparable
>         at java.util.TreeMap.getEntry(TreeMap.java:325)
>         at java.util.TreeMap.get(TreeMap.java:255)
>         at org.apache.solr.handler.dataimport.SortedMapBackedCache.add(SortedMapBackedCache.java:61)
>         at org.apache.solr.handler.dataimport.DIHCacheSupport.populateCache(DIHCacheSupport.java:124)
>         at org.apache.solr.handler.dataimport.DIHCacheSupport.getSimpleCacheData(DIHCacheSupport.java:199)
>         at org.apache.solr.handler.dataimport.DIHCacheSupport.getCacheData(DIHCacheSupport.java:147)
>         at org.apache.solr.handler.dataimport.EntityProcessorBase.getNext(EntityProcessorBase.java:129)
>         at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:75)
>         at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:243)
>         at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:469)
>         at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:495)
>         at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:408)
>         at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:323)
>         at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:231)
>         at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:411)
>         at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:476)
>         at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:457)
> -- org.apache.solr.handler.dataimport.EntityProcessorWrapper
> It seems that this occurs because the SortedMapBackedCache uses a java.util.TreeMap as the underlying cache, and TreeMap requires that all elements implements the java.lang.Comparable interface. However oracle.sql.CLOB does not implement Comparable and the import fails when the TreeMap implementation tries to cast the element to a Comparable (this occurs on line 325 in TreeMap.java - java version 1.6.0_33).



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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