You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by viirya <gi...@git.apache.org> on 2016/05/06 14:32:27 UTC

[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

GitHub user viirya opened a pull request:

    https://github.com/apache/spark/pull/12956

    [SPARK-15180][SQL] Support subexpression elimination in Fliter

    ## What changes were proposed in this pull request?
    
    This patch tries to add the support of subexpression elimination in wholestage codegen `Fliter`.
    
    Because the predicate expressions are evaluated in `Filter` with an optimized ordering that reduces unnecessary evaluation as much as possible, we follow this ordering when doing subexpression elimination too.
    
    Due to that, we can't just extract all common subexpressions and evaluate them first. Instead, we extract common subexpressions but don't evaluate them. We evaluate common subexpressions only when the predicate expressions containing them are evaluated.
    
    ## How was this patch tested?
    
    Existing tests.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/viirya/spark-1 subexpr-filter

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/12956.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12956
    
----
commit 55e43ef9f25c68d0c3773f36156b34d42a9baedc
Author: Liang-Chi Hsieh <si...@tw.ibm.com>
Date:   2016-05-06T14:22:49Z

    Support subexpression elimination in Fliter.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217699207
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/58091/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217688141
  
    **[Test build #58083 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58083/consoleFull)** for PR 12956 at commit [`ff1b7d0`](https://github.com/apache/spark/commit/ff1b7d094b66c6d70e1bfc8d4ea6a0955776eae3).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217699205
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217474810
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/57997/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217690194
  
    **[Test build #58083 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58083/consoleFull)** for PR 12956 at commit [`ff1b7d0`](https://github.com/apache/spark/commit/ff1b7d094b66c6d70e1bfc8d4ea6a0955776eae3).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217456943
  
    
    Codes:
    
        val ds = Seq(("a", 10), ("a", 20), ("b", 1), ("b", 2), ("c", 1)).toDS().filter("_2 + 1 > 5").filter("_2 + 1 > 20")
        ds.collect()
    
    Generated codes:
    
        /* 030 */   protected void processNext() throws java.io.IOException {                                  
        /* 031 */     /*** PRODUCE: Filter (((_2#3 + 1) > 20) && ((_2#3 + 1) > 5)) */
        /* 032 */
        /* 033 */     /*** PRODUCE: INPUT */
        /* 034 */
        /* 035 */     while (inputadapter_input.hasNext()) {
        /* 036 */       InternalRow inputadapter_row = (InternalRow) inputadapter_input.next();
        /* 037 */       /*** CONSUME: Filter (((_2#3 + 1) > 20) && ((_2#3 + 1) > 5)) */
        /* 038 */
        /* 039 */       /* ((input[1, int] + 1) > 20) */
        /* 040 */       // Common expression
        /* 041 */       /* (input[1, int] + 1) */
        /* 042 */       /* input[1, int] */
        /* 043 */       /* input[1, int] */
        /* 044 */       int inputadapter_value1 = inputadapter_row.getInt(1);
        /* 045 */
        /* 046 */       int filter_value = -1;
        /* 047 */       filter_value = inputadapter_value1 + 1;
        /* 048 */
        /* 049 */       /* (input[1, int] + 1) */
        /* 050 */
        /* 051 */       boolean filter_value3 = false;
        /* 052 */       filter_value3 = filter_value > 20;
        /* 053 */       if (!filter_value3) continue;
        /* 054 */       /* ((input[1, int] + 1) > 5) */
        /* 055 */       /* (input[1, int] + 1) */
        /* 056 */
        /* 057 */       boolean filter_value5 = false;
        /* 058 */       filter_value5 = filter_value > 5;
        /* 059 */       if (!filter_value5) continue;
        /* 060 */
        /* 061 */       filter_numOutputRows.add(1);
        /* 062 */
        /* 063 */       /*** CONSUME: WholeStageCodegen */
        /* 064 */
        /* 065 */       /* input[0, string] */
        /* 066 */       boolean inputadapter_isNull = inputadapter_row.isNullAt(0);
        /* 067 */       UTF8String inputadapter_value = inputadapter_isNull ? null : (inputadapter_row.getUTF8String(0));
        /* 068 */       filter_holder.reset();
        /* 069 */
        /* 070 */       filter_rowWriter.zeroOutNullBytes();
        /* 071 */
        /* 072 */       if (inputadapter_isNull) {
        /* 073 */         filter_rowWriter.setNullAt(0);
        /* 074 */       } else {
        /* 075 */         filter_rowWriter.write(0, inputadapter_value);
        /* 076 */       }
        /* 077 */
        /* 078 */       filter_rowWriter.write(1, inputadapter_value1);
        /* 079 */       filter_result.setTotalSize(filter_holder.totalSize());
        /* 080 */       append(filter_result);
        /* 081 */       if (shouldStop()) return;
        /* 082 */     }
        /* 083 */   }
        /* 084 */ }



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217474554
  
    **[Test build #57997 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57997/consoleFull)** for PR 12956 at commit [`55e43ef`](https://github.com/apache/spark/commit/55e43ef9f25c68d0c3773f36156b34d42a9baedc).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class SubExprEliminationState(isNull: String, value: String, exprCode: Option[ExprCode])`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217690214
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217768690
  
    cc @davies This is ready for review. Please take a look of this. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217690215
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/58083/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-218031560
  
    @davies yea, I think so. The evaluation ordering of predicates makes subexpression elimination more complicated. I will try to simplify it. If it can't be, I will close it then. Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217692284
  
    **[Test build #58091 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58091/consoleFull)** for PR 12956 at commit [`b40fd4b`](https://github.com/apache/spark/commit/b40fd4b386520f71963453c967c44471131689d8).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217457647
  
    **[Test build #57997 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/57997/consoleFull)** for PR 12956 at commit [`55e43ef`](https://github.com/apache/spark/commit/55e43ef9f25c68d0c3773f36156b34d42a9baedc).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217921582
  
    @viirya It's too complicated, we may not do this. I think we will not support  subexpression elimination in most of the operators.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217474807
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #12956: [SPARK-15180][SQL] Support subexpression eliminat...

Posted by viirya <gi...@git.apache.org>.
Github user viirya closed the pull request at:

    https://github.com/apache/spark/pull/12956


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request: [SPARK-15180][SQL] Support subexpression elimi...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/12956#issuecomment-217699173
  
    **[Test build #58091 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58091/consoleFull)** for PR 12956 at commit [`b40fd4b`](https://github.com/apache/spark/commit/b40fd4b386520f71963453c967c44471131689d8).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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