support legendFormat and show "No data" on empty results - #123
Merged
JackieTien97 merged 1 commit intoAug 14, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR improves Grafana table-model queries by supporting custom legend formats and returning Grafana's native No data state when a time-series result contains no plottable values.
Support Grafana legendFormat
Resolving legends in the backend keeps imported Prometheus dashboards compatible and avoids requiring panel-specific field overrides.
Show No data for empty time-series results
Some IoTDB HOP and rate queries return timestamped rows whose numeric values are all NULL, instead of returning zero rows. Grafana previously received a non-empty frame for these results and rendered empty axes rather than its No data state.
This PR treats a result as having no plottable data when:
In these cases, the backend returns no frame, allowing Grafana to display No data.
The behavior applies to any non-Table format — the empty or legacy format defaults to the time-series treatment, so queries saved before FORMAT existed are covered too. The Table format still returns a frame so that column headers and NULL rows remain available to table panels. This logic is implemented in the plugin instead of adding query-specific SQL filters, so it also applies to future sparse aggregation queries.
Testability and coverage
The table query execution path is separated from response construction through executeTableQuery. Tests can replace the query runner with an in-memory result, allowing response semantics to be tested without a live IoTDB RPC service.
Added coverage includes:
Key changed/added classes (or packages if there are too many classes) in this PR