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

Parse the results of buckets() #123

Closed
ryantxu opened this issue May 13, 2020 · 5 comments
Closed

Parse the results of buckets() #123

ryantxu opened this issue May 13, 2020 · 5 comments

Comments

@ryantxu
Copy link

ryantxu commented May 13, 2020

When trying to parse the output of the query buckets() I get a failure on:
image

Here is the csv:

#group,false,false,false,false,true,false,false
#datatype,string,long,string,string,string,string,long
#default,_result,,,,,,
,result,table,name,id,organizationID,retentionPolicy,retentionPeriod
,,0,grafana,059b46a59abab001,059b46a59abab000,,604800000000000
,,0,_tasks,059b46a59abab002,059b46a59abab000,,259200000000000
,,0,_monitoring,059b46a59abab003,059b46a59abab000,,604800000000000

@ryantxu
Copy link
Author

ryantxu commented May 13, 2020

ahh. Seems the header order is out of sync.... if I make the headers: datatype,group,default it works

#datatype,string,long,string,string,string,string,long
#group,false,false,false,false,true,false,false
#default,_result,,,,,,

Unclear where/how this should be fixed... either:

  • server sends them in the same order
  • client accepts them in either order

@vlastahajek
Copy link
Contributor

vlastahajek commented May 14, 2020

It was once discussed in #110. Yes, the QueryTableResult parser expects the #datatype annotation as the first row and the Query method takes care of this.
How do you get the csv?

@jsternberg
Copy link
Contributor

The flux CSV is meant to be parsed with the annotations in any order and we won't guarantee the order so the parser should be capable of parsing them in any order.

For helping with this specific issue right now, the annotations that are in the CSV will be returned in the same order as the entries in dialect. This seems to be constructed correctly for DefaultDialect where the annotations are specified in the specific order that works with the client. As a temporary solution, you might be able to change your client to request the annotations in the same order.

@ryantxu
Copy link
Author

ryantxu commented May 14, 2020

After digging a bit more, we are not hitting this problem with a real environment -- just when saving files and loading them for tests. In this case, we can manually reorder the headers and get the results needed

@vlastahajek
Copy link
Contributor

Just to let you know, that custom order of annotations is now supported since #134. Only the datatype annotation is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants