PageRenderTime 26ms CodeModel.GetById 2ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 1ms

/test/e2e/pig/tests/macro.conf

https://github.com/ftian/pig
Unknown | 598 lines | 544 code | 54 blank | 0 comment | 0 complexity | 4f765ccd14a0e6803b4e1bd7e141465c MD5 | raw file
  1
  2###############################################################################
  3# Nightly tests for pig.
  4#
  5# Author:  Alan F. Gates (gates@)
  6# $Header:$
  7#
  8
  9#use Yahoo::Miners::Test::PigSetup;
 10
 11#PigSetup::setup();
 12
 13#my $me = `whoami`;
 14#chomp $me;
 15
 16$cfg = {
 17  'driver' => 'Pig',
 18
 19  'groups' => [
 20    {
 21      'name' => 'Macro_DefinitionAndInline',
 22      'tests' => [
 23        {
 24          # simple macro, no args
 25          'num' => 1,
 26          'pig' => q#define simple_macro() returns void {
 27                         a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 28                         b = foreach a generate age, name;
 29                         store b into ':OUTPATH:';
 30                     }
 31
 32                     simple_macro();#,
 33          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 34                                   b = foreach a generate age, name;
 35                                   store b into ':OUTPATH:';#,
 36        },{
 37          # input args, no return
 38          'num' => 2,
 39          'pig' => q#define simple_macro(loadfile) returns void {
 40                         a = load '$loadfile' as (name, age, gpa);
 41                         b = foreach a generate age, name;
 42                         store b into ':OUTPATH:';
 43                     }
 44
 45                     simple_macro(':INPATH:/singlefile/studenttab10k');#,
 46          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 47                                   b = foreach a generate age, name;
 48                                   store b into ':OUTPATH:';#,
 49        },{
 50          # input args, return value
 51          'num' => 3,
 52          'pig' => q#define simple_macro(loadfile) returns b {
 53                         a = load '$loadfile' as (name, age, gpa);
 54                         $b = foreach a generate age, name;
 55                     }
 56
 57                     x = simple_macro(':INPATH:/singlefile/studenttab10k');
 58                     store x into ':OUTPATH:';#,
 59          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 60                                   b = foreach a generate age, name;
 61                                   store b into ':OUTPATH:';#,
 62        },
 63        {
 64          # input args, filter on double and int, return value
 65          'num' => 4,
 66          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns c {
 67                         b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
 68                         $c = foreach b generate age, name;
 69                     }
 70
 71                     a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 72                     x = simple_macro(a, '3.0', '40');
 73                     store x into ':OUTPATH:';#,
 74          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 75                                   b = filter a by gpa >= 3.0 and age <= 40;
 76                                   c = foreach b generate age, name;
 77                                   store c into ':OUTPATH:';#,
 78        },
 79        {
 80          #Definition multiple input, no output, multiple returns value    
 81          #x = with multiple input, no output, multiple returns value    
 82          #Query based on FilterEq from nightly.conf
 83          'num' => 5, 
 84          'pig' => q\define test (in1, in2) returns r1, r2 {
 85                          a = load '$in1' using PigStorage() as (name, age, gpa);
 86                          $r1 = filter a by (age >= 50 or name > 'fred') and (gpa <= 3.0 or name >= 'bob');
 87                          b = load '$in2' using PigStorage() as (name:chararray, age:int, registration, contributions:double);
 88                          $r2 = filter b by name matches 'f.ed' and (chararray)registration matches 'd.m';
 89                      }
 90
 91                      x1, x2 = test(':INPATH:/singlefile/studenttab10k', ':INPATH:/singlefile/votertab10k');
 92
 93                      store x1 into ':OUTPATH:.1' using PigStorage;
 94                      store x2 into ':OUTPATH:.2' using PigStorage;\,
 95
 96
 97          'verify_pig_script' => q\a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
 98                                   a1 = filter a by (age >= 50 or name > 'fred') and (gpa <= 3.0 or name >= 'bob');
 99                                   store a1 into ':OUTPATH:.1' using PigStorage;
100                                   b = load ':INPATH:/singlefile/votertab10k' using PigStorage() as (name:chararray, age:int, registration, contributions:double);
101                                   b2 = filter b by name matches 'f.ed' and (chararray)registration matches 'd.m';
102                                   store b2 into ':OUTPATH:.2' using PigStorage;\,
103          'floatpostprocess' => 1,
104          'delimiter' => '  ',
105        },
106        {
107          # use positional parameters inside macro
108          'num' => 6,
109          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns c {
110                         b = filter $in_relation by $2 >= $min_gpa and $1 <= $max_age;
111                         $c = foreach b generate age, name;
112                     }
113
114                     a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
115                     x = simple_macro(a, '3.0', '40');
116                     store x into ':OUTPATH:';#,
117          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
118                                   b = filter a by gpa >= 3.0 and age <= 40;
119                                   c = foreach b generate age, name;
120                                   store c into ':OUTPATH:';#,
121        },
122        {
123          # Test nested macros
124          'num' => 7,
125          'pig' => q\define sum_it(in, relation, scol) returns d {
126                          $d = foreach $in generate group, SUM($relation.$scol);
127                      }
128
129                      define group_it(in_relation, group_key, sum_col) returns c {
130                          b = group $in_relation by $group_key ;
131                          $c = sum_it(b, $in_relation, $sum_col);
132                      }
133
134                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
135                      x = group_it(a, 'name', 'age');
136                      store x into ':OUTPATH:';\,
137          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
138                                   b = group a by name;
139                                   c = foreach b generate group, SUM(a.age);
140                                   store c into ':OUTPATH:';#,
141        },
142        {
143          # single macro definition invoked multiple times
144          'num' => 8,
145          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns c {
146                         b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
147                         $c = foreach b generate age, name;
148                     }
149
150                     a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
151                     x = simple_macro(a, '3.0', '40');
152                     store x into ':OUTPATH:.1';
153
154                     z = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
155                     y = simple_macro(a, '2.0', '50');
156                     store y into ':OUTPATH:.2';#,
157
158          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
159                                   b = filter a by gpa >= 3.0 and age <= 40;
160                                   c = foreach b generate age, name;
161                                   store c into ':OUTPATH:.1';
162
163                                   d = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
164                                   e = filter d by gpa >= 2.0 and age <= 50;
165                                   f = foreach e generate age, name;
166                                   store f into ':OUTPATH:.2';#,
167        },
168        {
169          # macro arg used as function arg
170          'num' => 9,
171          'pig' => q#define simple_macro(loadfile, sep) returns b {
172                         a = load '$loadfile' using PigStorage('$sep') as (name, age, gpa);
173                         $b = foreach a generate age, name;
174                     }
175
176                     x = simple_macro(':INPATH:/singlefile/studentcolon10k', ':');
177                     store x into ':OUTPATH:';#,
178          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studentcolon10k' using PigStorage(':') as (name, age, gpa);
179                                   b = foreach a generate age, name;
180                                   store b into ':OUTPATH:';#,
181        },
182        {
183          # Multiple returns via split in the data flow
184          'num' => 10, 
185          'pig' => q\define test (in1) returns r1, r2 {
186                          a = load '$in1' using PigStorage() as (name, age, gpa);
187                          $r1 = filter a by (age >= 50 or name > 'fred') and (gpa <= 3.0 or name >= 'bob');
188                          $r2 = filter a by name > 'fred';
189                      }
190
191                      x1, x2 = test(':INPATH:/singlefile/studenttab10k');
192
193                      store x1 into ':OUTPATH:.1' using PigStorage;
194                      store x2 into ':OUTPATH:.2' using PigStorage;\,
195
196
197          'verify_pig_script' => q\a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
198                                   a1 = filter a by (age >= 50 or name > 'fred') and (gpa <= 3.0 or name >= 'bob');
199                                   store a1 into ':OUTPATH:.1' using PigStorage;
200                                   a2 = filter a by name > 'fred';
201                                   store a2 into ':OUTPATH:.2' using PigStorage;\,
202          'floatpostprocess' => 1,
203          'delimiter' => '  ',
204        },
205        {
206          # parameter substitution at the top level
207          'num' => 11,
208          'pig_params' => ['-p', qq(loadfile='singlefile/studenttab10k')],
209          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns c {
210                         b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
211                         $c = foreach b generate age, name;
212                     }
213
214                     a = load ':INPATH:/$loadfile' as (name, age, gpa);
215                     x = simple_macro(a, '3.0', '40');
216                     store x into ':OUTPATH:';#,
217          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
218                                   b = filter a by gpa >= 3.0 and age <= 40;
219                                   c = foreach b generate age, name;
220                                   store c into ':OUTPATH:';#,
221        }
222      ]
223    },
224    {
225      'name' => 'Macro_Scope',
226      'tests' => [
227        {
228          # re-use of variable in macro and global scope
229          'num' => 1,
230          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns b {
231                         $b = filter $in_relation by $2 >= $min_gpa and $1 <= $max_age;
232                     }
233
234                     a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
235                     x = simple_macro(a, '3.0', '40');
236                     b = foreach x generate age, name;
237                     store b into ':OUTPATH:';#,
238          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
239                                   b = filter a by gpa >= 3.0 and age <= 40;
240                                   c = foreach b generate age, name;
241                                   store c into ':OUTPATH:';#,
242        },
243        {
244          #Definition where there is a name collision between parameters in parent/child macro
245          'num' => 2,
246          'pig' => q\define sum_it(in_relation, relation, sum_col) returns c {
247                          b = foreach $in_relation generate group, SUM($relation.$sum_col);
248                          $c = order b by $1;
249                      }
250
251                      define group_it(in_relation, group_key, sum_col) returns c {
252                          b = group $in_relation by $group_key ;
253                          $c = sum_it(b, $in_relation, $sum_col);
254                      }
255
256                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
257                      x = group_it(a, name, age);
258                      store x into ':OUTPATH:';\,
259          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
260                                   b = group a by name;
261                                   c = foreach b generate group, SUM(a.age);
262                                   store c into ':OUTPATH:';#,
263        },
264        {
265          #Definition where there is a name collision between macro and returns value in main pig script    
266          'num' => 3,
267          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns c {
268                         b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
269                         $c = foreach b generate age, name;
270                     }
271
272                     a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
273                     c = simple_macro(a, '3.0', '40');
274                     store c into ':OUTPATH:';#,
275          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
276                                   b = filter a by gpa >= 3.0 and age <= 40;
277                                   c = foreach b generate age, name;
278                                   store c into ':OUTPATH:';#,
279        } 
280      ]
281    },
282    {
283      'name' => 'Macro_Schema',
284      'tests' => [
285        {
286          # macro that does not change the schema
287          'num' => 1,
288          'pig' => q\define test(in) returns a {
289                         $a = filter $in by age > 30;
290                     }
291
292                     a = load ':INPATH:/singlefile/studenttab10k' as (name:chararray, age:int, gpa:double);
293                     b = test(a);
294                     describe b;\,
295          'rc' => 0,
296          'expected_out_regex'=> "b: {name: chararray,age: int,gpa: double}"
297        },
298        {
299          # macro that does change the schema
300          'num' => 2,
301          'pig' => q\define test(in) returns a {
302                         $a = foreach $in generate name;
303                     }
304
305                     a = load ':INPATH:/singlefile/studenttab10k' as (name:chararray, age:int, gpa:double);
306                     b = test(a);
307                     describe b;\,
308          'rc' => 0,
309          'expected_out_regex'=> "b: {name: chararray}"
310        }
311      ]
312    },
313    {
314      'name' => 'Macro_Misc',
315      'tests' => [
316        {
317          #Comments in macro
318          'num' => 1,
319          'pig' => q#define simple_macro(in_relation, min_gpa, max_age) returns c {
320                         b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
321                         $c = foreach b generate age, name;
322                         -- add a comment
323                     }
324
325                     a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
326                     x = simple_macro(a, '3.0', '40');
327                     store x into ':OUTPATH:';#,
328          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
329                                   b = filter a by gpa >= 3.0 and age <= 40;
330                                   c = foreach b generate age, name;
331                                   store c into ':OUTPATH:';#,
332        },
333        {
334          #register
335          'num' => 2,
336          'pig' => q\define test (in) returns b {
337                          $b = foreach $in generate name, org.apache.pig.test.udf.evalfunc.Fred() as fred;
338                      }
339
340                      register :FUNCPATH:/testudf.jar;
341                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
342                      x = test(a);
343                      store x into ':OUTPATH:';\,
344          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
345                                   register :FUNCPATH:/testudf.jar;
346                                   b = foreach a generate name, org.apache.pig.test.udf.evalfunc.Fred() as fred;
347                                   store b into ':OUTPATH:';#,
348        },
349        {
350          #define for streaming combines with define for macros
351          'num' => 3,
352          ,'pig' => q#define CMD `perl -ne 'print $_;'`;
353                      define test(in) returns B {
354                          $B = stream $in through CMD as (name, age, gpa);
355                      }
356
357                      A = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
358                      x = test(A);
359                      store x into ':OUTPATH:';#,
360          'verify_pig_script' => q#A = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
361                                   define CMD `perl -ne 'print $_;'`;
362                                   B = stream A through CMD as (name, age, gpa);
363                                   store B into ':OUTPATH:';#,
364          'floatpostprocess' => 1,
365          'delimiter' => '  ' 
366        },
367        {
368                #JIRA: PIG-2681
369                'num' => 4,
370               ,'pig' => q\
371                    define test (in,out) returns b {
372                       a = load '$in' as (name, age, gpa);
373                       $b = foreach a generate name, org.apache.pig.test.udf.evalfunc.Fred() as fred;
374                       store $b into '$out';
375}
376                       register :FUNCPATH:/testudf.jar;
377                       x = test(':INPATH:/singlefile/studenttab10k',':OUTPATH:');
378\,
379        }
380      ]
381    },
382    {
383       'name' => 'Macro_Import',
384       'tests' => [
385         {
386           'num' => 1,
387           'pig' => q#import ':SCRIPTHOMEPATH:/macro1.pig';
388                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
389                      x = simple_macro(a, '3.0', '40');
390                      store x into ':OUTPATH:';#,
391          'verify_pig_script' => q#a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
392                                   b = filter a by gpa >= 3.0 and age <= 40;
393                                   c = foreach b generate age, name;
394                                   store c into ':OUTPATH:';#,
395          }
396
397        ]
398      },
399      {
400       'name' => 'Macro_Error',
401       'tests' => [
402         {
403           # parameter names repeated
404           'num' => 1,
405           'ignore' => 'https://issues.apache.org/jira/browse/PIG-2247',
406           'pig' => q#define simple_macro(in_relation, min_gpa, min_gpa) returns c {
407                          b = filter $in_relation by gpa >= $min_gpa;
408                          $c = foreach b generate age, name;
409                      }
410 
411                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
412                      x = simple_macro(a, '3.0', '40');
413                      store x into ':OUTPATH:';#,
414            'expected_err_regex' => "Multiple arguments min_gpa found"
415         },
416         {
417           # undefined parameter in macro
418           'num' => 2,
419           'pig' => q#define simple_macro(in_relation, min_gpa) returns c {
420                          b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
421                          $c = foreach b generate age, name;
422                      }
423
424                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
425                      x = simple_macro(a, '3.0');
426                      store x into ':OUTPATH:';#,
427            'expected_err_regex' => "Macro inline failed for macro 'simple_macro'. Reason: Undefined parameter : max_age"
428          },
429          {
430            # name collision between arg and return value
431            'num' => 3,
432            'pig' => q#define simple_macro(in_relation, min_gpa, c) returns c {
433                           b = filter $in_relation by gpa >= $min_gpa and age <= $c;
434                           $c = foreach b generate age, name;
435                       }
436
437                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
438                       x = simple_macro(a, '3.0', '40');
439                       store x into ':OUTPATH:';#,
440            'expected_err_regex' => "Multiple values found for c"
441          },
442          {
443            # keyword as macro name
444            'num' => 4,
445            'pig' => q#define foreach(in_relation, min_gpa) returns c {
446                           b = filter $in_relation by gpa >= $min_gpa;
447                           $c = foreach b generate age, name;
448                       }
449
450                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
451                       x = simple_macro(a, '3.0', '40');
452                       store x into ':OUTPATH:';#,
453            'expected_err_regex' => "mismatched input 'foreach' expecting IDENTIFIER_L"
454          },
455          {
456            # UDF as macro name
457            'num' => 5,
458            'ignore' => 'https://issues.apache.org/jira/browse/PIG-2248',
459            'pig' => q#define COUNT(in_relation, min_gpa) returns c {
460                           b = filter $in_relation by gpa >= $min_gpa;
461                           $c = foreach b generate age, name;
462                       }
463
464                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
465                       x = COUNT(a, '3.0');
466                       store x into ':OUTPATH:';#,
467            'expected_err_regex' => "macro name hides UDF COUNT"
468          },
469          {
470            # redefine a macro
471            'num' => 6,
472            'pig' => q#define simple_macro(in_relation, min_gpa) returns c {
473                           b = filter $in_relation by gpa >= $min_gpa;
474                           $c = foreach b generate age, name;
475                       }
476
477                       define simple_macro(in, min_age) returns d {
478                           b = filter $in by age >= $min_age;
479                           $d = foreach b generate age, name;
480                       }
481
482                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
483                       x = simple_macro(a, '3.0', '40');
484                       store x into ':OUTPATH:';#,
485            'expected_err_regex' => "Duplicated macro name 'simple_macro'"
486          },
487          {
488            # invoke non-existent macro
489            'num' => 7,
490            'pig' => q#
491                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
492                       x = nosuch_macro('a', '3.0', '40');
493                       store x into ':OUTPATH:';#,
494            'expected_err_regex' => "Cannot expand macro 'nosuch_macro'. Reason: Macro must be defined before expansion."
495          },
496          {
497            # Specifies two returns, but only actually returns one
498            'num' => 8,
499            'pig' => q#define simple(in_relation, min_gpa) returns c,d {
500                           b = filter $in_relation by gpa >= $min_gpa;
501                           $c = foreach b generate age, name;
502                       }
503
504                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
505                       x, y = simple(a, '3.0');
506                       store x into ':OUTPATH:.1';
507                       store y into ':OUTPATH:.2';#,
508            'expected_err_regex' => "Invalid macro definition: . Reason: Macro 'simple' missing return alias: d"
509          },
510          {
511            # syntax error in a macro, check for correct line number
512            'num' => 9,
513            'pig' => q#define simple(in_relation, min_gpa) returns c {
514                           b = fiter $in_relation by gpa >= $min_gpa;
515                           $c = foreach b generate age, name;
516                       }
517
518                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
519                       x = simple(a, '3.0');
520                       store x into ':OUTPATH:';#,
521            'expected_err_regex' => "line 2"
522          },
523          {
524           # too many args passed to macro
525           'num' => 10,
526           'pig' => q#define simple_macro(in_relation, min_gpa) returns c {
527                          b = filter $in_relation by gpa >= $min_gpa;
528                          $c = foreach b generate age, name;
529                      }
530
531                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
532                      x = simple_macro(a, '3.0', '40');
533                      store x into ':OUTPATH:';#,
534            'expected_err_regex' => "Failed to expand macro 'simple_macro'. Reason: Expected number of parameters: 2 actual number of inputs: 3"
535          },
536          {
537            # return two values, but script only accepts 1
538            'num' => 11,
539            'pig' => q#define simple(in_relation, min_gpa) returns c,d {
540                           b = filter $in_relation by gpa >= $min_gpa;
541                           $c = foreach b generate age, name;
542                           $d = foreach b generate name, age;
543                       }
544
545                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
546                       x = simple(a, '3.0');
547                       store x into ':OUTPATH:';#,
548            'expected_err_regex' => "Failed to expand macro 'simple'. Reason: Expected number of return aliases: 2 actual number of return values: 1"
549          },
550          {
551            # return 1 value, but script expects 2
552            'num' => 12,
553            'pig' => q#define simple(in_relation, min_gpa) returns c {
554                           b = filter $in_relation by gpa >= $min_gpa;
555                           $c = foreach b generate age, name;
556                       }
557
558                       a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
559                       x, y = simple(a, '3.0');
560                       store x into ':OUTPATH:.1';
561                       store y into ':OUTPATH:.2';#,
562            'expected_err_regex' => "Failed to expand macro 'simple'. Reason: Expected number of return aliases: 1 actual number of return values: 2"
563          }
564        ]
565      },
566      {
567       'name' => 'Macro_Import_Error',
568       'tests' => [
569         {
570           # import non-existent file
571           'num' => 1,
572           'ignore' => 1, # different error message for different version of hadoop
573           'pig' => q#import 'nosuchfile';
574 
575                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
576                      x = simple_macro('a', '3.0', '40');
577                      store x into ':OUTPATH:';#,
578            'expected_err_regex' => "Failed to import file 'nosuchfile'. Reason: Can't find the Specified file nosuchfile"
579         },
580         {
581           # import a macro with a syntax error
582           'num' => 2,
583           'pig' => q#import ':SCRIPTHOMEPATH:/macro_bad1.pig';
584                      a = load ':INPATH:/singlefile/studenttab10k' as (name, age, gpa);
585                      x = simple_macro(a, '3.0', '40');
586                      store x into ':OUTPATH:';#,
587            'expected_err_regex' => "Invalid macro definition"
588         }
589        ]
590      }
591    ],
592  },
593;
594
595# import non-existent file, import script with error
596
597
598