You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2017/06/10 01:53:18 UTC

[jira] [Updated] (SPARK-21044) Add `RemoveInvalidRange` optimizer

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

Dongjoon Hyun updated SPARK-21044:
----------------------------------
    Description: 
This issue aims to add an optimizer remove invalid `Range` operator from the beginning. There are two cases of invalidity.

1. The `start` and `end` value are equal.
2. The sign of `step` does not match `start` and `end`. In this case, SPARK-21041 is reported as a bug, too.

{code}
scala> spark.range(0,0,1).explain
== Physical Plan ==
*Range (0, 0, step=1, splits=8)
{code}

{code}
  test("remove ranges with invalid combination of start/end/step") {
    Seq(Range(0, 0, 1, 1), Range(0, 0, -1, 1), Range(1, 10, -1, 1), Range(10, 1, 1, 1)).foreach {
      query =>
        val optimized = Optimize.execute(query.analyze)
        val correctAnswer = LocalRelation(query.output, data = Seq.empty)
        comparePlans(optimized, correctAnswer)
    }
  }
{code}

  was:
This issue aims to add an optimizer remove invalid `Range` operator from the beginning. There are two cases of invalidity.

1. The `start` and `end` value are equal.
2. The sign of `step` does not match `start` and `end`. In this case, SPARK-21041 is reported as a bug, too.

{code}
scala> spark.range(0,0,1).explain
== Physical Plan ==
*Range (0, 0, step=1, splits=8)
{code}


> Add `RemoveInvalidRange` optimizer
> ----------------------------------
>
>                 Key: SPARK-21044
>                 URL: https://issues.apache.org/jira/browse/SPARK-21044
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.2.0
>            Reporter: Dongjoon Hyun
>
> This issue aims to add an optimizer remove invalid `Range` operator from the beginning. There are two cases of invalidity.
> 1. The `start` and `end` value are equal.
> 2. The sign of `step` does not match `start` and `end`. In this case, SPARK-21041 is reported as a bug, too.
> {code}
> scala> spark.range(0,0,1).explain
> == Physical Plan ==
> *Range (0, 0, step=1, splits=8)
> {code}
> {code}
>   test("remove ranges with invalid combination of start/end/step") {
>     Seq(Range(0, 0, 1, 1), Range(0, 0, -1, 1), Range(1, 10, -1, 1), Range(10, 1, 1, 1)).foreach {
>       query =>
>         val optimized = Optimize.execute(query.analyze)
>         val correctAnswer = LocalRelation(query.output, data = Seq.empty)
>         comparePlans(optimized, correctAnswer)
>     }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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