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

Eric Yang commented on SPARK-58095:
-----------------------------------

I'm working on a PR to fix it

> approx_top_k_combine fails the query with an internal error (MatchError) on 
> empty input
> ---------------------------------------------------------------------------------------
>
>                 Key: SPARK-58095
>                 URL: https://issues.apache.org/jira/browse/SPARK-58095
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 5.0.0
>            Reporter: Eric Yang
>            Priority: Major
>
> When `approx_top_k_combine` aggregates over zero input rows -- an empty 
> input, or one fully removed by a filter -- the whole query fails with an 
> internal error (scala.MatchError: null) instead of returning an empty result. 
> This surfaces to the user as a SparkException / aborted job.
> *Repro*:
> {code:sql}
> SELECT approx_top_k_combine(sketch, 5)
> FROM (SELECT approx_top_k_accumulate(expr) AS sketch FROM VALUES (1), (2) AS 
> t(expr))
> WHERE false;
> -- org.apache.spark.SparkException: Job aborted due to stage failure:
> --   ... scala.MatchError: null
> {code}
> The other approx_top_k functions (approx_top_k, approx_top_k_accumulate, 
> approx_top_k_estimate) are not affected -- only approx_top_k_combine. 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to