Cloud Data Fusion:将数字数据类型转换为BigQuery

huangapple go评论54阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月1日 03:14:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76376609.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定