Skip to content

Instantly share code, notes, and snippets.

@mioalter
Created December 22, 2015 19:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mioalter/175c6a71c8754212c73d to your computer and use it in GitHub Desktop.
Save mioalter/175c6a71c8754212c73d to your computer and use it in GitHub Desktop.
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