You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Zhenhua Wang (JIRA)" <ji...@apache.org> on 2016/10/26 06:58:58 UTC
[jira] [Updated] (SPARK-18111) Wrong ApproximatePercentile answer
when multiple records have the minimum value
[ https://issues.apache.org/jira/browse/SPARK-18111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zhenhua Wang updated SPARK-18111:
---------------------------------
Description:
When multiple records have the minimum value, the answer of ApproximatePercentile is wrong.
For example, the following query returns 2.0 for percentile 0.5, but the correct answer should be 1.0
0: jdbc:hive2://localhost:10000> select key from src2;
+------+--+
| key |
+------+--+
| 1 |
| 1 |
| 2 |
| 2 |
+------+--+
4 rows selected (0.185 seconds)
0: jdbc:hive2://localhost:10000> select percentile_approx(key, array(0.5)) from src2;
+------------------------------------------------------------+--+
| percentile_approx(CAST(key AS DOUBLE), array(0.5), 10000) |
+------------------------------------------------------------+--+
| [2.0] |
+------------------------------------------------------------+--+
1 row selected (0.292 seconds)
was:
When multiple records have the minimum value, the answer of ApproximatePercentile is wrong. e.g:
0: jdbc:hive2://localhost:10000> select key from src2;
+------+--+
| key |
+------+--+
| 1 |
| 1 |
| 2 |
| 2 |
+------+--+
4 rows selected (0.185 seconds)
0: jdbc:hive2://localhost:10000> select percentile_approx(key, array(0.5)) from src2;
+------------------------------------------------------------+--+
| percentile_approx(CAST(key AS DOUBLE), array(0.5), 10000) |
+------------------------------------------------------------+--+
| [2.0] |
+------------------------------------------------------------+--+
1 row selected (0.292 seconds)
> Wrong ApproximatePercentile answer when multiple records have the minimum value
> -------------------------------------------------------------------------------
>
> Key: SPARK-18111
> URL: https://issues.apache.org/jira/browse/SPARK-18111
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.1
> Reporter: Zhenhua Wang
>
> When multiple records have the minimum value, the answer of ApproximatePercentile is wrong.
> For example, the following query returns 2.0 for percentile 0.5, but the correct answer should be 1.0
> 0: jdbc:hive2://localhost:10000> select key from src2;
> +------+--+
> | key |
> +------+--+
> | 1 |
> | 1 |
> | 2 |
> | 2 |
> +------+--+
> 4 rows selected (0.185 seconds)
> 0: jdbc:hive2://localhost:10000> select percentile_approx(key, array(0.5)) from src2;
> +------------------------------------------------------------+--+
> | percentile_approx(CAST(key AS DOUBLE), array(0.5), 10000) |
> +------------------------------------------------------------+--+
> | [2.0] |
> +------------------------------------------------------------+--+
> 1 row selected (0.292 seconds)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org