Skip to content

Commit aec1d95

Browse files
tirkarthidongjoon-hyun
authored andcommitted
[SPARK-30205][PYSPARK] Import ABCs from collections.abc to remove deprecation warnings
### What changes were proposed in this pull request? This PR aims to remove deprecation warnings by importing ABCs from `collections.abc` instead of `collections`. - python/cpython#10596 ### Why are the changes needed? This will remove deprecation warnings in Python 3.7 and 3.8. ``` $ python -V Python 3.7.5 $ python python/pyspark/resultiterable.py python/pyspark/resultiterable.py:23: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working class ResultIterable(collections.Iterable): ``` ### Does this PR introduce any user-facing change? No, this doesn't introduce user-facing change ### How was this patch tested? Manually because this is about deprecation warning messages. Closes #26835 from tirkarthi/spark-30205-fix-abc-warnings. Authored-by: Karthikeyan Singaravelan <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 8f0eb7d commit aec1d95

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

python/pyspark/resultiterable.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
# limitations under the License.
1616
#
1717

18-
import collections
18+
try:
19+
from collections.abc import Iterable
20+
except ImportError:
21+
from collections import Iterable
22+
1923

2024
__all__ = ["ResultIterable"]
2125

2226

23-
class ResultIterable(collections.Iterable):
27+
class ResultIterable(Iterable):
2428

2529
"""
2630
A special result iterable. This is used because the standard

0 commit comments

Comments
 (0)