Skip to content

calculations.matches_5_score

Parses short_score (e.g. '2-1') into separate home / away / total / difference integers and a score_winner side. Carries league_id, team_home_id, team_away_id forward as keys for downstream window functions.

flowchart LR
ee[/sources.ended_events/] --> me[/calculations.matches_5_score/]
me --> m6[/matches_6_team_stats_window/]
me --> m10[/matches_10_overperformance/]
me --> m17[/matches_17_strat_predicted/]
me --> mart[/mart.matches/]
click ee "/sources/ended_events/" "Open"
click m6 "/calculations/matches_6_team_stats_window/" "Open"
click m10 "/calculations/matches_10_overperformance/" "Open"
click m17 "/calculations/matches_17_strat_predicted/" "Open"
click mart "/mart/matches/" "Open"
ColumnDescriptionFormula
event_idBet365 event identifier.passthrough
event_dateEvent date.passthrough
event_partition_keyClickHouse partition key.passthrough
league_idLeague identifier (key for windows).passthrough
team_home_idHome-team identifier (key for windows).passthrough
team_away_idAway-team identifier (key for windows).passthrough
short_scoreRaw score string.passthrough
score_homeHome goals.if(valid, toInt32OrNull(substring(short_score, 1, position(short_score,'-')-1)), NULL) where valid = match(short_score, '^[0-9]+-[0-9]+$')
score_awayAway goals.if(valid, toInt32OrNull(substring(short_score, position(short_score,'-')+1)), NULL)
score_totalscore_home + score_away.if(valid, score_home + score_away, NULL)
score_differencescore_home − score_away.if(valid, score_home − score_away, NULL)
score_winner'home' / 'draw' / 'away' / NULL.case when home>away then 'home' when home=away then 'draw' when home<away then 'away' end (after the validity check above)