spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marmb...@apache.org
Subject spark git commit: [SPARK-4829] [SQL] add rule to fold count(expr) if expr is not null
Date Fri, 12 Dec 2014 06:56:57 GMT
Repository: spark
Updated Branches:
  refs/heads/master 8091dd62e -> 41a3f9343


[SPARK-4829] [SQL] add rule to fold count(expr) if expr is not null

Author: Daoyuan Wang <daoyuan.wang@intel.com>

Closes #3676 from adrian-wang/countexpr and squashes the following commits:

dc5765b [Daoyuan Wang] add rule to fold count(expr) if expr is not null


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

Branch: refs/heads/master
Commit: 41a3f9343831a3efc18e08595d095282a8d1486b
Parents: 8091dd6
Author: Daoyuan Wang <daoyuan.wang@intel.com>
Authored: Thu Dec 11 22:56:42 2014 -0800
Committer: Michael Armbrust <michael@databricks.com>
Committed: Thu Dec 11 22:56:42 2014 -0800

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/41a3f934/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
----------------------------------------------------------------------
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
index c492348..806c139 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
@@ -210,6 +210,7 @@ object NullPropagation extends Rule[LogicalPlan] {
       case e @ GetField(Literal(null, _), _) => Literal(null, e.dataType)
       case e @ EqualNullSafe(Literal(null, _), r) => IsNull(r)
       case e @ EqualNullSafe(l, Literal(null, _)) => IsNull(l)
+      case e @ Count(expr) if !expr.nullable => Count(Literal(1))
 
       // For Coalesce, remove null literals.
       case e @ Coalesce(children) =>


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


Mime
View raw message