Created
April 12, 2018 18:50
-
-
Save campoy/20f00b94cafa81f27e85a169b8513be0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function intdiv(row, emit) { | |
emit({ d: row.x / row.y, m: row.x % row.y }); | |
} | |
bigquery.defineFunction( | |
'intdiv', | |
['x', 'y'], | |
[{ 'name': 'd', 'type': 'integer' }, | |
{ 'name': 'm', 'type': 'integer' }], | |
intdiv | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT d, m FROM intdiv( | |
SELECT 21 as x, 4 as y | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment