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

问题描述

尝试使用 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 实现,根据 Java 文档,BigDecimal 本身支持任意精度.它的缺点是性能,因为 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 中数值的等效数据类型是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 23:05