英文:
Cloud Data Fusion: Numeric datatype into BigQuery
问题
我正在运行一个带有Wrangler转换的Data Fusion流水线,并且我想将一个值存储为BigQuery中的数值以进行精确的算术计算,但是Wrangler不允许我将FLOAT值转换为NUMERIC。
我尝试过使用隐式转换,试图将一个FLOAT值写入BQ中的NUMERIC列,但这并没有起作用。
是否有解决方法?
谢谢!
英文:
I'm running a Data Fusion pipeline with Wrangler transformations and I want to store a value as Numeric in BigQuery for some precise arithmetic calculations, but Wrangler doesn't let me transform a FLOAT value to NUMERIC.
I've tried with implicit conversion trying to write a FLOAT value into a NUMERIC column inside BQ but that didn't work.
Is there a workaround for this?
Thanks!
答案1
得分: 1
你可以将该值转换为一个十进制数据类型,它映射到BigQuery的NUMERIC数据类型。文档链接如下:1。
英文:
You can convert the value to a decimal datatype which maps to the bigquery NUMERIC datatype. Documentation here.
答案2
得分: 0
你可以使用CAST()函数进行显式转换,因为它始终将任何数值类型转换为另一种数值类型。
CAST(expression AS NUMERIC)
您可以参考此文档查看转换规则和比较表。
英文:
You can use CAST() function for explicit conversion as it always converts any numeric type to another numeric type.
CAST(expression AS NUMERIC)
You can refer to this documentation for conversion rules and comparison chart.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论