Row validation failing for TD DECIMAL(15,2) and BQ NUMERIC(15,2) #1134
Labels
priority: p0
Highest priority. Critical issue. Will be fixed prior to next release.
type: feature request
'Nice-to-have' improvement, new feature or different behavior or design.
We have noticed that TD and BQ follow different approaches to store DECIMAL types and also yield different results when casting decimal types to string.
Example 1
Example 2
CAST(0.07 AS STRING) -> .07
CAST(0.07 AS STRING) -> 0.07
Workaround
We have been using a custom SQL with the following manipulations
Source custom SQL (TD)
The following will remove trailing ceros, e.g. 44.00 -> 44
TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM CAST(QUANTITY AS VARCHAR(15)))) AS QUANTITY
Target custom SQL (BQ)
The following will remove leading ceros before the decimal separator, e.g. 0.07 -> .07
REGEXP_REPLACE(CAST(QUANTITY AS STRING),r'^0+','') as QUANTITY
Asks
1. New feature
Can DVT account for decimal to string casting inconsistencies during row validation? It's not ideal to create custom SQL for each table with decimals as this requires significant manual work. Resolving this issue would benefit future users by preventing them from encountering these inconsistencies and needing to create custom SQL solutions.
2. Workaround
Is there any other workaround less cumbersome than having to create custom sql for each table with decimals?
The text was updated successfully, but these errors were encountered: