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

Logical Optimizer: Expression optimizor rule

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.7.0
    • 0.8.0
    • impl
    • None
    • Hide
      This logical simplification contains the following types of simplifications:

      1) Constant pre-calculation
      Example:
      B = filter A by a0 > 5+7;

      is simplified to

      B = filter A by a0 > 12;


      2) Elimination of negations
      Example:
      B = filter A by not (not(a0>5) or a>10);

      is simplified to

      B = filter A by a0>5 and a<=10;


      3) Elimination of logical implied expression in AND
      Example:
      B = filter A by (a0 > 5 and a0 > 7);


      is simplified to

      B = filter A by a0 > 7;


      4) Elimination of logical implied expression in OR
      Example:
      B = filter A by ((a0 > 5) or (a0 > 6 and a1 > 15);

      is simplified to
      B = filter C by a0 > 5;


      5) Equivalence elimination
      Example:
      B = filter A by (a0 > 5 and a0 > 5);

      is simplified to

      B = filter A by a0 > 5;


      6) Elimination of complementary expressions in OR
      Example:
      B = filter A by (a0 > 5 OR a0 <= 5);

      is simplified to non-filtering


      7) Elimination of naive TRUE expression
      Example:

      B = filter A by 1==1;

      is simplified to non-filtering
      Show
      This logical simplification contains the following types of simplifications: 1) Constant pre-calculation Example: B = filter A by a0 > 5+7; is simplified to B = filter A by a0 > 12; 2) Elimination of negations Example: B = filter A by not (not(a0>5) or a>10); is simplified to B = filter A by a0>5 and a<=10; 3) Elimination of logical implied expression in AND Example: B = filter A by (a0 > 5 and a0 > 7); is simplified to B = filter A by a0 > 7; 4) Elimination of logical implied expression in OR Example: B = filter A by ((a0 > 5) or (a0 > 6 and a1 > 15); is simplified to B = filter C by a0 > 5; 5) Equivalence elimination Example: B = filter A by (a0 > 5 and a0 > 5); is simplified to B = filter A by a0 > 5; 6) Elimination of complementary expressions in OR Example: B = filter A by (a0 > 5 OR a0 <= 5); is simplified to non-filtering 7) Elimination of naive TRUE expression Example: B = filter A by 1==1; is simplified to non-filtering

    Description

      We can optimize expression in several ways:

      1. Constant pre-calculation
      Example:
      B = filter A by a0 > 5+7;
      => B = filter A by a0 > 12;

      2. Boolean expression optimization
      Example:
      B = filter A by not (not(a0>5) or a>10);
      => B = filter A by a0>5 and a<=10;

      Attachments

        1. PIG-1399.patch
          111 kB
          Yan Zhou
        2. PIG-1399.patch
          125 kB
          Yan Zhou
        3. PIG-1399.patch
          125 kB
          Yan Zhou
        4. PIG-1399.patch
          127 kB
          Yan Zhou
        5. PIG-1399.patch
          136 kB
          Yan Zhou
        6. PIG-1399.patch
          137 kB
          Yan Zhou
        7. PIG-1399.patch
          137 kB
          Yan Zhou
        8. newPatchFindbugsWarnings.html
          5 kB
          Alan Gates

        Activity

          People

            yanz Yan Zhou
            daijy Daniel Dai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: