sashidhar commented on issue #7858: Turn ImmutableDruidDataSource into a data container URL: https://github.com/apache/incubator-druid/issues/7858#issuecomment-504492535 1. Introduced equalsForTesting() method and wrote a utils method assertEquals() for equality check of ImmutableDruidDataSource objects in tests (which makes use of equalsForTesting()). 2. When it comes to hashCode() things get interesting. Below is a case where hashCode() is not invoked explicitly from tests. collect() operation invokes hashCode() somewhere downstream. [listDataSources.stream().map(DruidDataSource::toImmutableDruidDataSource).collect(Collectors.toSet())](https://github.com/apache/incubator-druid/blob/master/server/src/test/java/org/apache/druid/server/http/DataSourcesResourceTest.java) Line 186. ``` java.lang.UnsupportedOperationException: hashCode:ImmutableDruidDataSource shouldn't be used as the key in containers at org.apache.druid.client.ImmutableDruidDataSource.hashCode(ImmutableDruidDataSource.java:168) at java.util.HashMap.hash(HashMap.java:339) at java.util.HashMap.put(HashMap.java:612) at java.util.HashSet.add(HashSet.java:220) at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at org.apache.druid.server.http.DataSourcesResourceTest.testSecuredGetFullQueryableDataSources(DataSourcesResourceTest.java:275) ... ``` How to handle this ?
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
