GitHub user adrian-wang opened a pull request:

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

    [SPARK-15397] [SQL] fix string udf locate as hive

    ## What changes were proposed in this pull request?
    
    in hive, `locate("aa", "aaa", 0)` would yield 0, `locate("aa", "aaa", 1)` 
would yield 1 and `locate("aa", "aaa", 2)` would yield 2, while in Spark, 
`locate("aa", "aaa", 0)` would yield 1,  `locate("aa", "aaa", 1)` would yield 2 
and  `locate("aa", "aaa", 2)` would yield 0. This results from the different 
understanding of the third parameter in udf `locate`. It means the starting 
index and starts from 1, so when we use 0, the return would always be 0.
    
    
    ## How was this patch tested?
    
    tested with modified `StringExpressionsSuite` and `StringFunctionsSuite`
    
    


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

    $ git pull https://github.com/adrian-wang/spark locate

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

    https://github.com/apache/spark/pull/13186.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 #13186
    
----
commit 23b43d4c837d762461dd56a62b85cb998919e0ef
Author: Daoyuan Wang <daoyuan.w...@intel.com>
Date:   2016-05-18T11:30:07Z

    fix string udf locate as hive

----


---
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