GitHub user HyukjinKwon opened a pull request:

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

    [SPARK-17480][SQL][FOLLOWUP] Fix more instances which calls 
List.length/size which is O(n)

    ## What changes were proposed in this pull request?
    
    This PR fixes all the instances which was fixed in the previous PR.
    
    To make sure, I manually debugged and check the Scala source.
    
    `length` in 
[LinearSeqOptimized.scala#L49-L57](https://github.com/scala/scala/blob/2.11.x/src/library/scala/collection/LinearSeqOptimized.scala#L49-L57)
 is O(n).
    
    Also, `size` calls `length` via 
[SeqLike.scala#L106](https://github.com/scala/scala/blob/2.11.x/src/library/scala/collection/SeqLike.scala#L106).
    
    Several instances (that uses `size` in `Array`) were changed to `length` to 
avoid implicit conversion to `SeqLike`.
    
    
    ## How was this patch tested?
    
    I ran the bash on Mac
    
    ```bash
    find . -name *.scala -type f -exec grep -il "while (.*\\.length)" {} \; | 
grep "src/main"
    find . -name *.scala -type f -exec grep -il "while (.*\\.size)" {} \; | 
grep "src/main"
    ```
    
    and then checked each.

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

    $ git pull https://github.com/HyukjinKwon/spark SPARK-17480-followup

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

    https://github.com/apache/spark/pull/15093.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 #15093
    
----
commit fbc3419f098e3fd838d36e2a10bcd869ec373098
Author: hyukjinkwon <[email protected]>
Date:   2016-09-14T12:50:59Z

    Fix more same instances

commit ecd3ddeae5ae85b8378c0d361565a788315bbcbd
Author: hyukjinkwon <[email protected]>
Date:   2016-09-14T13:03:47Z

    Last instance

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to