Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig, mail # user - Parameterized Expression in Filter


Copy link to this message
-
Parameterized Expression in Filter
Duckworth, Will 2012-08-27, 20:50
I am trying to use a parameter as the expression in a filter.

Assuming:

colors_in = load ‘$in_path’ as (color:chararray);
flt = filter colors_in by color == ‘blue’ or color == ‘green’;

I would like to use this instead:

flt = filter colors_in by ‘$color_filter’;

But I get an unexpected symbol near ‘color’.  I have tried a couple different formats for the string that I am passing in an none seem to work.

I can get this to work:

flt = filter colors_in by (color == ‘$color_filter1’ or color == ‘$color_filter2’);

But it means I have to know the complete filter for anything I want to run.

I know I could do this with embedded or dynamically building the pig but was trying to do it with just passing parameters to an existing pig script.

Any ideas?

Thanks.

Will Duckworth Senior Vice President, Software Engineering | comScore, Inc. (NASDAQ:SCOR)

o +1 (703) 438-2108 | m +1 (301) 606-2977 | [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>

...........................................................................................................

Introducing Mobile Metrix 2.0 - The next generation of mobile behavioral measurement
www.comscore.com/MobileMetrix<http://www.comscore.com/Products_Services/Product_Index/Mobile_Metrix_2.0>
+
Dmitriy Ryaboy 2012-08-28, 06:34
+
Jonathan Coveney 2012-08-27, 21:07