You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Sudheer Prem (JIRA)" <ji...@apache.org> on 2013/03/12 06:33:13 UTC

[jira] [Updated] (SOLR-4561) CachedSqlEntityProcessor with parametarized query is broken

     [ https://issues.apache.org/jira/browse/SOLR-4561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sudheer Prem updated SOLR-4561:
-------------------------------

    Description: 
When child entities are created and the child entity is provided with a parametrized query as below, 
{code:xml} 
<entity name="x" query="select * from x">
    <entity name="y" query="select * from y where xid=${x.id}" processor="CachedSqlEntityProcessor">
    </entity>
<entity>
the Entity Processor always return the result from the fist query even though the parameter is changed, It is happening because, EntityProcessorBase.getNext() method doesn't reset the query and rowIterator after calling DIHCacheSupport.getCacheData() method.

This can be fixed by changing the else block in getNext() method of EntityProcessorBase from
{code} 
else  {
      return cacheSupport.getCacheData(context, query, rowIterator);
      
}
{code} 

to the code mentioned below:
{code} 
else  {
      Map<String,Object> cacheData = cacheSupport.getCacheData(context, query, rowIterator);
      query = null;
      rowIterator = null;
      return cacheData;
    }
{code}   

  was:
When child entities are created and the child entity is provided with a parametrized query as below, 
<entity name="x" query="select * from x">
    <entity name="y" query="select * from y where xid=${x.id}" processor="CachedSqlEntityProcessor">
    </entity>
<entity>
the Entity Processor always return the result from the fist query even though the parameter is changed, It is happening because, EntityProcessorBase.getNext() method doesn't reset the query and rowIterator after calling DIHCacheSupport.getCacheData() method.

This can be fixed by changing the else block in getNext() method of EntityProcessorBase from
else  {
      return cacheSupport.getCacheData(context, query, rowIterator);
      
}

to the code mentioned below:

else  {
      Map<String,Object> cacheData = cacheSupport.getCacheData(context, query, rowIterator);
      query = null;
      rowIterator = null;
      return cacheData;
    }  

    
> CachedSqlEntityProcessor with parametarized query is broken
> -----------------------------------------------------------
>
>                 Key: SOLR-4561
>                 URL: https://issues.apache.org/jira/browse/SOLR-4561
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.1
>            Reporter: Sudheer Prem
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> When child entities are created and the child entity is provided with a parametrized query as below, 
> {code:xml} 
> <entity name="x" query="select * from x">
>     <entity name="y" query="select * from y where xid=${x.id}" processor="CachedSqlEntityProcessor">
>     </entity>
> <entity>
> the Entity Processor always return the result from the fist query even though the parameter is changed, It is happening because, EntityProcessorBase.getNext() method doesn't reset the query and rowIterator after calling DIHCacheSupport.getCacheData() method.
> This can be fixed by changing the else block in getNext() method of EntityProcessorBase from
> {code} 
> else  {
>       return cacheSupport.getCacheData(context, query, rowIterator);
>       
> }
> {code} 
> to the code mentioned below:
> {code} 
> else  {
>       Map<String,Object> cacheData = cacheSupport.getCacheData(context, query, rowIterator);
>       query = null;
>       rowIterator = null;
>       return cacheData;
>     }
> {code}   

--
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