Commit c294260
committed
fix: infer surviving dims in to_dataset for aggregations (closes #189)
to_dataset() inferred dims only when a registered Dataset's entire dim set
appeared in the result, so a GROUP BY that aggregates dims away (e.g.
SELECT "time", AVG("air") ... GROUP BY "time" over a time/lat/lon grid)
raised "dims cannot be inferred" instead of using the surviving group-by dim.
_infer_dimension_columns now uses the registered dims that survive into the
result columns, in the data-variable axis order, so such aggregations
round-trip on the remaining dim(s). Several registered Datasets that imply
different surviving dims still raise; a global aggregation with no surviving
dim raises a clearer message.
Repurposes the now-inferable test to a global-aggregation case and adds an
auto-inference regression test.1 parent d8ffa52 commit c294260
2 files changed
Lines changed: 65 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
142 | 178 | | |
143 | 179 | | |
144 | 180 | | |
| |||
383 | 419 | | |
384 | 420 | | |
385 | 421 | | |
386 | | - | |
387 | | - | |
| 422 | + | |
| 423 | + | |
388 | 424 | | |
389 | 425 | | |
390 | 426 | | |
391 | | - | |
392 | | - | |
393 | | - | |
| 427 | + | |
394 | 428 | | |
395 | 429 | | |
396 | 430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
757 | 757 | | |
758 | 758 | | |
759 | 759 | | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
764 | 766 | | |
765 | 767 | | |
766 | 768 | | |
| |||
879 | 881 | | |
880 | 882 | | |
881 | 883 | | |
882 | | - | |
883 | | - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
884 | 889 | | |
885 | 890 | | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
891 | 900 | | |
892 | 901 | | |
893 | 902 | | |
894 | 903 | | |
895 | 904 | | |
896 | 905 | | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
| 906 | + | |
| 907 | + | |
902 | 908 | | |
903 | | - | |
| 909 | + | |
904 | 910 | | |
905 | 911 | | |
906 | | - | |
907 | | - | |
908 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
909 | 915 | | |
910 | 916 | | |
911 | 917 | | |
| |||
0 commit comments