When creating BigQuery tables using the Java com.google.cloud:google-cloud-bigquery library, I don't see the BIGNUMERIC column data-type in the StandardSQLTypeName enumerations. I see NUMERIC but not BIGNUMERIC. How would I create a table with a BIGNUMERIC column programmatically? Thanks!
Field f1 = Field.newBuilder("first_name", StandardSQLTypeName.STRING).build();
Field f2 = Field.newBuilder("score", StandardSQLTypeName.NUMERIC).build();
Schema schema = Schema.of(Arrays.asList(f1,f2));
TableId tableId = TableId.of("my_data_set", "tbl_people"));
TableDefinition tableDefinition = StandardTableDefinition.of(schema);
TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build();
bigQuery.create(tableInfo);
If you're using versions 1.124.7
and below, the enum for StandardSQLTypeName.BIGNUMERIC is not yet present. I suggest you use the latest version (1.125.0 and up).
You can refer to this doc for a detailed guide on how to create and use BigQuery table.