You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Sylvain Menu <sy...@gmail.com> on 2013/12/03 14:57:00 UTC

Some questions about flatten, case and regex

Hello,

I'm trying the following code :

##########################################
inputFile = LOAD 'data' USING TextLoader() AS (line:chararray);

caseTest = FOREACH inputFile {
    GENERATE
        (line MATCHES '.*GET.*' ? (REGEX_EXTRACT(line, '(.*) - .* - (.*)',
1), 'aaaaa') : (REGEX_EXTRACT(line, '(.*) - .* - (.*)', 2),'bbbbb')),
        (line MATCHES......etc),
        (line MATCHES......etc),
        (line MATCHES......etc);
}
##########################################

It's impossible to use the FLATTEN operator, bug ?
It is possible to use matches operator with case when operator ?
How to reduce the number of match for the same pattern ?

Thanks for help