Find if a string is present inside another string in Pig

Sudar picture Sudar · Dec 20, 2012 · Viewed 14.5k times · Source

I want to find if a string contains another string in Pig. I found that there is a built-in index function, but it only searches for characters not strings.

Is there any other alternative?

Answer

user740316 picture user740316 · Dec 20, 2012

You can use this :

X = FILTER A BY (f1 matches '.*the_word_you're_looking_for.*');

More information here : http://pig.apache.org/docs/r0.10.0/basic.html#comparison