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

Balaji Manoharan updated SOLR-5288:
-----------------------------------

    Summary: Delta import is calling applyTranformer() during deltaQuerry and 
causing exception  (was: Delta import is calling applyTranform() during 
deltaQuerry and causing exception)
    
> Delta import is calling applyTranformer() during deltaQuerry and causing 
> exception
> ----------------------------------------------------------------------------------
>
>                 Key: SOLR-5288
>                 URL: https://issues.apache.org/jira/browse/SOLR-5288
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.4
>            Reporter: Balaji Manoharan
>            Priority: Critical
>             Fix For: 4.4
>
>
> While experimenting delta import, was getting Script Exception such as 
> 'toString()' is not found on null.
> These are the queries that am using
> a) Query > SELECT PK_FIELD, JOIN_DATE, USER_NAME FROM USERS
> b) Delta Query > SELECY PK_FIELD FROM USERS WHERE LAST_MODIFIED_DATE > 
> '${dih.last_index_time}'
> c) Delta Import Query > SELECT PK_FIELD, JOIN_DATE, USER_NAME FROM USERS 
> WHERE PK_FIELD = '${dih.delta.PK_FIELD}'
> Have a script transformer as below
> function dynamicData(){
>       var joinDt = row.get('JOIN_DATE');
>       var dtDisplay = joinDt.toString();      //e.g to show that am not doing 
> null check since join_date is a not null field
>       ...........
>       ...........
>       return row;
> }
> <entity name="user" transformer="script:dynamicData" ...... >
> .......
> </entity>
> Problem: While performing delta import, was getting exception from Rhino 
> engine on the script line 'joinDt.toString()'.
> Root Cause: Since I know join_date can not be null, have explored the solr 
> source code and noticed that applyTransformer() is called during deltaQuery 
> and at that time join_date will not be available.
> Reference: EntityProcessorWrapper.nextModifiedRowKey()
> I think transformation is not required for deltaQuery since it is mainly 
> designed to retrieving the primary keys of the modified rows. Further, the 
> output of deltaQuery will be used only in another SQL.
> Work around:
> Just added a null check as a workaround as below 
> function dynamicData(){
>       var joinDt = row.get('JOIN_DATE');
>       if(joinDt == null){
>               return row;
>       }
>       ...........
>       ...........
>       return row;
> }
> I don't have too much knowledge about Solr and hence my suggestion could be 
> invalid while looking from main use cases.
> Please validate my comments once.
> Thanks
> Balaji

--
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to