Commit e676fb0
feat(gfql): native polars UNWIND of a carried collect() list column (#1752)
* feat(gfql): native polars UNWIND of a carried collect() list column
Extend `unwind_polars` to explode a List-dtype column reference (a `collect()`
output / carried binding), not just a scalar-literal list. This is the row-
pipeline analogue of the IC6 `WITH collect(x) AS xs UNWIND xs AS y` shape:
previously the second UNWIND declined (NIE) because the expr was an Identifier,
not a ListLiteral, forcing engine='pandas'.
Mirrors the pandas oracle (`RowPipelineMixin.unwind` list-column branch)
exactly: empty-list and null cells contribute 0 rows; nulls WITHIN a list
survive as real elements; the source column is retained and exploded values
append as `as_`. Implemented as with_columns(copy) -> filter(list.len() > 0)
-> explode, which also makes the result independent of the polars 2.0
`empty_as_null` default. Non-list columns, name collisions, unknown
identifiers, and nested-list literals still decline (NIE) — no pandas bridge,
no silent-wrong.
NOTE (out of scope): the collect->UNWIND->MATCH re-entry form (IC6 with a
trailing MATCH) is compile-time rewritten to whole-row MATCH-after-WITH
re-entry; polars declines there because the whole-entity projection does not
attach `_cypher_entity_projection_meta` and `binding_rows_polars` declines on
`_gfql_start_nodes`. That is the separate WITH-MATCH re-entry residual, not a
row-pipeline unwind gap.
Correctness gate: differential fuzz vs pandas (2000 queries, 0 disagreements)
plus parity/pin/decline tests. ruff clean; no new mypy errors; new lines
fully covered.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6dQEcjdazEnzuvuwf73ZL
* docs(gfql): CHANGELOG entry for native polars collect()->UNWIND
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6dQEcjdazEnzuvuwf73ZL
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 60ecaea commit e676fb0
3 files changed
Lines changed: 129 additions & 9 deletions
File tree
- graphistry
- compute/gfql/lazy/engine/polars
- tests/compute/gfql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
Lines changed: 34 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
834 | | - | |
835 | | - | |
836 | | - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
837 | 847 | | |
838 | | - | |
| 848 | + | |
839 | 849 | | |
840 | 850 | | |
841 | 851 | | |
| |||
846 | 856 | | |
847 | 857 | | |
848 | 858 | | |
849 | | - | |
850 | | - | |
851 | 859 | | |
852 | 860 | | |
853 | 861 | | |
854 | | - | |
855 | | - | |
856 | | - | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
857 | 882 | | |
858 | 883 | | |
859 | 884 | | |
| |||
Lines changed: 94 additions & 0 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 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
142 | 236 | | |
143 | 237 | | |
144 | 238 | | |
| |||
0 commit comments