Repository navigation
Commit f61079f
fix: Fall back to the serialized body when UDF source misses globals (feast-dev#6816)
Source-first rehydration execs only the UDF's own source into a namespace
seeded with pandas/numpy. A UDF that reads a helper, constant, or aliased
import from its defining module has no way to resolve those names, but the
exec still succeeds, because a function body's free variables are only
looked up when it is called.
resolve_udf therefore treated rehydration as successful and never fell back
to the dill body, even when that body carried the captured globals and would
have run. The failure surfaced later as a NameError during retrieval, so an
on-demand feature view that served correctly before started raising once it
was loaded from the registry.
Validate the rebuilt callable before accepting it: walk its LOAD_GLOBAL
operands, and the operands of nested code objects, and return None when a
name resolves in neither the exec namespace nor builtins. resolve_udf then
falls back as it did before.
Only LOAD_GLOBAL is inspected. co_names also holds attribute names, so
checking it would flag working UDFs and push them onto the dill path for no
reason.
Self-contained UDFs are unaffected and still take the source path, keeping
the Spark and cross-Python-version benefits intact.
Signed-off-by: Daksha1611 <[email protected]>
Co-authored-by: Shuchu Han <[email protected]>1 parent f216396 commit f61079f
2 files changed
Lines changed: 127 additions & 3 deletions
File tree
- sdk/python
- feast/transformation
- tests/unit/transformation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | | - | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
122 | 165 | | |
123 | 166 | | |
124 | 167 | | |
| |||
141 | 184 | | |
142 | 185 | | |
143 | 186 | | |
144 | | - | |
| 187 | + | |
145 | 188 | | |
146 | 189 | | |
147 | 190 | | |
| |||
152 | 195 | | |
153 | 196 | | |
154 | 197 | | |
155 | | - | |
| 198 | + | |
156 | 199 | | |
157 | 200 | | |
158 | 201 | | |
159 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
160 | 221 | | |
161 | 222 | | |
162 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
0 commit comments