[ 
https://issues.apache.org/jira/browse/SPARK-32821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17833662#comment-17833662
 ] 

Chloe He commented on SPARK-32821:
----------------------------------

Hi All -

I'm trying to do something similar here. I tried creating a watermark on the 
stream with the `withWatermark()` function, then creating a temp view over it. 
Then I call the `.sql()` function to execute my SQL query. However, this is 
throwing 

```

AnalysisException: Append output mode not supported when there are streaming 
aggregations on streaming DataFrames/DataSets without watermark

```

It seems that the watermark that I created on the stream was not recognized by 
the downstream processing. If instead of creating a temp view and calling the 
`.sql()` function I execute the query using Structured Streaming API instead, 
the query does work.

 

Does that mean there is currently no support for using raw SQL in conjunction 
with watermark?

> cannot group by with window in sql statement for structured streaming with 
> watermark
> ------------------------------------------------------------------------------------
>
>                 Key: SPARK-32821
>                 URL: https://issues.apache.org/jira/browse/SPARK-32821
>             Project: Spark
>          Issue Type: Improvement
>          Components: Structured Streaming
>    Affects Versions: 3.1.0
>            Reporter: Johnny Bai
>            Priority: Major
>         Attachments: the watermark grammer.md
>
>
> current only support dsl style as below: 
> {code}
> import spark.implicits._
> val words = ... // streaming DataFrame of schema { timestamp: Timestamp, 
> word: String }
> // Group the data by window and word and compute the count of each group
> val windowedCounts = words.groupBy(window($"timestamp", "10 minutes", "5 
> minutes"),$"word").count()
> {code}
>  
> but not support group by with window in sql style as below:
> {code}
> select ts_field,count(\*) as cnt over window(ts_field, '1 minute', '1 
> minute') with watermark 1 minute from tableX group by ts_field
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to