Skip to content

Commit

Permalink
Numeric: fix scale check for bqnumeric (#1723)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Amogh-Bharadwaj authored May 15, 2024
1 parent d4eb422 commit 09dd75d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flow/datatypes/numeric.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ func (BigQueryNumericCompatibility) MaxPrecision() int16 {
}

func (BigQueryNumericCompatibility) MaxScale() int16 {
return 37
return 20
}

func (BigQueryNumericCompatibility) DefaultPrecisionAndScale() (int16, int16) {
return PeerDBBigQueryPrecision, PeerDBBigQueryScale
}

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{}
Expand Down

0 comments on commit 09dd75d

Please sign in to comment.