Skip to content

Commit

Permalink
fix: float overflow for base traces (#2378)
Browse files Browse the repository at this point in the history
* fix: override `value` field to be of type `bytes`

* fix: cast back `value` to `float` on `base` traces

* fix: use correct `type` to avoid overflows
  • Loading branch information
Jabolol authored Oct 23, 2024
1 parent 3a008c7 commit 441e1c9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,19 @@
incremental_strategy="insert_overwrite"
)
}}
{{ filtered_blockchain_events("BASE", "base", "traces") }}

with base_traces as (
{{ filtered_blockchain_events("BASE", "base", "traces") }}
),

transformed_traces as (
select
*,
CAST(`value` as FLOAT64) as numeric_value
from base_traces
)

select
* except (`value`, numeric_value),
numeric_value as `value`
from transformed_traces
16 changes: 14 additions & 2 deletions warehouse/dbt/models/marts/superchain/4337_traces.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@

with filtered_traces as (
{{ final_query }}
),

transformed_traces as (
select
*,
case
when network = 'BASE' then CAST(`value` as FLOAT64)
else `value`
end as numeric_value
from filtered_traces
)

select *
from filtered_traces
select
* except (`value`, numeric_value),
numeric_value as `value`
from transformed_traces
6 changes: 6 additions & 0 deletions warehouse/oso_dagster/assets/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
from ..factories.goldsky import goldsky_network_assets
from ..factories.goldsky.config import NetworkAssetSourceConfigDict

base_network = goldsky_network_assets(
network_name="base",
destination_dataset_name="superchain",
working_destination_dataset_name="oso_raw_sources",
traces_config=NetworkAssetSourceConfigDict(
schema_overrides=[
{"name": "value", "field_type": "STRING"},
]
),
)

0 comments on commit 441e1c9

Please sign in to comment.