GitHub user ooq opened a pull request:

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

    [SPARK-16928][SQL] Recursive call of ColumnVector::getInt() breaks JIT 
inlining

    ## What changes were proposed in this pull request?
    
    In both `OnHeapColumnVector` and `OffHeapColumnVector`, we implemented 
`getInt()` with the following code pattern:
    ```
    public int getInt(int rowId) {
    if (dictionary == null)
    { return intData[rowId]; }
    else
    { return dictionary.decodeToInt(dictionaryIds.getInt(rowId)); }
    }
    ```
    As `dictionaryIds` is also a `ColumnVector`, this results in a recursive 
call of `getInt()` and breaks JIT inlining. As a result, `getInt()` will not 
get inlined.
    
    We fix this by adding a separate method `getDictId()` specific for 
`dictionaryIds` to use. 
    
    ## How was this patch tested?
    
    We tested the difference with the following aggregate query on a TPCDS 
dataset (with scale factor = 5):
    ```
    select
      max(ss_sold_date_sk) as max_ss_sold_date_sk,
    from store_sales
    ```
    The query runtime is improved, from 202ms (before) to 159ms (after).
    


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

    $ git pull https://github.com/ooq/spark SPARK-16928

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

    https://github.com/apache/spark/pull/14513.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 #14513
    
----
commit 70e32c661cb9f0aea9c77ac26e8326268599317c
Author: Qifan Pu <qifan...@gmail.com>
Date:   2016-08-05T22:10:55Z

    Fix SPARK-16928.

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to