[ 
https://issues.apache.org/jira/browse/MRQL-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13940566#comment-13940566
 ] 

Lee moon soo commented on MRQL-34:
----------------------------------

Here's reason why patch does not include all of existing antrun based test.

*A.* There're total 6 evaluators to test ( bsp/spark/mapreduce * Inmemory/local 
), i tried to implement more unittest but some query fails in local mode 
evaluator.
i need help here.

How to reproduce this problem

1. apply MRQL-34.patch to master branch.
2. add following unit test to 
core/src/test/java/org/apache/mrql/EvaluatorTest.java
{code}
        public void testDistinct() throws Exception {
                evaluate("C = 
source(line,\"../tests/data/customer.tbl\",\"|\",type(<CUSTKEY:int,NAME:string>));");
                evaluate("O = 
source(line,\"../tests/data/orders.tbl\",\"|\",type(<ORDERKEY:string,CUSTKEY:int,ORDERSTATUS:any,TOTALPRICE:float>));");
                Bag result = (Bag) execute("select distinct o.CUSTKEY from o in 
O;");
                assertEquals(3, result.size());
                assertEquals(1, ((MR_int) result.get(0)).get());
                assertEquals(2, ((MR_int) result.get(1)).get());
                assertEquals(4, ((MR_int) result.get(2)).get());
        }
{code}

and then run test (via mvn install or whatever). You'll see InMemory evaluators 
passes this test, but LocalMode evaluators generate exception.

{code}
java.lang.Error: wrong MRData: org.apache.mrql.MR_dataset@b083717
        at org.apache.mrql.Interpreter.reify(Interpreter.java:133)
        at 
org.apache.mrql.Interpreter.new_distributed_binding(Interpreter.java:80)
        at org.apache.mrql.TopLevel.distributed_assign(TopLevel.java:126)
        at org.apache.mrql.TopLevel.evaluate_top_level(TopLevel.java:267)
        at org.apache.mrql.Translator.top_level(Translator.java:443)
        at 
org.apache.mrql.CUP$MRQLParser$actions.CUP$MRQLParser$do_action(MRQLParser.java:4504)
        at org.apache.mrql.MRQLParser.do_action(MRQLParser.java:1977)
        at java_cup.runtime.lr_parser.parse(lr_parser.java:584)
        at org.apache.mrql.EvaluatorTest.evaluate(EvaluatorTest.java:60)
        at org.apache.mrql.EvaluatorTest.execute(EvaluatorTest.java:49)
        at org.apache.mrql.EvaluatorTest.testDistinct(EvaluatorTest.java:140)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:176)
        at junit.framework.TestCase.runBare(TestCase.java:141)
        at junit.framework.TestResult$1.protect(TestResult.java:122)
        at junit.framework.TestResult.runProtected(TestResult.java:142)
        at junit.framework.TestResult.run(TestResult.java:125)
        at junit.framework.TestCase.run(TestCase.java:129)
        at junit.framework.TestSuite.runTest(TestSuite.java:255)
        at junit.framework.TestSuite.run(TestSuite.java:250)
{code}


> Introduce junit for testing
> ---------------------------
>
>                 Key: MRQL-34
>                 URL: https://issues.apache.org/jira/browse/MRQL-34
>             Project: MRQL
>          Issue Type: Improvement
>            Reporter: Lee moon soo
>         Attachments: MRQL-34.patch
>
>
> MRQL has testcase and it's run as java standalone application by 
> org.apache.mrql.Test. 
> The Test class Invoked by maven antrun plugin at test phase
> and then load the queries and generate result and compare with the previous 
> result (if result exists)
> If junit runs those test case instead of antrun, it'll give some advantages
> 1. More common ways to adding / running test in Java
> 2. Once CI is setup, junit produces information for CI about details of test.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to