[ 
https://issues.apache.org/jira/browse/PIG-4438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

liyunzhang_intel updated PIG-4438:
----------------------------------
    Attachment: PIG-4438_2.patch

following 5 unit tests failures are deleted after using this patch:
org.apache.pig.test.TestEvalPipeline2.testLimitAfterSort
org.apache.pig.test.TestEvalPipeline2.testLimitAutoReducer
org.apache.pig.test.TestEvalPipeline2.testLimitedSortWithDump
org.apache.pig.test.TestEvalPipeline2.testLimitAfterSortDesc
org.apache.pig.test.TestLimitAdjuster.simpleTest

Currently, we use RDD# sortByKey to implement this sort feature in spark:
see SortConverter#convert
in MR:
the implementation is:
1.      Sample the input data get a sample data
2.      Generate quantile file with the sample data. Quantile file contains the 
instance of WeightedRangePartitioner.
3.      MR uses WeightedRangePartitioner to guarantee the global sort.(Like 
TotalOrderPatitioner: 
https://books.google.com/books?id=H3mvcxPeUfwC&pg=PA151&lpg=PA151&dq=TotalOrderPartitioner+mapreduce&source=bl&ots=pYrOwd-Fse&sig=Kx3DZ8UBLFNveqepjZefSjyk65s&hl=zh-CN&sa=X&ei=q_MZVbfpIcmLyAS4_IHYCQ&ved=0CFwQ6AEwCTgK#v=onepage&q=TotalOrderPartitioner%20mapreduce&f=false)
 

Do we need implement sort like what it does in MR?

> Can not work when in "limit after sort" situation in spark mode
> ---------------------------------------------------------------
>
>                 Key: PIG-4438
>                 URL: https://issues.apache.org/jira/browse/PIG-4438
>             Project: Pig
>          Issue Type: Sub-task
>          Components: spark
>            Reporter: liyunzhang_intel
>            Assignee: liyunzhang_intel
>             Fix For: spark-branch
>
>         Attachments: PIG-4438_1.patch, PIG-4438_2.patch
>
>
> when pig script executes "order" before "limit" in spark mode, the results 
> will be wrong.
> cat testlimit.txt
> 1     orange
> 3     coconut
> 5     grape
> 6     pear
> 2     apple
> 4     mango
> testlimit.pig:
> a = load './testlimit.txt' as (x:int, y:chararray);
> b = order a by x;
> c = limit b 1;
> store c into './testlimit.out';
> the result:
> 1     orange
> 2     apple
> 3     coconut
> 4     mango
> 5     grape
> 6     pear
> the correct result should be:
> 1     orange



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to