From 09dd75dce310f7f236963c1fcc822c73cd1cebf6 Mon Sep 17 00:00:00 2001 From: Amogh Bharadwaj Date: Wed, 15 May 2024 17:38:38 +0530 Subject: [PATCH] Numeric: fix scale check for bqnumeric (#1723) For bigquery we were checking for numeric scale being < precision, also need to make sure it is less than 20 as that is the scale we set for bignumeric in bq --- flow/datatypes/numeric.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flow/datatypes/numeric.go b/flow/datatypes/numeric.go index 0a072ae42f..356ef06605 100644 --- a/flow/datatypes/numeric.go +++ b/flow/datatypes/numeric.go @@ -61,7 +61,7 @@ func (BigQueryNumericCompatibility) MaxPrecision() int16 { } func (BigQueryNumericCompatibility) MaxScale() int16 { - return 37 + return 20 } func (BigQueryNumericCompatibility) DefaultPrecisionAndScale() (int16, int16) { @@ -69,7 +69,7 @@ func (BigQueryNumericCompatibility) DefaultPrecisionAndScale() (int16, int16) { } func (BigQueryNumericCompatibility) IsValidPrevisionAndScale(precision, scale int16) bool { - return precision > 0 && precision <= 38 && scale < precision + return precision > 0 && precision <= 38 && scale <= 20 && scale < precision } type DefaultNumericCompatibility struct{}