Examples of registerQuery()


Examples of org.apache.pig.PigServer.registerQuery()

            if(t > 50) count ++;
        }
        pw.close();
        PigServer pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
        pigServer.registerQuery("a = load '" + file + "';");
        pigServer.registerQuery("b = filter a by $0 > 50;");
        pigServer.registerQuery("c = foreach b generate $0 - 50;");
        ExecJob job = pigServer.store("c", "output_map_only");
        PigStats pigStats = job.getStatistics();
       
        //counting the no. of bytes in the output file
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

        }
        pw.close();
        PigServer pigServer = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
        pigServer.registerQuery("a = load '" + file + "';");
        pigServer.registerQuery("b = filter a by $0 > 50;");
        pigServer.registerQuery("c = foreach b generate $0 - 50;");
        ExecJob job = pigServer.store("c", "output_map_only");
        PigStats pigStats = job.getStatistics();
       
        //counting the no. of bytes in the output file
        //long filesize = cluster.getFileSystem().getFileStatus(new Path("output_map_only")).getLen();
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

    String filename = TestHelper.createTempFile(data, "");
    PigServer pig = new PigServer(LOCAL);
    filename = filename.replace("\\", "\\\\");
    patternString = patternString.replace("\\", "\\\\");
    String query = "A = LOAD 'file:" + filename + "' USING org.apache.pig.piggybank.storage.XMLLoader('property') as (doc:chararray);";
    pig.registerQuery(query);
    Iterator<?> it = pig.openIterator("A");
    int tupleCount = 0;
    while (it.hasNext()) {
      Tuple tuple = (Tuple) it.next();
      if (tuple == null)
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

  server.setBatchOn();
  server.registerFunction(
    "org.apache.pig.piggybank.storage.HiveColumnarLoader",
    new FuncSpec(funcSpecString));

  server.registerQuery("a = LOAD '"
    + datePartitionedDir.getAbsolutePath() + "' using "
    + funcSpecString + ";");
  Iterator<Tuple> result = server.openIterator("a");

  while ((result.next()) != null) {
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

        PigServer pigServer = new PigServer(LOCAL);
       
        String filename = TestHelper.createTempFile(data, "");
        ArrayList<DataByteArray[]> expected = TestHelper.getExpected(data, pattern);
       
        pigServer.registerQuery("A = LOAD 'file:" + Util.encodeEscape(filename) +
                "' USING " + DummyRegExLoader.class.getName() + "() AS (key, val);");
        Iterator<?> it = pigServer.openIterator("A");
        int tupleCount = 0;
        while (it.hasNext()) {
            Tuple tuple = (Tuple) it.next();
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

      ArrayList<String[]> dataE = new ArrayList<String[]>();
        dataE.add(new String[] { "3,three;iii" });
         ArrayList<DataByteArray[]> expected = TestHelper.getExpected(dataE, pattern2);
       
        pigServer.registerQuery("A = LOAD 'file:" + Util.encodeEscape(filename) +
                "' USING " + DummyRegExLoader2.class.getName() + "() AS (key, val);");
        Iterator<?> it = pigServer.openIterator("A");
        int tupleCount = 0;
        while (it.hasNext()) {
            Tuple tuple = (Tuple) it.next();
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

    @Test
    public void testLoadFromPigServer() throws Exception {
        String filename = TestHelper.createTempFile(data, " ");
        PigServer pig = new PigServer(ExecType.LOCAL);
        filename = filename.replace("\\", "\\\\");
        pig.registerQuery("A = LOAD 'file:" + filename + "' USING org.apache.pig.piggybank.storage.apachelog.CombinedLogLoader();");
        Iterator<?> it = pig.openIterator("A");

        int tupleCount = 0;

        while (it.hasNext()) {
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

    @Test
    public void testLoadFromPigServer() throws Exception {
        String filename = TestHelper.createTempFile(data, " ");
        PigServer pig = new PigServer(ExecType.LOCAL);
        filename = filename.replace("\\", "\\\\");
        pig.registerQuery("A = LOAD 'file:" + filename + "' USING org.apache.pig.piggybank.storage.apachelog.CommonLogLoader();");
        Iterator<?> it = pig.openIterator("A");

        int tupleCount = 0;

        while (it.hasNext()) {
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

  server.setBatchOn();
  server.registerFunction(
    "org.apache.pig.piggybank.storage.HiveColumnarLoader",
    new FuncSpec(funcSpecString));

  server.registerQuery("a = LOAD '" + singlePartitionedFile + "' using "
    + funcSpecString + ";");

  Iterator<Tuple> result = server.openIterator("a");

  int count = 0;
View Full Code Here

Examples of org.apache.pig.PigServer.registerQuery()

  server.setBatchOn();
  server.registerFunction(
    "org.apache.pig.piggybank.storage.HiveColumnarLoader",
    new FuncSpec(funcSpecString));

  server.registerQuery("a = LOAD '" + singlePartitionedDir + "' using "
    + funcSpecString + ";");

  server.registerQuery("b = foreach a generate f1;");

  Iterator<Tuple> result = server.openIterator("b");
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.