google-cloud-platformgoogle-bigqueryprecisiongoogle-cloud-pubsubnumeric

GCP Pub/Sub to BigQuery writing incorrect value to NUMERIC column


I'm publishing JSON to Pub/Sub in the following format:

{"reading":"11202.8"}

Numbers are encoded as strings to force explicit precision. This get written to BigQuery using a Pub/Sub BigQuery Subscription. The column type of reading is NUMERIC.

When I publish an integer (i.e. {"reading":"6533"}) a seemingly random number is written to BigQuery (i.e. -0.000549397).

If I encode it as 6533.0 it appears to be written correctly.

Should I be encoding it different? or is this a bug?


Solution

  • This is an issue that needs to be fixed by the Pub/Sub team. The ETA for the fix is September 13, 2024.