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

ORDER BY syntax wrt parentheses is somewhat different than GROUP BY and FILTER BY

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      With GROUP BY, you must put parentheses around the aliases in the BY clause:

      B = group A by ( a, b, c );
      

      With FILTER BY, you can optionally put parentheses around the aliases in the BY clause:

      B = filter A by ( a is not null and b is not null and c is not null );
      

      However, with ORDER BY, if you put parenthesis around the BY clause, you get a syntax error:

       A = order A by ( a, b, c );
      

      Produces the error:

      2009-08-03 18:26:29,544 [main] ERROR org.apache.pig.tools.grunt.Grunt -
      ERROR 1000: Error during parsing. Encountered " "," ", "" at line 3, column 19.
      Was expecting:
          ")" ...
      

      This is an annoyance really.

      Here's my full code example ...

      A = load 'data.txt' using PigStorage as (a: chararray, b: chararray, c: chararray );
      
      A = order A by ( a, b, c );
      
      dump A;
      

      Attachments

        Issue Links

          Activity

            People

              xuefuz Xuefu Zhang
              ciemo David Ciemiewicz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: