Commit d6d81d5
committed
fix(timeseries): repair numeric aggregates and time_bucket() after nodedb-sql migration
Fixes #15.
The aggregate executor receives (op, field) pairs but all three
PhysicalTask construction sites were passing the alias instead of the
source field name, so the executor could never locate the column and
returned null for every MIN/MAX/SUM/AVG result.
parse_interval_to_ms only handled compact suffixes ("1h", "15m") and
rejected the word-form intervals that DataFusion normalises SQL INTERVAL
literals into ("1 hour", "15 minutes"), causing time_bucket() to bucket
everything into epoch-zero and return an empty result set.
Changes:
- sql_plan_convert: extract agg_expr_to_pair() helper that reads the
first argument expression (Column name or Wildcard) and use it at all
three PhysicalTask construction sites instead of a.alias
- aggregate: extend parse_interval_to_ms to accept singular and plural
word-form units (hour/hours, minute/minutes, second/seconds, day/days)
alongside the existing compact forms; bare numbers are treated as
seconds; unrecognised units return 0 instead of silently mis-routing
- aggregate: add unit tests covering word-form parsing1 parent 8588cf8 commit d6d81d5
2 files changed
Lines changed: 50 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
137 | 140 | | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
141 | 144 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
152 | 161 | | |
| 162 | + | |
153 | 163 | | |
154 | 164 | | |
155 | 165 | | |
| |||
260 | 270 | | |
261 | 271 | | |
262 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
263 | 280 | | |
264 | 281 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 252 | + | |
| 253 | + | |
256 | 254 | | |
257 | 255 | | |
258 | 256 | | |
| |||
667 | 665 | | |
668 | 666 | | |
669 | 667 | | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
| 668 | + | |
674 | 669 | | |
675 | 670 | | |
676 | 671 | | |
| |||
700 | 695 | | |
701 | 696 | | |
702 | 697 | | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
| 698 | + | |
707 | 699 | | |
708 | 700 | | |
709 | 701 | | |
| |||
734 | 726 | | |
735 | 727 | | |
736 | 728 | | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
737 | 747 | | |
738 | 748 | | |
739 | 749 | | |
| |||
0 commit comments