You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Bhuwan Sahni (Jira)" <ji...@apache.org> on 2023/10/24 20:49:00 UTC

[jira] [Commented] (SPARK-45655) current_date() not supported in Streaming Query Observed metrics

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

Bhuwan Sahni commented on SPARK-45655:
--------------------------------------

I am working on a fix for this issue, and will submit a PR soon.

> current_date() not supported in Streaming Query Observed metrics
> ----------------------------------------------------------------
>
>                 Key: SPARK-45655
>                 URL: https://issues.apache.org/jira/browse/SPARK-45655
>             Project: Spark
>          Issue Type: Bug
>          Components: Structured Streaming
>    Affects Versions: 3.4.1, 3.5.0
>            Reporter: Bhuwan Sahni
>            Priority: Major
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Streaming queries do not support current_date() inside CollectMetrics. The primary reason is that current_date() (resolves to CurrentBatchTimestamp) is marked as non-deterministic. However, {{current_date}} and {{current_timestamp}} are both deterministic today, and {{current_batch_timestamp}} should be the same.
>  
> As an example, the query below fails due to observe call on the DataFrame.
>  
> {quote}val inputData = MemoryStream[Timestamp]
> inputData.toDF()
>       .filter("value < current_date()")
>       .observe("metrics", count(expr("value >= current_date()")).alias("dropped"))
>       .writeStream
>       .queryName("ts_metrics_test")
>       .format("memory")
>       .outputMode("append")
>       .start()
> {quote}
>  



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

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