What is the equivalent Data type for Numeric in apache.beam.sdk.schemas.Schema.FieldType

时光总嘲笑我的痴心妄想 提交于 2021-01-29 11:25:08

问题


Trying to write the data into BigQuery table using BeamSQL. To write the data we need schema of that data. Used org.apache.beam.sdk.schemas for defining schema of the data collection. We have Numeric data type column in that data collection. Want to know, what is the equivalent data type for Numeric in org.apache.beam.sdk.schemas.Schema.FieldType class. Some one please help me use the equivalent schema of Numeric data type.


回答1:


BeamSQL's Decimal can present BigQuery's NUMERIC. BeamSQL's Decimal is implemented by Java's BigDecimal, which itself supports arbitrary precision according to Java doc. The downside of it is performance because BigDecimal is not a Java primitive(encode and decode will be expensive compared to FLOAT or DOUBLE).




回答2:


DECIMAL might be what you are looking for.

Just to clarify, when you say Numeric, do you mean the NUMERIC type defined by BigQuery data types (https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types)?



来源:https://stackoverflow.com/questions/56661555/what-is-the-equivalent-data-type-for-numeric-in-apache-beam-sdk-schemas-schema-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!