I am sure this is something very simple, but I did not find anything related to this.
My code is simple:
...
stream = stream.map(mapper)
stream = stream.reduceByKey(reducer)
...
Nothing unusual. The output looks like this:
...
key1 value1
key2 [value2, value3]
key3 [[value4, value5], value6]
...
Etc. So sometimes I get a fixed value (if it is single). Sometimes there are nested lists that can be very, very deep (according to my simple test data it was 3 levels).
I tried to search for something like "flat" in the sources - but I only found the flatMap method, which (as I understand it) is not what I need.
I do not know why these lists are nested. I assume that they were processed by various processes (workers?), And then combined without alignment.
, Python, . , - , .
itertools.chain . , ( ).
, , PySpark?