问题
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