influxdata / influxdb-client-java

InfluxDB 2 JVM Based Clients

Home Page:https://influxdata.github.io/influxdb-client-java/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`InfluxQLQueryService` should use the `application/json` accept HTTP header to ensure that field results are mapped to the correct types

j3r0lin opened this issue · comments

Proposal:
InfluxQLQueryService should use json accept header to retain series points values original types.
Current behavior:
Current is 'application/csv', all values are read as string.

	@Headers({ "Accept:application/csv", "Content-Type:application/vnd.influxql" })
	@POST("query")
	Call<ResponseBody> query(
			@Body String query,
			@Nonnull @Query("db") String db,
			@Query("rp") String retentionPolicy,
			@Query("epoch") String epoch,
			@Header("Zap-Trace-Span") String zapTraceSpan
	);

Use case:
Why is this important (helps with prioritizing requests)?

API:
https://docs.influxdata.com/influxdb/v2/api/v1-compatibility/#operation/PostQueryV1

Hi @j3r0lin,

Thank you for your suggestion and for using our client. To better address your concern regarding the data types not being correctly handled when querying with "Accept: application/csv", could you please specify which specific data types are causing issues?

Additionally, a runnable piece of code that demonstrates the problem would be incredibly helpful for us to understand and replicate the issue. This would allow us to provide a more accurate assessment and solution.

Looking forward to your response, and thank you once again for your valuable input.

Best Regards.

Currently, all returned data is in the format of application/csv, which causes the values returned by the query method to always be of string type, regardless of the measurement fields' types.
However, I expect the query to return values of type float when the field type is float.
Additionally, because I need to query measurements of different types using a single query method, I cannot utilize the type mapping functionality provided by the query method.

Hi @j3r0lin,

Thank you for providing the additional details needed to understand the issue more clearly. I have added this to our development backlog and we aim to address it in the next maintenance release of our client.

We appreciate your patience and input as it helps us improve the product. We will keep you updated on the progress and let you know once the update is available.

Best regards