Commit 0d32975
authored
### Rationale for this change
Currently, the `maps_as_pydicts` parameter to `MapScalar.as_py` does not work on nested maps. See below:
```
import pyarrow as pa
t = pa.struct([pa.field("x", pa.map_(pa.string(), pa.map_(pa.string(), pa.int8())))])
v = {"x": {"a": {"1": 1}}}
s = pa.scalar(v, type=t)
print(s.as_py(maps_as_pydicts="strict"))
# {'x': {'a': [('1', 1)]}}
```
In this ^ case, I'd want to get the value: `{'x': {'a': {'1': 1}}}`, such that round trips would work as expected.
### What changes are included in this PR?
Begin to apply the `maps_as_pydicts` to nested values in map types as well, update relevant test.
### Are these changes tested?
Yes
### Are there any user-facing changes?
Yes, just a user-facing fix.
* GitHub Issue: #47380
Lead-authored-by: Johanna <[email protected]>
Co-authored-by: zzkv <[email protected]>
Co-authored-by: Johanna <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
1 parent bc9746d commit 0d32975
2 files changed
+35
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
1176 | | - | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1177 | 1180 | | |
1178 | 1181 | | |
1179 | 1182 | | |
| |||
1183 | 1186 | | |
1184 | 1187 | | |
1185 | 1188 | | |
1186 | | - | |
| 1189 | + | |
1187 | 1190 | | |
1188 | 1191 | | |
1189 | 1192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
956 | 956 | | |
957 | 957 | | |
958 | 958 | | |
959 | | - | |
| 959 | + | |
960 | 960 | | |
961 | 961 | | |
962 | 962 | | |
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
0 commit comments