influxdb-java icon indicating copy to clipboard operation
influxdb-java copied to clipboard

Is possible to store in an array the result of a query?

Open domixr opened this issue 7 years ago • 4 comments

Hi, I use the method toPojo to store the result of a query in my Java class, using in that class, for each field, the annotation Column. The problem is that some field of my pojo class are arrays. In order to explain in a better way my problem, I will describe in an easy way my scenario. In my db I have many fields(700 more or less) and some of them are called like value_0, value_1, value_2,... In my Java class, to avoid to create 700 fields, I have (among others) a field called values[] (that is an array), so I would to know whether there is a method (in order to avoid to parserize manually the result of a query) that can store the result corrisponding to more columns of the db in that array. I hope I was clear, thanks in advance!

domixr avatar Dec 29 '18 16:12 domixr

Would an implementation of something like the below accepted as an API?

@Columns(prefix = "value_", start = 1, end = 700)
private double[] values;

asashour avatar Jan 21 '19 15:01 asashour

It will be more generic way to get data when the fields and the tags are not predefined .. specially for some heuristic work. Can someone share some example ?

I have posted similar queries - https://github.com/influxdata/influxdb-java/issues/568

tutaidalal avatar Jan 24 '19 11:01 tutaidalal

@asashour it is exactly what I would! For the moment I solved the problem writing a parser that store in the arrays of my bean the values ​​of the query but I think that an api like the one posted by you can be very useful.

domixr avatar Jan 30 '19 09:01 domixr

@domixr before moving forward with an implementation, do you mind sharing with us more information about your problem?

  • Are you storing "high-frequency" data like samples from a digital health equipment?
  • Do you really need to have +700 fields per point per measurement (i.e. are you querying InfluxDB for SELECT value_129, value_234, /*...*/ value_639 FROM Measurement WHERE /*...*/)?
    • If you are not querying them this way, have you considered storing these 700 values serialized into a single field?

fmachado avatar Mar 04 '19 15:03 fmachado