Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
j3r0lin opened this issue May 24, 2024 · 3 comments · Fixed by #733
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@j3r0lin
Copy link

j3r0lin commented May 24, 2024

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

@bednar
Copy link
Contributor

bednar commented May 27, 2024

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.

@j3r0lin
Copy link
Author

j3r0lin commented May 27, 2024

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.

@bednar
Copy link
Contributor

bednar commented May 27, 2024

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

@bednar bednar added the question Further information is requested label May 27, 2024
@bednar bednar changed the title Use JSON accept header to send InfluxQL query InfluxQLQueryService should use application/json accept HTTP header to be able map fields results into proper types May 27, 2024
@bednar bednar changed the title InfluxQLQueryService should use application/json accept HTTP header to be able map fields results into proper types InfluxQLQueryService should use the application/json accept HTTP header to ensure that field results are mapped to the correct types May 27, 2024
@bednar bednar added enhancement New feature or request and removed question Further information is requested labels May 27, 2024
@bednar bednar added this to the 7.2.0 milestone Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants