Search code examples
stringapache-pig

Find if a string is present inside another string in Pig


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?


Solution

  • 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