Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2425

Aggregate Warning does not work as expected on Embedding Pig in Java 0.9.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.1
    • 0.10.0
    • None
    • Patch Available

    Description

      Property "aggregate.warning" is not being set by default when running PigServer, embedding Pig in Java.

      I was initially creating a PigServer object this way:

        PigServer pigServer = new PigServer(ExecType.MAPREDUCE);
      

      But this generated detailed logs in the log directory. To code around this on the client-side you could do

      Properties properties = PropertiesUtil.loadDefaultProperties();
      properties.setProperty("aggregate.warning", "true");
      PigServer pigServer = new PigServer(ExecType.MAPREDUCE, properties);
      

      The behavior between Pig scripting and Embedded Pig should be similar. Looking at
      the main constructor of PigServer, it looks like "aggregateWarning" is set
      to false if its not loaded in to Properties object.

      public PigServer(PigContext context, boolean connect) throws ExecException {
               this.pigContext = context;
               currDAG = new Graph(false);
      
               aggregateWarning =
      "true".equalsIgnoreCase(pigContext.getProperties().getProperty("aggregate.warning"));
               isMultiQuery =
      "true".equalsIgnoreCase(pigContext.getProperties().getProperty("opt.multiquery","true"));
      
               jobName = pigContext.getProperties().getProperty(
                       PigContext.JOB_NAME,
                       PigContext.JOB_NAME_PREFIX + ":DefaultJobName");
      
               if (connect) {
                   pigContext.connect();
               }
      
               addJarsFromProperties();
           }
      

      I suggest adding "aggregate.warning" to Properties object of PigContext so its picked up across all users of this property (MapReduceLauncher)

      public PigServer(PigContext context, boolean connect) throws ExecException {
              this.pigContext = context;
              currDAG = new Graph(false);
      
              aggregateWarning = "true".equalsIgnoreCase(pigContext.getProperties().getProperty("aggregate.warning", "true"));
              if(aggregateWarning) {
              	pigContext.getProperties().setProperty("aggregate.warning", "true");
              }
              	
              isMultiQuery = "true".equalsIgnoreCase(pigContext.getProperties().getProperty("opt.multiquery","true"));
              
              jobName = pigContext.getProperties().getProperty(
                      PigContext.JOB_NAME,
                      PigContext.JOB_NAME_PREFIX + ":DefaultJobName");
      
              if (connect) {
                  pigContext.connect();
              }
      
              addJarsFromProperties();
          }
      

      Attachments

        1. aggregateWarning.patch
          0.8 kB
          Prashant Kommireddi
        2. aggregateWarning2425.txt
          5 kB
          Prashant Kommireddi

        Activity

          People

            prkommireddi Prashant Kommireddi
            prkommireddi Prashant Kommireddi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: