2017-08-01 35 views
2

我正在使用bigquery和standart SQL。當我傳遞給函數int字段時,函數將其轉換爲字符串。BigQuery臨時函數將int轉換爲字符串

下面是代碼:

CREATE TEMPORARY FUNCTION test_function(int_field INT64) RETURNS INT64 

LANGUAGE js AS """ 
throw typeof(int_field) 
//return int_field 
"""; 

WITH 

test_table as (SELECT 1 as int_field) 

SELECT test_function(int_field) from test_table 

這裏是錯誤:string at test_function(INT64) line 2, column 1

這裏是作業ID:fabrika-okon:bquijob_2cb8c50e_15d9db59b4f

回答

3

As JavaScript does not support a 64-bit integer type, INT64 is unsupported in input or output types for JavaScript UDFs. Instead, use FLOAT64 to represent integer values as a number, or STRING to represent integer values as a string.

多見於SQL type encodings in JavaScript