yaooqinn commented on issue #26905: [SPARK-30266][SQL] Avoid overflow and match 
error in ApproximatePercentile
URL: https://github.com/apache/spark/pull/26905#issuecomment-566054534
 
 
   ```
   [info] - summary *** FAILED *** (18 milliseconds)
   [info]   org.apache.spark.sql.AnalysisException: cannot resolve 
'percentile_approx(`name`, [0.25,0.5,0.75], 10000)' due to data type mismatch: 
argument 1 requires (numeric or date or timestamp) type, however, '`name`' is 
of string type.;;
   [info] 'Aggregate [cast(count(name#1452) as string) AS name#1911, 
cast(count(age#1453) as string) AS age#1913, cast(count(height#1454) as string) 
AS height#1915, cast(avg(cast(name#1452 as double)) as string) AS name#1917, 
cast(avg(cast(age#1453 as bigint)) as string) AS age#1919, 
cast(avg(cast(height#1454 as bigint)) as string) AS height#1921, 
cast(stddev_samp(cast(name#1452 as double)) as string) AS name#1931, 
cast(stddev_samp(cast(age#1453 as double)) as string) AS age#1941, 
cast(stddev_samp(cast(height#1454 as double)) as string) AS height#1951, 
cast(min(name#1452) as string) AS name#1953, cast(min(age#1453) as string) AS 
age#1955, cast(min(height#1454) as string) AS height#1957, 
cast(percentile_approx(name#1452, [0.25,0.5,0.75], 10000, 0, 0)[0] as string) 
AS name#1959, cast(percentile_approx(age#1453, [0.25,0.5,0.75], 10000, 0, 0)[0] 
as string) AS age#1961, cast(percentile_approx(height#1454, [0.25,0.5,0.75], 
10000, 0, 0)[0] as string) AS height#1963, cast(percentile_approx(name#1452, 
[0.25,0.5,0.75], 10000, 0, 0)[1] as string) AS name#1965, 
cast(percentile_approx(age#1453, [0.25,0.5,0.75], 10000, 0, 0)[1] as string) AS 
age#1967, cast(percentile_approx(height#1454, [0.25,0.5,0.75], 10000, 0, 0)[1] 
as string) AS height#1969, cast(percentile_approx(name#1452, [0.25,0.5,0.75], 
10000, 0, 0)[2] as string) AS name#1971, cast(percentile_approx(age#1453, 
[0.25,0.5,0.75], 10000, 0, 0)[2] as string) AS age#1973, 
cast(percentile_approx(height#1454, [0.25,0.5,0.75], 10000, 0, 0)[2] as string) 
AS height#1975, cast(max(name#1452) as string) AS name#1977, cast(max(age#1453) 
as string) AS age#1979, cast(max(height#1454) as string) AS height#1981]
   ```
   
   This ut fails indicates the miss usage of approximate percentile function 
for string values, the string will be cast to double before

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to