mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-04 00:15:29 +00:00
`FusedSeriesStream` asked the evaluator for a series and got one only when the input series ended, so a long series held every row until its last raw chunk and then arrived as a single batch. The evaluator now hands out each part of a series as soon as it decides it, so the stream can forward it. The consequence is that trimming moves here. A chunk's span now reports the positions the evaluator decided rather than the positions holding a value, so trailing and leading positions decided to be missing are inside it: `trim_to_values` cuts a chunk back to its first and last row holding a value before the batch is built, and a chunk that decided nothing but missing positions produces no batch. That is the same trim the evaluator's builder used to do while it was also the one deciding what a series reported. `map_math` now returns `Option`, because it drops the metadata labels and skips histogram points, so a chain can end with no value at all; `apply_maps` stops at that point instead of failing. This is not only a convenience: a series whose evaluated points are all historic histograms would otherwise reach the output conversion, which rejects histograms outright, and fail the query. Dropping it in the map chain is what lets `sum_over_time` of such a series return nothing rather than an error, matching Prometheus. A trimmed chunk is rebuilt against the evaluated schema (`evaluator.output_schema()`), not the raw input schema, which has no grid and is rejected by `Series::try_new`. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> (cherry picked from commit f787b055f12fbd44bbeb8c4638d7ad10b99a7bb0) (cherry picked from commit ce0cfecb5fecd53d848cbb9ec54e5e1cf7b688e1)