Pig
  1. Pig
  2. PIG-114

store one alias/logicalPlan twice leads to instantiation of StoreFunc as LoadFunc

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.0.0
    • Fix Version/s: 0.1.0
    • Component/s: impl
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Calling PigServer#store() twice for an alias results in following exception :

      java.lang.RuntimeException: java.lang.ClassCastException: org.apache.pig.test.DummyStoreFunc cannot be cast to org.apache.pig.LoadFunc
      	at org.apache.pig.backend.local.executionengine.POLoad.<init>(POLoad.java:59)
      	at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.doCompile(LocalExecutionEngine.java:167)
      	at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.doCompile(LocalExecutionEngine.java:184)
      	at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.doCompile(LocalExecutionEngine.java:184)
      	at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.compile(LocalExecutionEngine.java:111)
      	at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.compile(LocalExecutionEngine.java:90)
      	at org.apache.pig.backend.local.executionengine.LocalExecutionEngine.compile(LocalExecutionEngine.java:1)
      	at org.apache.pig.PigServer.store(PigServer.java:330)
      	at org.apache.pig.PigServer.store(PigServer.java:317)
      	at org.apache.pig.test.StoreTwiceTest.testIt(StoreTwiceTest.java:31)
      	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:589)
      	at junit.framework.TestCase.runTest(TestCase.java:164)
      	at junit.framework.TestCase.runBare(TestCase.java:130)
      	at junit.framework.TestResult$1.protect(TestResult.java:110)
      	at junit.framework.TestResult.runProtected(TestResult.java:128)
      	at junit.framework.TestResult.run(TestResult.java:113)
      	at junit.framework.TestCase.run(TestCase.java:120)
      	at junit.framework.TestSuite.runTest(TestSuite.java:228)
      	at junit.framework.TestSuite.run(TestSuite.java:223)
      	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.ClassCastException: org.apache.pig.test.DummyStoreFunc cannot be cast to org.apache.pig.LoadFunc
      	at org.apache.pig.backend.local.executionengine.POLoad.<init>(POLoad.java:57)
      	... 28 more
      

      I will attach a patch with a test scenario for this. Basically the code is as follow:

      PigServer pig = new PigServer(ExecType.LOCAL);
              pig
                      .registerQuery("A = LOAD 'test/org/apache/pig/test/StoreTwiceTest.java' USING "
                              + DummyLoadFunc.class.getName() + "();");
              pig.registerQuery("B = FOREACH A GENERATE * ;");
              File outputFile = new File("/tmp/testPigOutput");
              outputFile.delete();
              pig.store("A", outputFile.getAbsolutePath(), DummyStoreFunc.class
                      .getName()
                      + "()");
              outputFile.delete();
              pig.store("B", outputFile.getAbsolutePath(), DummyStoreFunc.class
                      .getName()
                      + "()");
              outputFile.delete();
              assertEquals(2, _storedTuples.size());
      
      1. pig_114_optimize_fix_v2.patch
        15 kB
        Pi Song
      2. PIG114_FixOptimize1.patch
        15 kB
        Pi Song
      3. PIG114_FixOptimize_Sample.patch
        10 kB
        Pi Song
      4. pigPatch-storeTwice-620665.patch
        4 kB
        Johannes Zillmann

        Activity

        Johannes Zillmann created issue -
        Johannes Zillmann made changes -
        Field Original Value New Value
        Attachment pigPatch-storeTwice-620665.patch [ 12376073 ]
        Pi Song made changes -
        Assignee Pi Song [ pi_song ]
        Pi Song made changes -
        Attachment PIG114_FixOptimize_Sample.patch [ 12377258 ]
        Owen O'Malley made changes -
        Workflow jira [ 12424068 ] no-reopen-closed, patch-avail [ 12425436 ]
        Pi Song made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Affects Version/s 0.0.0 [ 12312847 ]
        Fix Version/s 0.1.0 [ 12312848 ]
        Pi Song made changes -
        Attachment PIG114_FixOptimize1.patch [ 12377342 ]
        Pi Song made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Pi Song made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Pi Song made changes -
        Attachment pig_114_optimize_fix_v2.patch [ 12379723 ]
        Pi Song made changes -
        Patch Info [Patch Available]
        Alan Gates made changes -
        Resolution Fixed [ 1 ]
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Alan Gates made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Pi Song
            Reporter:
            Johannes Zillmann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development