Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-1319 New logical optimization rules
  3. PIG-1321

Logical Optimizer: Merge cascading foreach

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 0.8.0
    • impl
    • None
    • Reviewed
    • Hide
      This rule allows to merge togther two foreach statements if the following preconditions are met:

      - foreach statements are consecutive
      - the second foreach is not nested
      - the first foreach statement does not contain flatten

      Example:

      (1) Original code:

      A = load 'file.txt' as (a, b, c);
      B = foreach A generate a+b as u, c-b as v;
      C = foreach B generate $0+5, v;
      .....

      (2) Optimized code:

      A = load 'file.txt' as (a, b, c);
      C = foreach A generate a+b+5, c-b;
      ......
      Show
      This rule allows to merge togther two foreach statements if the following preconditions are met: - foreach statements are consecutive - the second foreach is not nested - the first foreach statement does not contain flatten Example: (1) Original code: A = load 'file.txt' as (a, b, c); B = foreach A generate a+b as u, c-b as v; C = foreach B generate $0+5, v; ..... (2) Optimized code: A = load 'file.txt' as (a, b, c); C = foreach A generate a+b+5, c-b; ......

    Description

      We can merge consecutive foreach statement.

      Eg:
      b = foreach a generate a0#'key1' as b0, a0#'key2' as b1, a1;
      c = foreach b generate b0#'kk1', b0#'kk2', b1, a1;

      => c = foreach a generate a0#'key1'#'kk1', a0#'key1'#'kk2', a0#'key2', a1;

      Attachments

        1. jira-1321-3.patch
          25 kB
          Daniel Dai
        2. jira-1321-2.patch
          23 kB
          Xuefu Zhang
        3. pig-1321.patch
          21 kB
          Xuefu Zhang

        Activity

          People

            xuefuz Xuefu Zhang
            daijy Daniel Dai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: