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

Christine Poerschke commented on SOLR-16750:
--------------------------------------------

The 
https://github.com/apache/solr/pull/1573/commits/7415d30f6d0b70b5fa158f375498d219327076f3
 commit I just added on the https://github.com/apache/solr/pull/1573 branch 
does a {{instanceof}} check before casting:

{code}
-            mutableInt.value = (Integer) fieldType.toObject(field, 
original.groupValue);
+            Object o = fieldType.toObject(field, original.groupValue);
+            if (o instanceof EnumFieldValue) mutableInt.value = 
((EnumFieldValue) o).toInt();
+            else mutableInt.value = (Integer) o;
{code}

This then changes the distributed search test failure -- {{./gradlew -p 
solr/core test --tests TestDistributedGrouping}} -- and note that this is quite 
similar to the undistributed search test failure.

{code}
org.apache.solr.TestDistributedGrouping > test FAILED
    java.lang.AssertionError: .grouped[severity].groups[1].groupValue:Low!=1
        at 
__randomizedtesting.SeedInfo.seed([8C4A06A9AE408116:41E397300BCECEE]:0)
        at org.junit.Assert.fail(Assert.java:89)
        at 
org.apache.solr.BaseDistributedSearchTestCase.compareSolrResponses(BaseDistributedSearchTestCase.java:1075)
        at 
org.apache.solr.BaseDistributedSearchTestCase.compareResponses(BaseDistributedSearchTestCase.java:1105)
        at 
org.apache.solr.BaseDistributedSearchTestCase.query(BaseDistributedSearchTestCase.java:740)
        at 
org.apache.solr.BaseDistributedSearchTestCase.query(BaseDistributedSearchTestCase.java:718)
        at 
org.apache.solr.BaseDistributedSearchTestCase.query(BaseDistributedSearchTestCase.java:706)
        at 
org.apache.solr.TestDistributedGrouping.test(TestDistributedGrouping.java:790)
{code}

> Grouping on EnumFieldType fields fails
> --------------------------------------
>
>                 Key: SOLR-16750
>                 URL: https://issues.apache.org/jira/browse/SOLR-16750
>             Project: Solr
>          Issue Type: Bug
>          Components: Grouping
>            Reporter: Tomas Eduardo Fernandez Lobbe
>            Priority: Minor
>              Labels: newdev
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For single shard collections, Solr responds with the enum index instead of 
> the value. For multi-shard collections, Solr returns a 500 because internally 
> it gets a ClassCastException such as:
> {noformat}
> java.lang.ClassCastException: class org.apache.solr.common.EnumFieldValue 
> cannot be cast to class java.lang.Integer
> {noformat}



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