Skip to content

Commit

Permalink
More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NiallRees committed Feb 10, 2021
1 parent d270a3a commit 73f861d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion models/fct_dbt__critical_path.sql
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ search_path (node_ids, total_time) as (
),

longest_path_node_ids as (
-- Find the path with the longest total time

select
-- Remove any empty strings from the beginning of the array that were introduced in search_path to prevent infinite recursion
case
when get(node_ids, 0) = ''
-- Ensure we capture keep the last element of the array
-- Ensure we keep the last element of the array by using array_size for the last index
then array_slice(node_ids, 1, array_size(node_ids))
else node_ids
end as node_ids,
Expand All @@ -187,6 +188,7 @@ longest_path_node_ids as (
),

flattened as (
-- Flatten the array of node_ids and keep the index

select
value as node_id,
Expand All @@ -197,6 +199,7 @@ flattened as (
),

longest_path_with_times as (
-- Join the indidivual model execution times back in along with the materializations

select
flattened.node_id::string as node_id,
Expand Down

0 comments on commit 73f861d

Please sign in to comment.