You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Amrit Sarkar (JIRA)" <ji...@apache.org> on 2018/08/11 15:06:00 UTC

[jira] [Commented] (SOLR-12658) Extend support for more than 4 field in 'partitionKeys' in ParallelStream after SOLR-11598

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

Amrit Sarkar commented on SOLR-12658:
-------------------------------------

Attached patch which considers all field values specified under 'partitionKeys' for calculating {{CompositeHash}}, responsible for calculating worker a document belongs for processing.

> Extend support for more than 4 field in 'partitionKeys' in ParallelStream after SOLR-11598
> ------------------------------------------------------------------------------------------
>
>                 Key: SOLR-12658
>                 URL: https://issues.apache.org/jira/browse/SOLR-12658
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: streaming expressions
>            Reporter: Amrit Sarkar
>            Priority: Minor
>
> SOLR-11598 extended the capabilities for Export handler to have more than 4 fields for sorting.
> As streaming expressions leverages Export handler, ParallelStream allowed maximum 4 fields in "{color:blue}partitionKeys{color}" and silently ignored rest of the fields if more than 4 are specified.
>  HashQParserPlugin:CompositeHash: 347
> {code}
>   private static class CompositeHash implements HashKey {
>     private HashKey key1;
>     private HashKey key2;
>     private HashKey key3;
>     private HashKey key4;
>     public CompositeHash(HashKey[] hashKeys) {
>       key1 = hashKeys[0];
>       key2 = hashKeys[1];
>       key3 = (hashKeys.length > 2) ? hashKeys[2] : new ZeroHash();
>       key4 = (hashKeys.length > 3) ? hashKeys[3] : new ZeroHash();
>     }
>     public void setNextReader(LeafReaderContext context) throws IOException {
>       key1.setNextReader(context);
>       key2.setNextReader(context);
>       key3.setNextReader(context);
>       key4.setNextReader(context);
>     }
>     public long hashCode(int doc) throws IOException {
>       return key1.hashCode(doc)+key2.hashCode(doc)+key3.hashCode(doc)+key4.hashCode(doc);
>     }
>   }
> {code}
> To make sure we have documents distributed across workers when executing streaming expression parallely, all the fields specified in 'partitionKeys' should be considered in calculating to which worker particular document should go for further processing.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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