0

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.

lourdu rajan
  • 329
  • 1
  • 5
  • 24

2 Answers2

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

Rui Wang
  • 789
  • 6
  • 11
  • It works!. Thank you. BigDecimal bigDecimal = new BigDecimal(inputValue.toString()); final static Schema sample = Schema.builder().addInt32Field("AUDIT_KEY").addDecimalField("EXCHANGE_RATE").build(); – lourdu rajan Jul 08 '19 at 07:59
0

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

Yueyang Qiu
  • 159
  • 5