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

ASF GitHub Bot updated SOLR-18496:
----------------------------------
    Labels: pull-request-available  (was: )

> Single-pass distributed query fails with an NPE when the unique key is 
> renamed in fl
> ------------------------------------------------------------------------------------
>
>                 Key: SOLR-18496
>                 URL: https://issues.apache.org/jira/browse/SOLR-18496
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Serhiy Bzhezytskyy
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> With {{distrib.singlePass=true}}, a non-grouped distributed query whose 
> {{fl}} renames the unique key without also requesting it fails with HTTP 500. 
> The two-pass path (SOLR-6744) and grouped queries (SOLR-15273) handle the 
> rename; the single-pass merge in {{QueryComponent.mergeIds}} does not, and 
> {{CombinedQueryComponent.mergeIds}} has the same lookup.
> To reproduce (SolrCloud, two shards):
> {code:bash}
> bin/solr start
> bin/solr create -c test --shards 2
> curl 'http://localhost:8983/solr/test/update?commit=true' -H 'Content-Type: 
> application/json' -d '[{"id":"a1"},{"id":"a2"},{"id":"a3"}]'
> curl 
> 'http://localhost:8983/solr/test/select?q=*:*&fl=aliasId:id&distrib.singlePass=true'
> {code}
> The response is a 500:
> {noformat}
> java.lang.NullPointerException: Cannot invoke "Object.toString()" because 
> "shardDoc.id" is null
>   at 
> org.apache.solr.handler.component.QueryComponent$3.resultIds(QueryComponent.java:963)
>   at 
> org.apache.solr.handler.component.QueryComponent.setResultIdsAndResponseDocs(QueryComponent.java:1290)
>   at 
> org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:1234)
> {noformat}
> The same request without {{distrib.singlePass}}, or with 
> {{fl=id,aliasId:id}}, returns the documents. Through the combined query 
> handler, {{"fields": ["key:id"]}} together with {{"distrib.singlePass": 
> true}} fails the same way in {{CombinedQueryComponent.mergeIds}}.
> In single-pass mode the shards run the original {{fl}}, so they return the 
> key as {{aliasId}}, while {{mergeIds}} reads it under the schema name {{id}} 
> and gets null. {{returnFields}} already reads the renamed key. The fix is to 
> read the key under the name {{fl}} gave it in both {{mergeIds}} 
> implementations, only for single-pass requests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to