GitHub user viirya opened a pull request:

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

    [SPARK-24361][SQL] Polish code block manipulation API

    ## What changes were proposed in this pull request?
    
    Current code block manipulation API is immature and hacky. We need a formal 
API to manipulate code blocks.
    
    The basic idea is making `JavaCode`  as `TreeNode`. So we can use familiar 
`transform` API to manipulate code blocks and expressions in code blocks.
    
    For example, we can replace `SimpleExprValue` in a code block like this:
    
    ```scala
    code.transformExprValues {
      case SimpleExprValue("1 + 1", _) => aliasedParam
    }
    ```
    
    ## How was this patch tested?
    
    Added unite tests.

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

    $ git pull https://github.com/viirya/spark-1 codeblock-api

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

    https://github.com/apache/spark/pull/21405.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 #21405
    
----
commit 1df9943915b2c3df0945d4def8282a3159f584bf
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-04-30T13:29:07Z

    Add API for handling expression code generation.

commit 5fe425c2d2837f00bdfe9ba5e6f446829fba32c1
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-01T15:06:32Z

    Add new abstraction for expression codegen.

commit 00bef6bb2559d93e68266d2605ef4403f4d8d2af
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-03T11:13:15Z

    Add basic tests.

commit 5d9c454a34401f1a0c2648a17e3a811b1f452024
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-03T14:53:42Z

    Merge remote-tracking branch 'upstream/master' into SPARK-24121

commit 162deb2f4de0b4d6fee3641ce79fbab424dd8e9b
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-03T14:54:10Z

    Deal merging conflict.

commit d138ee05541bc1976442c5f1170ba7a7f3f5114c
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-04T01:12:46Z

    Address comments and add more tests.

commit ee9a4c03a2da8a01f588c1283500f3412e356875
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-05T04:33:21Z

    Address comments.

commit e7cfa286b6c4f812bcbae3d59ec24ae956d9e330
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-05T13:44:44Z

    Remove JavaCode.block. We should always use code string interpolator for 
constructing code block.

commit 5945c156b2df7aa2f61df57d86f07279b6959e2a
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-05T14:00:43Z

    We should not implicitly convert code block to string. Otherwise we may not 
aware of necessary block inputs.

commit 2b30654bc50a39a8af597df68ba288280299defe
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-05T22:54:54Z

    Address comment and trim expected code string.

commit aff411bbf21f484c20588997d98682f2ec77191a
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-08T03:24:04Z

    Remove unused import.

commit 53b329a3b4e72d423cf503af2982d545848bece8
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-08T05:33:35Z

    Address comments.

commit 72faac3209beb8bc38938f8788de6338e9b2ffae
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-09T13:37:29Z

    Address some comments.

commit ffbf4abcd4212a24bed6ebeebab8bd8d86beb699
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-17T09:37:57Z

    Merge remote-tracking branch 'upstream/master' into SPARK-24121

commit d04067635ca5785e262afb65781faab5ca737d93
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-17T09:38:59Z

    Use code block for newly merged codegen.

commit c378ce2a1982b2c5453b15fbc1de06851033ac1d
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-17T12:55:31Z

    Use Set as method exprValues method returning type.

commit 2ca974190527f3ac1ade1feddf9bd2b953fabdd7
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-19T09:31:51Z

    Address comments.

commit d91f11199cc8b3016465962a8bc4cc886512c484
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-19T13:10:32Z

    Merge remote-tracking branch 'upstream/master' into SPARK-24121

commit 5c4023353b74d1c28b8ab3caf22498ca8b05d097
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-21T06:20:58Z

    Merge remote-tracking branch 'upstream/master' into codeblock-api

commit 8d0b1b9d9dc6631ea787389bb9d3f561950c3d0b
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-21T09:19:09Z

    Add API to manipulate blocks and expressions.

commit 2d77332d77d133be1ed1c2c155c9020462628c55
Author: Liang-Chi Hsieh <viirya@...>
Date:   2018-05-23T02:45:31Z

    Merge remote-tracking branch 'upstream/master' into codeblock-api

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to