Examples of ExecJob


Examples of org.apache.pig.backend.executionengine.ExecJob

    //
    // Use pig STORE to store testing data
    //
    System.out.println("path = " + path);
    try {
        ExecJob pigJob = pigServer
            .store(
                "records",
                path.toString(),
                TableStorer.class.getCanonicalName()
                    + "('[s1, s2]; [s3, s4]')");
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

    while (it.hasNext()) {
      Tuple cur = it.next();
      System.out.println(cur);
    }

    ExecJob pigJob = pigServer.store("records", new Path(pathTable, "store")
        .toString(), TableStorer.class.getCanonicalName() + "('[c]')");

    Assert.assertNull(pigJob.getException());
  }
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

    t1++;
   
    String table1path = pathTable1.toString() + Integer.toString(t1);
    

ExecJob pigJob =pigServer.store("sort1", table1path, TableStorer.class.getCanonicalName()
        + "('[a, b, c]; [d, e, f, r1, m1]')");
if (pigJob.getException() != null){
  System.out.println("******pig job exception"+ pigJob.getException().getMessage());
}
Assert.assertNull(pigJob.getException());
    String query3 = "records1 = LOAD '"
        + table1path
        + "' USING org.apache.hadoop.zebra.pig.TableLoader('a, b, c, d, e, f, r1, m1', 'sorted');";

    System.out.println("query3:" + query3);
    pigServer.registerQuery(query3);  
   
    String foreach = "records11 = foreach records1 generate a as a, b as b, c as c, d as d, e as e, f as f, r1 as r1, m1#'a' as ma1;";
    pigServer.registerQuery(foreach);
 
    /*
     * Table2 creation
     */
    this.t1++;
    String table2path = this.pathTable2.toString() + Integer.toString(this.t1);
    pigJob = pigServer.store("sort2", table2path, TableStorer.class.getCanonicalName()
        + "('[a, b, c]; [d,e,f,r1,m1]')");
    if (pigJob.getException() != null){
      System.out.println("******pig job exception"+ pigJob.getException().getMessage());
    }
    Assert.assertNull(pigJob.getException());
    String query4 = "records2 = LOAD '" + table2path
        + "' USING org.apache.hadoop.zebra.pig.TableLoader();";
    pigServer.registerQuery(query4);

   
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

            outputFile = File.createTempFile("JIAR_1027", ".out");
            String filePath = outputFile.getAbsolutePath();
            outputFile.delete();
            PigServer pig = new PigServer(ExecType.LOCAL);
            pig.registerQuery("A = load 'test/org/apache/pig/test/data/passwd';");
            ExecJob job = pig.store("A", filePath);
            PigStats stats = job.getStatistics();
            File dataFile = new File( outputFile.getAbsoluteFile() + File.separator + "part-00000" );
            assertEquals(dataFile.length(), stats.getBytesWritten());
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println( e.getMessage() );
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

            if (currDAG.isBatchOn()) {
                currDAG.execute();
            }
           
            ExecJob job = store(id, FileLocalizer.getTemporaryPath(pigContext)
                    .toString(), Utils.getTmpFileCompressorName(pigContext) + "()");
           
            // invocation of "execute" is synchronous!

            if (job.getStatus() == JOB_STATUS.COMPLETED) {
                return job.getResults();
            } else if (job.getStatus() == JOB_STATUS.FAILED
                       && job.getException() != null) {
                // throw the backend exception in the failed case
                Exception e = job.getException();
                int errCode = 1066;
                String msg = "Unable to open iterator for alias " + id +
                ". Backend error : " + e.getMessage();
                throw new FrontendException(msg, errCode, PigException.INPUT, e);
            } else {
                throw new IOException("Job terminated with anomalous status "
                    + job.getStatus().toString());
            }
        }
        catch(FrontendException e){
            throw e;
        }
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

       
        LogicalPlan readFrom = aliases.get(id);
       
        // Run
        try {
            ExecJob job = optimizeAndRunQuery(readFrom);

            // invocation of "execute" is synchronous!
            if (job.getStatus() == JOB_STATUS.COMPLETED) {
                return job.getResults();
            }
            else {
                throw new IOException("Job terminated with anomalous status " + job.getStatus().toString());
            }
        }
        catch (ExecException e) {
            throw WrappedIOException.wrap("Unable to open iterator for alias: " + id, e);
        }
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

     * @return iterator of tuples returned from the script
     * @throws IOException
     */
    public Iterator<Tuple> openIterator(String id) throws IOException {
        try {
            ExecJob job = store(id, FileLocalizer.getTemporaryPath(pigContext)
                    .toString(), Utils.getTmpFileCompressorName(pigContext)
                    + "()");

            // invocation of "execute" is synchronous!

            if (job.getStatus() == JOB_STATUS.COMPLETED) {
                return job.getResults();
            } else if (job.getStatus() == JOB_STATUS.FAILED
                    && job.getException() != null) {
                // throw the backend exception in the failed case
                Exception e = job.getException();
                int errCode = 1066;
                String msg = "Unable to open iterator for alias " + id
                        + ". Backend error : " + e.getMessage();
                throw new FrontendException(msg, errCode, PigException.INPUT, e);
            } else {
                throw new IOException("Job terminated with anomalous status "
                        + job.getStatus().toString());
            }
        } catch (FrontendException e) {
            throw e;
        } catch (Exception e) {
            int errCode = 1066;
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

            }

            if (currDAG.isBatchOn()) {
                currDAG.execute();
            }
            ExecJob job = store(id, FileLocalizer.getTemporaryPath(null, pigContext).toString(), BinStorage.class.getName() + "()");
           
            // invocation of "execute" is synchronous!

            if (job.getStatus() == JOB_STATUS.COMPLETED) {
                return job.getResults();
            } else if (job.getStatus() == JOB_STATUS.FAILED
                       && job.getException() != null) {
                // throw the backend exception in the failed case
                throw job.getException();
            } else {
                throw new IOException("Job terminated with anomalous status "
                    + job.getStatus().toString());
            }
        } catch (Exception e) {
            int errCode = 1066;
            String msg = "Unable to open iterator for alias " + id;
            throw new FrontendException(msg, errCode, PigException.INPUT, e);
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

            Schema dumpedASchema = server.dumpSchema("A");
            server.registerQuery("STORE A into '" + tablename + "' using org.apache.hcatalog.pig.HCatStorer("
                + (provideSchemaToStorer ? "'', '" + pigSchema + "'" : "")
                + ");");

            ExecJob execJob = server.executeBatch().get(0);
            if (!execJob.getStatistics().isSuccessful()) {
                throw new RuntimeException("Import failed", execJob.getException());
            }
            // test that schema was loaded correctly
            server.registerQuery("X = load '" + tablename + "' using org.apache.hcatalog.pig.HCatLoader();");
            server.dumpSchema("X");
            Iterator<Tuple> it = server.openIterator("X");
View Full Code Here

Examples of org.apache.pig.backend.executionengine.ExecJob

      Tuple RowValue = it.next();
      System.out.println(RowValue);
    }

    Path newPath = new Path(getCurrentMethodName());
    ExecJob pigJob = pigServer
        .store(
            "records",
            new Path(newPath, "store").toString(),
            TableStorer.class.getCanonicalName()
                + "('s2:int, s3:long, s4:float, s5:string, s6:bytes', '[s1, s2]; [s3, s4]')");
    Assert.assertNotNull(pigJob.getException());
    System.out.println(pigJob.getException());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.