[ 
https://issues.apache.org/jira/browse/SPARK-12536?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xiao Li updated SPARK-12536:
----------------------------
    Description: 
The filter Filter (False) generates an empty LocalRelation in SimplifyFilters. 
In the current Explain, the optimized and physical plans look confusing.

For example, 
{code}
val df = Seq(1 -> "a").toDF("a", "b")
df.where("1 = 0").explain(true)
{code}
{code}
== Parsed Logical Plan ==
Filter (1 = 0)
+- Project [_1#0 AS a#2,_2#1 AS b#3]
   +- LocalRelation [_1#0,_2#1], [[1,a]]

== Analyzed Logical Plan ==
a: int, b: string
Filter (1 = 0)
+- Project [_1#0 AS a#2,_2#1 AS b#3]
   +- LocalRelation [_1#0,_2#1], [[1,a]]

== Optimized Logical Plan ==
LocalRelation [a#2,b#3] 

== Physical Plan ==
LocalTableScan [a#2,b#3] 
{code}


  was:
{code}
val df = Seq(1 -> "a").toDF("a", "b")
df.where("1 = 0").explain(true)
{code}

The filter Filter (1 = 0) generates an empty `LocalRelation`. In the current 
explain, the optimized and physical plans look wrong because Filter (1 = 0) is 
removed by the optimizer.

{code}
== Parsed Logical Plan ==
Filter (1 = 0)
+- Project [_1#0 AS a#2,_2#1 AS b#3]
   +- LocalRelation [_1#0,_2#1], [[1,a]]

== Analyzed Logical Plan ==
a: int, b: string
Filter (1 = 0)
+- Project [_1#0 AS a#2,_2#1 AS b#3]
   +- LocalRelation [_1#0,_2#1], [[1,a]]

== Optimized Logical Plan ==
LocalRelation [a#2,b#3] 

== Physical Plan ==
LocalTableScan [a#2,b#3] 
{code}



> Fix the Explain Outputs of Empty LocalRelation and LocalTableScan
> -----------------------------------------------------------------
>
>                 Key: SPARK-12536
>                 URL: https://issues.apache.org/jira/browse/SPARK-12536
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.6.0
>            Reporter: Xiao Li
>
> The filter Filter (False) generates an empty LocalRelation in 
> SimplifyFilters. In the current Explain, the optimized and physical plans 
> look confusing.
> For example, 
> {code}
> val df = Seq(1 -> "a").toDF("a", "b")
> df.where("1 = 0").explain(true)
> {code}
> {code}
> == Parsed Logical Plan ==
> Filter (1 = 0)
> +- Project [_1#0 AS a#2,_2#1 AS b#3]
>    +- LocalRelation [_1#0,_2#1], [[1,a]]
> == Analyzed Logical Plan ==
> a: int, b: string
> Filter (1 = 0)
> +- Project [_1#0 AS a#2,_2#1 AS b#3]
>    +- LocalRelation [_1#0,_2#1], [[1,a]]
> == Optimized Logical Plan ==
> LocalRelation [a#2,b#3] 
> == Physical Plan ==
> LocalTableScan [a#2,b#3] 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to