distributed-system-analysis / pbench

A benchmarking and performance analysis framework
http://distributed-system-analysis.github.io/pbench/
GNU General Public License v3.0
188 stars 108 forks source link

Implement typed sorting on dataset metadata #3576

Closed dbutenhof closed 1 year ago

dbutenhof commented 1 year ago

PBENCH-1297

GET /datasets supports sorting of the output, but SQL dislikes order by on a JSON field value. The solution is to cast the field .as_string(), but this PR goes a step further to allow sorting based on converting a field value to int, float, bool, or date as well as the default str: for example, GET /datasets?sort=dataset.metalog.run.start_time:desc:date will produce a list of datasets sorted in descending order by the recorded collection start timestamp in the Pbench Agent metadata.log file. (This works even if some datasets lack a dataset.metalog.run.start_time file: SQL will return null values at the beginning of the list.)