本文介绍了apache.beam.sdk.schemas.Schema.FieldType中Numeric的等效数据类型是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用BeamSQL将数据写入BigQuery表.要写入数据,我们需要该数据的模式.使用 org.apache.beam.sdk.schemas 定义数据收集的架构.在该数据集合中,我们有数值数据类型列.想知道 org.apache.beam.sdk.schemas.Schema.FieldType 类中Numeric的等效数据类型是什么.请有人帮我使用数值数据类型的等效架构.

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.

推荐答案

BeamSQL的Decimal可以显示BigQuery的NUMERIC.BeamSQL的Decimal由Java的BigDecimal实现,而BigDecimal本身根据Java文档支持任意精度.它的缺点是性能,因为BigDecimal不是Java原语(与FLOAT或DOUBLE相比,编码和解码将很昂贵).

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).

这篇关于apache.beam.sdk.schemas.Schema.FieldType中Numeric的等效数据类型是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 23:05