GitHub user rednaxelafx opened a pull request:

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

    [SPARK-23447][SQL] Cleanup codegen template for Literal

    ## What changes were proposed in this pull request?
    
    Cleaned up the codegen templates for `Literal`s, to make sure that the 
`ExprCode` returned from `Literal.doGenCode()` has:
    1. an empty `code` field;
    2. an `isNull` field of either literal `true` or `false`;
    3. a `value` field that is just a simple literal/constant.
    
    Before this PR, there are a couple of paths that would return a non-trivial 
`code` and all of them are actually unnecessary. The `NaN` and `Infinity` 
constants for `double` and `float` can be accessed through constants directly 
available so there's no need to add a reference for them.
    
    Also took the opportunity to add a new util method for ease of creating 
`ExprCode` for inline-able non-null values.
    
    ## How was this patch tested?
    
    Existing tests.

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

    $ git pull https://github.com/rednaxelafx/apache-spark codegen-literal

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

    https://github.com/apache/spark/pull/20626.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 #20626
    
----
commit 68edf0f3463daed3bb7042becb333788b22b23b0
Author: Kris Mok <kris.mok@...>
Date:   2018-02-16T07:44:43Z

    Cleanup codegen templates for Literals: make sure the `code` field is empty 
and the `value` field is a simple literal.

----


---

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

Reply via email to