hadoop - Pig multiply a number from a table to all the values of another table -


i have 2 tables:

a: (feature:chararray, value:float)  b:(multiplier:charray, value:float) 

where table thousands of rows , b has 1 row.

what wanna take rows in , multiply a.value b.value.

e.g.

a:[('f1', 1.5) , ('f2', 2.3)]  b:[('mul', 2)] 

i'd product table c

c: [('f1', 3), ('f2', 4.6)] 

is there easy way so?

you can cross , foreach ... generate.

x = cross b; y = foreach x generate a::feature, a::value * b::value; 

the above code has not been tested.


Comments

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World