我们可以在 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]
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'是类型字符串
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
推荐答案
使用标准 SQL,您可以使用 CAST 函数,例如.cast(numStringColumn as int64)
.注意标准 SQL 类型名称,因为它们是与旧版 SQL 不完全相同.
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屋!