我们可以在BigQuery中投射类型吗? [英] Can we cast the type in BigQuery?
问题描述
SELECT SQRT((D_o_latitude - T_s_lat)^ 2 +(D_o_longitude - T_s_long)^ 2)/0.00001 FROM [datasetName.tableName]
我得到的错误是错误:函数SUBTRACT中的参数类型不匹配:'D_o_latitude'是字符串类型,'T_s_lat'是类型字符串
所以让我知道我们是否可以将字符串类型转换为查询中的浮点数类似于投射数据类型,我无法更改数据类型
使用标准SQL,您可以使用 CAST 函数,例如。 cast(numStringColumn as int64)
。注意标准SQL类型名称,因为它们不是与传统SQL完全相同。
Following my query :
SELECT SQRT((D_o_latitude - T_s_lat)^2+(D_o_longitude - T_s_long)^2)/0.00001 FROM [datasetName.tableName]
I am getting the error as Error: Argument type mismatch in function SUBTRACT:'D_o_latitude' is type string, 'T_s_lat' is type string
So Let me know can we convert the string type to float in the query some thing like casting the data type, I can not change the datatype
With standard SQL you can use CAST function, eg. cast(numStringColumn as int64)
. Look out for standard SQL type names, as they aren't exactly same as legacy SQL.
这篇关于我们可以在BigQuery中投射类型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!