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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -