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

No attempt to check if 'flatten(group) as' has the same cardinality as 'group alias by'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.3.0
    • 0.9.0
    • grunt
    • None

    Description

      Pig script which does grouping for 3 columns and flattens as 4 columns works when in principle it should not and maybe fail as a front-end error.

      A = load 'groupcardinalitycheck.txt' using PigStorage() as (col1:chararray, col2:chararray, col3:int, col4:chararray);
      
      B = group A by (col1, col2, col3);
      
      C = foreach B generate
                 flatten(group) as (col1, col2, col3, col4),
                 SIZE(A) as frequency;
      
      dump C;
      
      

      ==========================================================================================
      Data
      ==========================================================================================
      hello CC 1 there
      hello YSO 2 out
      ouch CC 2 hey
      ==========================================================================================
      Result of the preceding script
      ==========================================================================================
      (ouch,CC,2,1L)
      (hello,CC,1,1L)
      (hello,YSO,2,1L)
      ==========================================================================================

      Attachments

        Activity

          People

            gates Alan Gates
            viraj Viraj Bhat
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: