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

Logical simplifier does not simplify away constants under AND and OR; after simplificaion the ordering of operands of AND and OR may get changed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8.0
    • 0.8.0
    • impl
    • None

    Description

      b = FILTER a by (( f1 > 1) AND (1 == 1))

      or

      b = FILTER a by ((f1 > 1) OR ( 1==0))

      should be simplified to

      b = FILTER a by f1 > 1;

      Regarding ordering change, an example is that

      b = filter a by ((f1 is not null) AND (f2 is not null));

      Even without possible simplification, the expression is changed to

      b = filter a by ((f2 is not null) AND (f1 is not null));

      Even though the ordering change in this case, and probably in most other cases, does not create any difference, but for two reasons some users might care about the ordering: if stateful UDFs are used as operands of AND or OR; and if the ordering is intended by the application designer to maximize the chances to shortcut the composite boolean evaluation.

      Attachments

        1. PIG-1635.patch
          9 kB
          Yan Zhou

        Activity

          People

            yanz Yan Zhou
            yanz Yan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: