physinet opened a new pull request, #36545:
URL: https://github.com/apache/spark/pull/36545
### What changes were proposed in this pull request?
This PR modifies type inference for python lists to consider all values in
the list, not just the first value.
### Why are the changes needed?
This enables convenient type inference in the two following cases:
| | previous | current |
| --- | --- | --- |
| `[None, 1]` | `array<void>` (raises `ValueError`) | `array<bigint>` |
| `[{"b": 1}, {"c": 2}]` | `array<struct<b:bigint>>` |
`array<struct<b:bigint,c:bigint>>`
### Does this PR introduce _any_ user-facing change?
Possible user-facing changes:
* attempting to infer the schema of an array with mixed types (e.g. `["a",
1]`) may result in a TypeError
* previously, this was inferred as an `array<string>` and produced a
value `["a", "1"]`
* fields of inferred struct types will differ if dictionaries in an array
have different keys
### How was this patch tested?
Added unit tests for various cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]