You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/01 23:36:16 UTC
[GitHub] [spark] bersprockets commented on a change in pull request #35635: [SPARK-38308][SQL] Eagerly iterate over sequence of window expressions in `ExtractWindowExpressions`
bersprockets commented on a change in pull request #35635:
URL: https://github.com/apache/spark/pull/35635#discussion_r840971543
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -3141,7 +3141,7 @@ class Analyzer(override val catalogManager: CatalogManager)
// have been resolved.
case p @ Project(projectList, child)
if hasWindowFunction(projectList) && !p.expressions.exists(!_.resolved) =>
- val (windowExpressions, regularExpressions) = extract(projectList)
+ val (windowExpressions, regularExpressions) = extract(projectList.toIndexedSeq)
Review comment:
>shall we simply fix all the public APIs that take Seq, to always call toIndexedSeq
I thought about that, and I think we should do that as well.
Although right now, AFAIK, the only way to pass lazy data structures to these loops is through the public API, there are other paths to this code (e.g., the parser) and some future innocuous-seeming change might end up passing streams to these loops. For example, somebody might add code that uses `Javaconverters`:
```
scala> jal
res7: java.util.ArrayList[Integer] = [2]
scala> jal.iterator.asScala.toSeq
res8: Seq[Integer] = Stream(2, ?)
scala>
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org