Skip to content

Commit

Permalink
Use double instead of float in databricks
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Aug 18, 2023
1 parent f4676eb commit a83b664
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ with prep as (
from_json(contexts_com_snowplowanalytics_mobile_screen_1_0_0, 'array<struct<name:string, type:string, id:string, view_controller:string, top_view_controller:string, activity:string, fragment:string>>') as contexts_com_snowplowanalytics_mobile_screen_1,
from_json(contexts_com_snowplowanalytics_snowplow_client_session_1_0_2, 'array<struct<user_id:string, session_id:string, session_index:integer, event_index:integer, previous_session_id:string, storage_mechanism:string, first_event_id:string, first_event_timestamp:string>>') as contexts_com_snowplowanalytics_snowplow_client_session_1,
from_json(contexts_org_whatwg_video_element_1_0_0, 'array<struct<video_height:integer, video_width:integer, auto_picture_in_picture:boolean, disable_picture_in_picture:boolean, poster:string >>') as contexts_org_whatwg_video_element_1,
from_json(contexts_org_whatwg_media_element_1_0_0, 'array<struct<auto_play:boolean, current_src:string, default_muted:boolean, default_playback_rate:float ,html_id:string,media_type:string,network_state:string,preload:string,ready_state:string,seeking:boolean,cross_origin:string,disable_remote_playback:boolean,error:string,file_extension:string,fullscreen:boolean,picture_in_picture:boolean,src:string>>') as contexts_org_whatwg_media_element_1,
from_json(contexts_com_youtube_youtube_1_0_0, 'array<struct<auto_play:boolean, buffering:boolean, controls:boolean, cued:boolean, loaded:integer, playback_quality:string, player_id:string, unstarted:boolean, url:string, error:string, fov:float, origin:string, pitch:float, playlist_index:float, roll:float, yaw:float>>') as contexts_com_youtube_youtube_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_player_1_0_0, 'array<struct<current_time:float, ended:boolean, loop:boolean, muted:boolean, paused:boolean, playback_rate:float, volume:integer, duration:float, is_live:boolean, percent_progress:integer>>') as contexts_com_snowplowanalytics_snowplow_media_player_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_player_2_0_0, 'array<struct<current_time:float, duration:float, ended: boolean, fullscreen:boolean, livestream:boolean, label:string, loop:boolean, media_type:string, muted:boolean, paused:boolean, picture_in_picture:boolean, playback_rate:float, player_type:string, quality:string, volume:integer>>') as contexts_com_snowplowanalytics_snowplow_media_player_2,
from_json(contexts_com_snowplowanalytics_snowplow_media_session_1_0_0, 'array<struct<media_session_id:string, started_at:string, ping_interval:integer, time_played:float, time_played_muted:float, time_paused:float, content_watched:float, time_buffering:float, time_spent_ads:float, ads:integer, ads_clicked:integer, ads_skipped:integer, ad_breaks:integer, avg_playback_rate:float>>') as contexts_com_snowplowanalytics_snowplow_media_session_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_ad_1_0_0, 'array<struct<name:string, ad_id:string, creative_id:string, pod_position:integer, duration:float, skippable:boolean>>') as contexts_com_snowplowanalytics_snowplow_media_ad_1,
from_json(contexts_org_whatwg_media_element_1_0_0, 'array<struct<auto_play:boolean, current_src:string, default_muted:boolean, default_playback_rate:double ,html_id:string,media_type:string,network_state:string,preload:string,ready_state:string,seeking:boolean,cross_origin:string,disable_remote_playback:boolean,error:string,file_extension:string,fullscreen:boolean,picture_in_picture:boolean,src:string>>') as contexts_org_whatwg_media_element_1,
from_json(contexts_com_youtube_youtube_1_0_0, 'array<struct<auto_play:boolean, buffering:boolean, controls:boolean, cued:boolean, loaded:integer, playback_quality:string, player_id:string, unstarted:boolean, url:string, error:string, fov:double, origin:string, pitch:double, playlist_index:double, roll:double, yaw:double>>') as contexts_com_youtube_youtube_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_player_1_0_0, 'array<struct<current_time:double, ended:boolean, loop:boolean, muted:boolean, paused:boolean, playback_rate:double, volume:integer, duration:double, is_live:boolean, percent_progress:integer>>') as contexts_com_snowplowanalytics_snowplow_media_player_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_player_2_0_0, 'array<struct<current_time:double, duration:double, ended: boolean, fullscreen:boolean, livestream:boolean, label:string, loop:boolean, media_type:string, muted:boolean, paused:boolean, picture_in_picture:boolean, playback_rate:double, player_type:string, quality:string, volume:integer>>') as contexts_com_snowplowanalytics_snowplow_media_player_2,
from_json(contexts_com_snowplowanalytics_snowplow_media_session_1_0_0, 'array<struct<media_session_id:string, started_at:string, ping_interval:integer, time_played:double, time_played_muted:double, time_paused:double, content_watched:double, time_buffering:double, time_spent_ads:double, ads:integer, ads_clicked:integer, ads_skipped:integer, ad_breaks:integer, avg_playback_rate:double>>') as contexts_com_snowplowanalytics_snowplow_media_session_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_ad_1_0_0, 'array<struct<name:string, ad_id:string, creative_id:string, pod_position:integer, duration:double, skippable:boolean>>') as contexts_com_snowplowanalytics_snowplow_media_ad_1,
from_json(contexts_com_snowplowanalytics_snowplow_media_ad_break_1_0_0, 'array<struct<name:string, break_id:string, start_time:string, break_type:string, pod_size:integer>>') as contexts_com_snowplowanalytics_snowplow_media_ad_break_1,
from_json(unstruct_event_com_snowplowanalytics_snowplow_media_player_event_1_0_0, 'struct<type:string, label:string>') as unstruct_event_com_snowplowanalytics_snowplow_media_player_event_1,
from_json(unstruct_event_com_snowplowanalytics_snowplow_media_ad_quartile_event_1_0_0, 'struct<percent_progress:integer>') as unstruct_event_com_snowplowanalytics_snowplow_media_ad_quartile_event_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ with prep AS (

-- unpacking the media player object
round({{ media_player_property_col(
v1_property={ 'field': 'duration', 'dtype': 'float' },
v2_property={ 'field': 'duration', 'dtype': 'float' }
v1_property={ 'field': 'duration', 'dtype': 'double' },
v2_property={ 'field': 'duration', 'dtype': 'double' }
) }}) as duration_secs,
{{ media_player_property_col(
v1_property={ 'field': 'current_time', 'dtype': 'float' },
v2_property={ 'field': 'current_time', 'dtype': 'float' }
v1_property={ 'field': 'current_time', 'dtype': 'double' },
v2_property={ 'field': 'current_time', 'dtype': 'double' }
) }} as current_time,
{{ media_player_property_col(
v1_property={ 'field': 'playback_rate', 'dtype': 'float' },
v2_property={ 'field': 'playback_rate', 'dtype': 'float' },
v1_property={ 'field': 'playback_rate', 'dtype': 'double' },
v2_property={ 'field': 'playback_rate', 'dtype': 'double' },
default='1.0'
) }} as playback_rate,
{{ percent_progress_col(
v1_percent_progress={ 'field': 'percent_progress', 'dtype': 'string' },
v1_event_type={ 'field': 'type', 'dtype': 'string' },
event_name='a.event_name',
v2_current_time={ 'field': 'current_time', 'dtype': 'float' },
v2_duration={ 'field': 'duration', 'dtype': 'float' }
v2_current_time={ 'field': 'current_time', 'dtype': 'double' },
v2_duration={ 'field': 'duration', 'dtype': 'double' }
) }},
{{ media_player_property_col(
v1_property={ 'field': 'muted', 'dtype': 'boolean' },
Expand All @@ -73,24 +73,24 @@ with prep AS (

-- media session properties
{{ media_session_property_col(property={ 'field': 'media_session_id', 'dtype': 'string' }) }} as media_session_id,
{{ media_session_property_col(property={ 'field': 'time_played', 'dtype': 'float' }) }} as media_session_time_played,
{{ media_session_property_col(property={ 'field': 'time_played_muted', 'dtype': 'float' }) }} as media_session_time_played_muted,
{{ media_session_property_col(property={ 'field': 'time_paused', 'dtype': 'float' }) }} as media_session_time_paused,
{{ media_session_property_col(property={ 'field': 'content_watched', 'dtype': 'float' }) }} as media_session_content_watched,
{{ media_session_property_col(property={ 'field': 'time_buffering', 'dtype': 'float' }) }} as media_session_time_buffering,
{{ media_session_property_col(property={ 'field': 'time_spent_ads', 'dtype': 'float' }) }} as media_session_time_spent_ads,
{{ media_session_property_col(property={ 'field': 'time_played', 'dtype': 'double' }) }} as media_session_time_played,
{{ media_session_property_col(property={ 'field': 'time_played_muted', 'dtype': 'double' }) }} as media_session_time_played_muted,
{{ media_session_property_col(property={ 'field': 'time_paused', 'dtype': 'double' }) }} as media_session_time_paused,
{{ media_session_property_col(property={ 'field': 'content_watched', 'dtype': 'double' }) }} as media_session_content_watched,
{{ media_session_property_col(property={ 'field': 'time_buffering', 'dtype': 'double' }) }} as media_session_time_buffering,
{{ media_session_property_col(property={ 'field': 'time_spent_ads', 'dtype': 'double' }) }} as media_session_time_spent_ads,
{{ media_session_property_col(property={ 'field': 'ads', 'dtype': 'integer' }) }} as media_session_ads,
{{ media_session_property_col(property={ 'field': 'ads_clicked', 'dtype': 'integer' }) }} as media_session_ads_clicked,
{{ media_session_property_col(property={ 'field': 'ads_skipped', 'dtype': 'integer' }) }} as media_session_ads_skipped,
{{ media_session_property_col(property={ 'field': 'ad_breaks', 'dtype': 'integer' }) }} as media_session_ad_breaks,
{{ media_session_property_col(property={ 'field': 'avg_playback_rate', 'dtype': 'float' }) }} as media_session_avg_playback_rate,
{{ media_session_property_col(property={ 'field': 'avg_playback_rate', 'dtype': 'double' }) }} as media_session_avg_playback_rate,

-- ad properties
{{ media_ad_property_col(property={ 'field': 'name', 'dtype': 'string' }) }} as ad_name,
{{ media_ad_property_col(property={ 'field': 'ad_id', 'dtype': 'string' }) }} as ad_id,
{{ media_ad_property_col(property={ 'field': 'creative_id', 'dtype': 'string' }) }} as ad_creative_id,
{{ media_ad_property_col(property={ 'field': 'pod_position', 'dtype': 'integer' }) }} as ad_pod_position,
{{ media_ad_property_col(property={ 'field': 'duration', 'dtype': 'float' }) }} as ad_duration,
{{ media_ad_property_col(property={ 'field': 'duration', 'dtype': 'double' }) }} as ad_duration,
{{ media_ad_property_col(property={ 'field': 'skippable', 'dtype': 'boolean' }) }} as ad_skippable,

-- ad break properties
Expand Down

0 comments on commit a83b664

Please sign in to comment.