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.)
PBENCH-1297
GET /datasets
supports sorting of the output, but SQL dislikesorder 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 toint
,float
,bool
, ordate
as well as the defaultstr
: 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 Agentmetadata.log
file. (This works even if some datasets lack adataset.metalog.run.start_time
file: SQL will returnnull
values at the beginning of the list.)