zapr-oss / druidry

Java based Druid Query Generator library
Apache License 2.0
194 stars 89 forks source link

Issue witth TopN Query #56

Closed gsRatti1 closed 4 years ago

gsRatti1 commented 6 years ago

Hi,

I am facing some issue with TopN query. When I generate a druiddry topN query in code, and query druid using it (client.query()), i get the following exception:

javax.ws.rs.ProcessingException: Error reading entity from input stream.

Complete trace :

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.LinkedHashMap out of START_ARRAY token at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 51] (through reference chain: java.util.ArrayList[0]->com.uipath.analytics.dataPlatform.store.DruidResponse["result"]) at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromEmpty(StdDeserializer.java:599) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:360) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:136) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1574) ~[jackson-databind-2.9.6.jar:2.9.6] at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965) ~[jackson-databind-2.9.6.jar:2.9.6] at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:838) ~[jersey-media-json-jackson-2.26.jar:na] at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:257) ~[jersey-common-2.26.jar:na] at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:236) ~[jersey-common-2.26.jar:na] at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156) ~[jersey-common-2.26.jar:na] at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091) ~[jersey-common-2.26.jar:na] at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874) ~[jersey-common-2.26.jar:na] ... 77 common frames omitted

2018-10-17 12:28:34 INFO DruidReader:66 - Druid execution exception :in.zapr.druid.druidry.client.exception.QueryException: javax.ws.rs.ProcessingException: Error reading entity from input stream.

The query which was generated is -

{ "dataSource": "system-process-insights", "queryType": "topN", "intervals": ["2018-10-06T11:30:00.000+05:30/2018-10-06T12:30:00.000+05:30"], "granularity": "hour", "aggregations": [{ "type": "longSum", "name": "a1", "fieldName": "memUsedVirtual" }, { "type": "longSum", "name": "a2", "fieldName": "memUsedRam" }], "dimension": "processName", "threshold": 5, "metric": "a1" }

If I run this same query directly (using curl), then it gives me proper result. But through druid dry it is failing. Other queries, groupBy/timeSeries are fine. If I change the type of this query to group by then it works. Please help.

nihit-zapr commented 6 years ago

@gsRatti1 Can you tell us the druidry version? Also check if any other packages are overriding the jersey and jackson version used in druidry.

gsRatti1 commented 6 years ago

I am using version 2.4. Any issue with this? What is surprising is that only TopN is failing, groupBy is working fine.

gsratti commented 5 years ago

Hi, any update on this?

abhi-zapr commented 4 years ago

Hey @gsratti if you are working on this and still facing issue, can you once check the dependency:tree of your project and check if jersey and jackson dependency clash is happening. You could try excluding these dependencies from either druidry or other sources.

And closing this issue due to inactivity, for further queries on this issue free to comment we can reopen it.