jerryshao opened a new pull request, #12522:
URL: https://github.com/apache/gravitino/pull/12522

   ### What changes were proposed in this pull request?
   
   Add `queuedAfter`/`startedAfter`/`finishedAfter`/`sortBy`/`sortOrder` query 
parameters to the list jobs REST API (`GET /metalakes/{metalake}/jobs/runs`):
   
   - `queuedAfter`/`startedAfter`/`finishedAfter` — ISO-8601 instant strings, 
inclusive lower bounds, AND-combined; a job missing the relevant timestamp is 
excluded by that filter.
   - `sortBy` (`queuedAt`|`startedAt`|`finishedAt`, default `queuedAt`) / 
`sortOrder` (`asc`|`desc`, default `desc`) — jobs missing the sort field always 
sort last, regardless of direction.
   - Implemented entirely in `JobOperations` (server REST layer): 
filtering/sorting applied in-memory after the existing 
`jobOperationDispatcher.listJobs(...)` fetch and authorization filter — no 
dispatcher/manager/storage/SQL changes.
   - All query params are validated up front, before the dispatcher fetch, so 
invalid input fails fast with 400; `sortBy`/`sortOrder` are matched exactly 
against the OpenAPI-documented casing.
   - OpenAPI spec (`docs/open-api/jobs.yaml`) updated with the five new 
parameters.
   
   ### Why are the changes needed?
   
   Callers currently have to fetch the entire job list and filter/sort 
client-side to answer time-scoped questions like "what ran in the last 24 
hours," which doesn't scale as job history grows.
   
   Fix: #12521
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes: new `queuedAfter`/`startedAfter`/`finishedAfter`/`sortBy`/`sortOrder` 
query parameters on the `GET /metalakes/{metalake}/jobs/runs` REST endpoint. No 
changes to existing fields or client APIs.
   
   ### How was this patch tested?
   
   Unit tests in `TestJobOperations` covering: each filter individually and 
AND-combined, inclusive boundary matching, sort by each field in both 
directions with null-handling (unset timestamps sort last), 
`sortBy`/`sortOrder` validation (invalid values, wrong casing), invalid 
ISO-8601 timestamps, and `jobTemplateName` combined with time filters/sort 
together.
   
   *Note: this branch is stacked on `feat/job-queued-started-at` (#12509), 
which is still open — the diff below will include those commits until #12509 
merges into main.*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to