You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have a question / problem related with sorting. Which is weird.
I will do my best to explain the issue.
I have a data written to influx. For simlicity, let's say that my data is:
username: field
name: field
surname: field
time
There are also tags of course but not relevant with my problem.
My query is as below:
from(bucket: "x-bucket") |> range(start:1702281528, stop:1703224380 )
|> filter(fn: (r) => r._measurement == "x" )
|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
|> group()
|> sort(columns: ["_time"], desc:true) // This is for secondary sorting
|> sort(columns: ["name"], desc:true) // this is for primary sorting
|> limit(n:100, offset: 0)
|> yield(name: "x")
I first sort data according to either "name" or "username" or "surname" THEN sort according to time within these sorted data.
I have a "not_found" value for username, name and surname, when a case appears in the app, written to db.
So typically, when I sort acc.to username (primary sort is username) then the result is as follow
time name surname username
18.12. tarik arabaci tarabaci
17.12 tarik arabaci tarabaci
16.12 not_found not_found not_found
15.12 not_found not_found not_found
14.12 murat dursun mdursun
13.12 leyla arici larici
which is correct, or at least what I expected...
BUT, if I sort according to name or surname as a primary sorting item THEN the result is as follows.
time name surname usernam
16.12 not_found not_found not_found
15.12 not_found not_found not_found
18.12. tarik arabaci tarabaci
17.12 tarik arabaci tarabaci
14.12 murat dursun mdursun
13.12 leyla arici larici
See that, not_found is displayed at the top, which is wrong... But other data is sorted as it should be.
Therefore, if primary is username, all is ok but if it is name or surname, there is an error...
I think, my query might be somehow wrong, or at least not giving the expected result at all conditions... Because, on the influx Data Explorer, if I click the header of the table to sort it (not with query), the sorting is done correctly...
Therefore, does anyone have an idea what I am doing wrong?
Thanks,
alptekin
P.S.
I am using 2 lines for sorting and not as |>sort(columns:["primarySortItem", "secondarySortItem"], desc: true) because, in future I might sort primary and secondary items different in terms of desc key. like, primary is sorted with desc: true and secondary is sorted with desc: false...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I have a question / problem related with sorting. Which is weird.
I will do my best to explain the issue.
I have a data written to influx. For simlicity, let's say that my data is:
username: field
name: field
surname: field
time
There are also tags of course but not relevant with my problem.
My query is as below:
from(bucket: "x-bucket") |> range(start:1702281528, stop:1703224380 )
|> filter(fn: (r) => r._measurement == "x" )
|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")
|> group()
|> sort(columns: ["_time"], desc:true) // This is for secondary sorting
|> sort(columns: ["name"], desc:true) // this is for primary sorting
|> limit(n:100, offset: 0)
|> yield(name: "x")
I first sort data according to either "name" or "username" or "surname" THEN sort according to time within these sorted data.
I have a "not_found" value for username, name and surname, when a case appears in the app, written to db.
So typically, when I sort acc.to username (primary sort is username) then the result is as follow
time name surname username
18.12. tarik arabaci tarabaci
17.12 tarik arabaci tarabaci
16.12 not_found not_found not_found
15.12 not_found not_found not_found
14.12 murat dursun mdursun
13.12 leyla arici larici
which is correct, or at least what I expected...
BUT, if I sort according to name or surname as a primary sorting item THEN the result is as follows.
time name surname usernam
16.12 not_found not_found not_found
15.12 not_found not_found not_found
18.12. tarik arabaci tarabaci
17.12 tarik arabaci tarabaci
14.12 murat dursun mdursun
13.12 leyla arici larici
See that, not_found is displayed at the top, which is wrong... But other data is sorted as it should be.
Therefore, if primary is username, all is ok but if it is name or surname, there is an error...
I think, my query might be somehow wrong, or at least not giving the expected result at all conditions... Because, on the influx Data Explorer, if I click the header of the table to sort it (not with query), the sorting is done correctly...
Therefore, does anyone have an idea what I am doing wrong?
Thanks,
alptekin
P.S.
I am using 2 lines for sorting and not as |>sort(columns:["primarySortItem", "secondarySortItem"], desc: true) because, in future I might sort primary and secondary items different in terms of desc key. like, primary is sorted with desc: true and secondary is sorted with desc: false...
Beta Was this translation helpful? Give feedback.
All reactions