Attachment 'idlocal.java'

Download

   1 import java.io.IOException;
   2 
   3 import org.apache.pig.PigServer;
   4 
   5 
   6 
   7 public class idlocal{
   8    
   9 public static void main(String[] args) {
  10 
  11    
  12 
  13 try {
  14       
  15     PigServer pigServer = new PigServer("local");
  16       
  17     runIdQuery(pigServer, "passwd");
  18    
  19     }
  20 
  21    
  22     catch(Exception e) {
  23    
  24     }
  25  
  26  }
  27 
  28 
  29 
  30 public static void runIdQuery(PigServer pigServer, String inputFile) throws IOException {
  31    
  32     pigServer.registerQuery("A = load '" + inputFile + "' using PigStorage(':');");
  33        
  34     pigServer.registerQuery("B = foreach A generate $0 as id;");
  35         
  36     pigServer.store("B", "id.out");
  37    
  38  }
  39 
  40 
  41 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.