Eric Yang created SPARK-58164:
---------------------------------

             Summary: approx_top_k_estimate and approx_top_k_combine fail on 
sketches whose item type was widened by type coercion
                 Key: SPARK-58164
                 URL: https://issues.apache.org/jira/browse/SPARK-58164
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Eric Yang


 A query that combines/estimates `approx_top_k` sketches whose item type is 
widened by type coercion (e.g. a `UNION ALL` of an INT and a BIGINT sketch 
column) fails at runtime.
{code:java}
 SELECT approx_top_k_estimate(approx_top_k_combine(sketch, 5))
 FROM (SELECT approx_top_k_accumulate(c) AS sketch, 'int' AS tag
         FROM VALUES (1), (1), (2) AS t(c)
       UNION ALL
       SELECT approx_top_k_accumulate(c) AS sketch, 'long' AS tag
         FROM VALUES (CAST(9 AS BIGINT)) AS t(c))
 WHERE tag = 'int';
– org.apache.datasketches.common.SketchesArgumentException:
--   Bounds Violation: reqOffset: 0, reqLength: 16, (reqOff + reqLen): 16, 
allocSize: 10 {code}
 



--
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