Comments (7)
when i add maven fast json in my class path ,it cant work.
from druidry.
where is DruidResponse class of the example, and i replace it as JSONObject, it cant also work .
List<JSONObject> responses = client.query(query, JSONObject.class);
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "timestamp" (class org.json.JSONObject), not marked as ignorable (0 known properties: ])
at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 16] (through reference chain: java.util.ArrayList[0]->org.json.JSONObject["timestamp"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:823)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1153)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1589)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1567)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1574)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965)
at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:838)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:257)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:236)
at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)
at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091)
at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874)
from druidry.
if i add the maven in my class path,
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
</dependency>
i get the exception:
Caused by: com.alibaba.fastjson.JSONException: expect '[', but {, pos 1, line 1, column 2{"error":"Could not resolve type id 'TOPN' into a subtype of [simple type, class org.apache.druid.query.Query]: known type ids = [Query, dataSourceMetadata, groupBy, scan, search, segmentMetadata, select, timeBoundary, timeseries, topN]\n at [Source: HttpInputOverHTTP@77d8b899[c=778,q=0,[0]=null,s=STREAM]; line: 1, column: 745]"}
at com.alibaba.fastjson.parser.DefaultJSONParser.parseArray(DefaultJSONParser.java:722)
at com.alibaba.fastjson.serializer.CollectionCodec.deserialze(CollectionCodec.java:126)
at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:689)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:378)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:443)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:551)
at com.alibaba.fastjson.support.jaxrs.FastJsonProvider.readFrom(FastJsonProvider.java:413)
... 16 more
from druidry.
Hi @shizhengchao
The DruidResponse
that is shown in Readme example is not actual class implemented in Druidry. That's just example for showing how can you map the response of the query to an object. You have to write you own mapping Class based on which query you are doing and than use that Class to map to query response.
Or simply you can use String result = client.query(query);
. Here result
will be a valid JSON string and you can map this string to JSONObject and use it.
from druidry.
Hey @shizhengchao
Is your issue resolved ? Let us know and we will close the issue.
from druidry.
i found the reason of the issue :
because of the 'com.alibaba.fastjson', When serializing a class to json, the enum type defaults to output name。For example the when enum QueryType.TOPN
serializing, it's TOPN, not topN。
from druidry.
Hey @shizhengchao
Is your issue resolved ? Let us know and we will close the issue.
yes, i resolved, thank you
from druidry.
Related Issues (20)
- In the examples, there is a bug around creating `DruidTopNQuery` HOT 1
- Cloud you update the README document? HOT 1
- Subtotalspec missing in the API HOT 4
- Looking for example of using https client with basic authentication. HOT 2
- Support offset in Scan Query
- Can druidry query metadata of datasources?
- Add HTTP Basic Auth to DruidJerseyClientAuth
- Add some additional aggregators
- Construct druidry query from json
- Make Context constructor public
- java.lang.NoSuchMethodError: javax.ws.rs.core.MultivaluedMap.addAll(Ljava/lang/Object;[Ljava/lang/Object;)V HOT 1
- Can't InFilter, OrFilter, and AndFilter all exist together? HOT 1
- Enable ordering for DruidScanQuery HOT 1
- Process Scan query result in chunks
- Support @Builder(toBuilder = true) for Context
- How to add offset value in DefaultLimitSpec using groupby query ? HOT 1
- Druidry should correctly handle Druid query errors
- Question: Is this repository still being maintained? HOT 2
- Can I convert it to the corresponding query entity through json
- DruidJerseyClient cannot handle Query Timeout
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from druidry.