This is definitely valid in Pig
but its not recommended. I am pasting the information from the pig documentation link
It is possible to reuse relation names
; for example, this is legitimate:
A = load 'NYSE_dividends' (exchange, symbol, date, dividends)
A = filter A by dividends > 0
A = foreach A generate UPPER(symbol)
However, it is not recommended.
It looks here as if you are reassigning A, but really you are creating new relations called A, losing track of the old relations called A
. Pig is smart enough to keep up, but it still is not a good practice
. It leads to confusion when trying to read your programs (which A am I referring to?) and when reading error messages.
Reference:
http://chimera.labs.oreilly.com/books/1234000001811/ch05.html#pl_general