You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Bruce Robbins (Jira)" <ji...@apache.org> on 2022/03/18 20:35:00 UTC

[jira] [Updated] (SPARK-38308) Select of a stream of window expressions fails

     [ https://issues.apache.org/jira/browse/SPARK-38308?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bruce Robbins updated SPARK-38308:
----------------------------------
    Affects Version/s: 3.4.0

> Select of a stream of window expressions fails
> ----------------------------------------------
>
>                 Key: SPARK-38308
>                 URL: https://issues.apache.org/jira/browse/SPARK-38308
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.1.3, 3.2.1, 3.3.0, 3.4.0
>            Reporter: Bruce Robbins
>            Priority: Major
>
> The following query fails:
> {noformat}
> val df = spark.range(0, 20).map { x =>
>   (x % 4, x + 1, x + 2)
> }.toDF("a", "b", "c")
> import org.apache.spark.sql.expressions._
> val w = Window.partitionBy("a").orderBy("b")
> val selectExprs = Stream(
>   sum("c").over(w.rowsBetween(Window.unboundedPreceding, Window.currentRow)).as("sumc"),
>   avg("c").over(w.rowsBetween(Window.unboundedPreceding, Window.currentRow)).as("avgc")
> )
> df.select(selectExprs: _*).show(false)
> {noformat}
> It fails with the following error:
> {noformat}
> org.apache.spark.sql.AnalysisException: Resolved attribute(s) avgc#23 missing from c#16L,a#14L,b#15L,sumc#21L in operator !Project [c#16L, a#14L, b#15L, sumc#21L, sumc#21L, avgc#23].;
> {noformat}
> If you change the Stream of window expressions to a Vector or List, the query succeeds.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org