Skip to content

Instantly share code, notes, and snippets.

@heartonbit
Created April 19, 2018 01:59
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 heartonbit/80e781b0ca3248eed429e4a27cf5e31c to your computer and use it in GitHub Desktop.
Save heartonbit/80e781b0ca3248eed429e4a27cf5e31c to your computer and use it in GitHub Desktop.
CREATE TEMPORARY FUNCTION do(x float64, y float64)
RETURNS float64
LANGUAGE js AS """
function add(a, b) {
return a + b;
}
return add(x, y)
""";
with data as (
select *
from {TABLE_NAME}
limit 1 offset 0
)
select do(t1.value, t2.value) cos_dist
from data t1
cross join data t2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment