BigQueryã§ã¯ã¨ãªãæ¸ãã¨ãã«ãåãæ¥ä»ãåçãåå¨çãªã©ã®å®æ°ãã¯ã¨ãªã®è¤æ°ç®æã§ä½¿ãããæãããã¾ã
åç´ã«è¤æ°ç®æã«æ¸ãã¨ä¿®æ£ããã¨ãã«å¤§å¤ãªã®ã§ãå
±éã®ãã®ãè¤æ°ç®æã§ä½¿ãã¾ããæ¹æ³ã調ã¹ã¦ã¿ã¾ãã
UDF(ã¦ã¼ã¶ã¼å®ç¾©é¢æ°)ã«ããæ¹æ³
å®æ°ãè¿ãé¢æ°ãå®ç¾©ãã¦ä½¿ãæ¹æ³ãä¸çªç°¡åã§ã
Standard SQLã®UDFã¯ä»¥ä¸ã®ãããªå½¢å¼ã§æ¸ãã¾ã
CREATE TEMPORARY FUNCTION é¢æ°å(å¼æ°å å, ...) AS (使ãããSQL);
ããã使ãã¨ä»¥ä¸ã®ããã«å®æ°ã¨ãã¦ä½¿ããã¨ãã§ãã¦ãä¿®æ£ãããã¨ãã¯é¢æ°ã®å®ç¾©ã ããå¤ããã°ãããªãã¾ã
#StandardSQL CREATE TEMPORARY FUNCTION RATE1() AS (0.01); CREATE TEMPORARY FUNCTION PI() AS (ACOS(-1)); SELECT i, i * RATE1(), PI() FROM UNNEST(GENERATE_ARRAY(1, 100)) AS i
WITHã§é©å½ãªãã¼ãã«ãä½ã£ã¦CROSS JOIN
ããæ¹æ³
ãã£ã¡ã®æ¹æ³ã ã¨CROSS JOIN
ãããªãã¨ãããªãã®ã§å°ãã³ã¼ãããããã¥ãããªãã¾ã
#StandardSQL WITH const AS ( SELECT 0.01 AS RATE1 , ACOS(-1) AS PI ) SELECT i, i * RATE1, PI FROM const, UNNEST(GENERATE_ARRAY(1, 100)) AS i