-
Notifications
You must be signed in to change notification settings - Fork 28.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-45667][CORE][SQL][CONNECT] Clean up the deprecated API usage r…
…elated to `IterableOnceExtensionMethods` ### What changes were proposed in this pull request? This PR cleans up the use of the following APIs in `IterableOnceExtensionMethods`, as they have been deprecated after Scala 2.13.0: - `.toSeq` -> `.iterator.to(Seq)` - `.toIterable` -> `.iterator.to(Iterable)` - `.toTraversable` -> `.iterator.to(Iterable)` - `.toArray` -> `.iterator.toArray` - `.map` -> `.iterator.map` - `.foreach` -> `.iterator.foreach` - `.isEmpty` -> `.iterator.isEmpty` ```scala deprecated("Use .iterator.to(Seq) instead", "2.13.0") `inline` def toSeq: immutable.Seq[A] = immutable.Seq.from(it) deprecated("Use .iterator.to(Iterable) instead", "2.13.0") `inline` final def toIterable: Iterable[A] = Iterable.from(it) deprecated("Use .iterator.to(Iterable) instead", "2.13.0") `inline` final def toTraversable: Traversable[A] = toIterable deprecated("Use .iterator.toArray", "2.13.0") def toArray[B >: A: ClassTag]: Array[B] = it match { case it: Iterable[B] => it.toArray[B] case _ => it.iterator.toArray[B] } deprecated("Use .iterator.map instead or consider requiring an Iterable", "2.13.0") def map[B](f: A => B): IterableOnce[B] = it match { case it: Iterable[A] => it.map(f) case _ => it.iterator.map(f) } deprecated("Use .iterator.foreach(...) instead", "2.13.0") `inline` def foreach[U](f: A => U): Unit = it match { case it: Iterable[A] => it.foreach(f) case _ => it.iterator.foreach(f) } deprecated("Use .iterator.isEmpty instead", "2.13.0") def isEmpty: Boolean = it match { case it: Iterable[A] => it.isEmpty case _ => it.iterator.isEmpty } ``` ### Why are the changes needed? Clean up deprecated API usage. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GitHub Acitons. ### Was this patch authored or co-authored using generative AI tooling? No Closes #43532 from LuciferYang/SPARK-45667. Authored-by: yangjie01 <yangjie01@baidu.com> Signed-off-by: yangjie01 <yangjie01@baidu.com>
- Loading branch information
1 parent
62a3868
commit 0f145f5
Showing
15 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters