Create a gist now

Instantly share code, notes, and snippets.

@mioalter /distMonad.sql Secret
Created Dec 22, 2015

What would you like to do?
SELECT b, SUM(prob_inner * prob) AS prob
FROM distA LATERAL VIEW EXPLODE(g(a)) t AS b, prob_inner
GROUP BY b
-- where distA is Dist[A] as a table with columns a: A, prob: Double, and we think of g : A => Dist[B] as a UDTF which emits
-- multiple rows for each value a : A.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment