Pig
  1. Pig
  2. PIG-3342

Allow conditions in case statement

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.12.0
    • Component/s: parser
    • Labels:
      None

      Description

      PIG-3268 added case statement support. But conditions are currently not allowed in when branches. For example,

      CASE
        WHEN i % 5 == 0 THEN '5n'
        WHEN i % 5 == 1 THEN '5n+1'
        WHEN i % 5 == 2 THEN '5n+2'
        WHEN i % 5 == 3 THEN '5n+3'
        ELSE                 '5n+4'
      END
      

      This is invalid now. However, it will be useful if it's allowed.

      1. PIG-3342.patch
        11 kB
        Cheolsoo Park

        Issue Links

          Activity

          Cheolsoo Park created issue -
          Hide
          Cheolsoo Park added a comment -

          Attached is a patch that allows conditions in when branches. I added two test cases to TestCase to verify the new syntax.

          ant test -Dtestcase=TestCase passes.

          Show
          Cheolsoo Park added a comment - Attached is a patch that allows conditions in when branches. I added two test cases to TestCase to verify the new syntax. ant test -Dtestcase=TestCase passes.
          Cheolsoo Park made changes -
          Field Original Value New Value
          Attachment PIG-3342.patch [ 12585774 ]
          Cheolsoo Park made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Cheolsoo Park made changes -
          Link This issue is related to PIG-3280 [ PIG-3280 ]
          Hide
          Rohini Palaniswamy added a comment -

          Since it is slightly big, can you upload it in review board?

          Show
          Rohini Palaniswamy added a comment - Since it is slightly big, can you upload it in review board?
          Hide
          Cheolsoo Park added a comment -

          Thanks Rohini for taking a look.

          Here is the RB request:
          https://reviews.apache.org/r/11613/

          Show
          Cheolsoo Park added a comment - Thanks Rohini for taking a look. Here is the RB request: https://reviews.apache.org/r/11613/
          Hide
          Rohini Palaniswamy added a comment -

          +1

          Show
          Rohini Palaniswamy added a comment - +1
          Hide
          Cheolsoo Park added a comment -

          Committed to trunk. Thanks Aniket and Rohini for a review!

          Show
          Cheolsoo Park added a comment - Committed to trunk. Thanks Aniket and Rohini for a review!
          Cheolsoo Park made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Cheolsoo Park made changes -
          Link This issue is related to PIG-3268 [ PIG-3268 ]
          Daniel Dai made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Cheolsoo Park
              Reporter:
              Cheolsoo Park
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development