spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject spark git commit: [SPARK-18892][SQL] Alias percentile_approx approx_percentile
Date Fri, 16 Dec 2016 05:58:30 GMT
Repository: spark
Updated Branches:
  refs/heads/master 5a44f18a2 -> 172a52f5d


[SPARK-18892][SQL] Alias percentile_approx approx_percentile

## What changes were proposed in this pull request?
percentile_approx is the name used in Hive, and approx_percentile is the name used in Presto.
approx_percentile is actually more consistent with our approx_count_distinct. Given the cost
to alias SQL functions is low (one-liner), it'd be better to just alias them so it is easier
to use.

## How was this patch tested?
Technically I could add an end-to-end test to verify this one-line change, but it seemed too
trivial to me.

Author: Reynold Xin <rxin@databricks.com>

Closes #16300 from rxin/SPARK-18892.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/172a52f5
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/172a52f5
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/172a52f5

Branch: refs/heads/master
Commit: 172a52f5d31337d90155feb7072381e8d5712288
Parents: 5a44f18
Author: Reynold Xin <rxin@databricks.com>
Authored: Thu Dec 15 21:58:27 2016 -0800
Committer: Reynold Xin <rxin@databricks.com>
Committed: Thu Dec 15 21:58:27 2016 -0800

----------------------------------------------------------------------
 .../apache/spark/sql/catalyst/analysis/FunctionRegistry.scala    | 1 +
 .../catalyst/expressions/aggregate/ApproximatePercentile.scala   | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/172a52f5/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
index 5d065d7..2b214c3 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
@@ -252,6 +252,7 @@ object FunctionRegistry {
     expression[Percentile]("percentile"),
     expression[Skewness]("skewness"),
     expression[ApproximatePercentile]("percentile_approx"),
+    expression[ApproximatePercentile]("approx_percentile"),
     expression[StddevSamp]("std"),
     expression[StddevSamp]("stddev"),
     expression[StddevPop]("stddev_pop"),

http://git-wip-us.apache.org/repos/asf/spark/blob/172a52f5/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
index c2cd895..01792ae 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
@@ -61,9 +61,9 @@ import org.apache.spark.sql.types._
   """,
   extended = """
     Examples:
-      > SELECT percentile_approx(10.0, array(0.5, 0.4, 0.1), 100);
+      > SELECT _FUNC_(10.0, array(0.5, 0.4, 0.1), 100);
        [10.0,10.0,10.0]
-      > SELECT percentile_approx(10.0, 0.5, 100);
+      > SELECT _FUNC_(10.0, 0.5, 100);
        10.0
   """)
 case class ApproximatePercentile(


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


Mime
View raw message