Hi all,
I am trying to build a ETL pipeline in Cloud Fusion.
When i do an sum aggregate on a field from a bigquery view, i get the following error:
Do you guys have any idea?
Regards,
Rolf
Hi all,
I am trying to build a ETL pipeline in Cloud Fusion.
When i do an sum aggregate on a field from a bigquery view, i get the following error:
Do you guys have any idea?
Regards,
Rolf
The error “Cannot compute Sum on field BilledCost because its type DECIMAL is not numeric” in Data Fusion indicates a type mismatch issue when performing an aggregation. In BigQuery, DECIMAL is a numeric type, but Data Fusion might be interpreting it differently, causing the issue.
To resolve this, follow these steps:
Step-by-Step Solution
BilledCost in your BigQuery view is indeed of type DECIMAL (or NUMERIC).CAST(BilledCost AS DOUBLE) or CAST(BilledCost AS FLOAT), depending on your precision needs.BilledCost to double or float type.BilledCost.Detailed Steps in Data Fusion
BilledCost to a numeric type that Data Fusion can handle, for example, float.BilledCost as a numeric type (double or float).BilledCost.Example Pipeline
BilledCost.CAST(BilledCost AS DOUBLE)BilledCost is now recognized as a double.BilledCost.Example Wrangler Transformation Code
SELECT CAST(BilledCost AS DOUBLE) AS BilledCost
FROM my_table
Alternative Solutions
In some cases, you might explore:
SAFE_CAST along with ARRAY_AGG) can be used to work around the issue.Additional Considerations
DECIMAL type has a specific precision and scale that needs to be maintained, ensure the conversion does not lose critical data. Choose between FLOAT and DOUBLE (or another numeric type) based on your precision needs.Testing After implementing the type conversion, test your pipeline with sample data to ensure that the aggregation now works as expected and the results are accurate.