Skip to content

Commit

Permalink
[COST-5565] - dont match on empty resource ids (OCP/AWS managed table…
Browse files Browse the repository at this point in the history
…s) (#5425)

* [COST-5565] - dont match empty resource ids
  • Loading branch information
lcouzens authored Dec 13, 2024
1 parent ed36ae7 commit 94d2544
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ cte_array_agg_nodes AS (
SELECT DISTINCT resource_id
FROM hive.{{schema | sqlsafe}}.openshift_pod_usage_line_items_daily
WHERE source = {{ocp_source_uuid}}
AND resource_id != ''
AND year = {{year}}
AND month = {{month}}
AND interval_start >= {{start_date}}
Expand All @@ -105,6 +106,7 @@ cte_array_agg_volumes AS (
SELECT DISTINCT persistentvolume, csi_volume_handle
FROM hive.{{schema | sqlsafe}}.openshift_storage_usage_line_items_daily
WHERE source = {{ocp_source_uuid}}
AND persistentvolume != ''
AND year = {{year}}
AND month = {{month}}
AND interval_start >= {{start_date}}
Expand All @@ -124,7 +126,7 @@ cte_matchable_resource_names AS (
JOIN cte_array_agg_volumes AS volumes
ON (
substr(resource_names.lineitem_resourceid, -length(volumes.persistentvolume)) = volumes.persistentvolume
OR substr(resource_names.lineitem_resourceid, -length(volumes.csi_volume_handle)) = volumes.csi_volume_handle
OR (volumes.csi_volume_handle != '' AND substr(resource_names.lineitem_resourceid, -length(volumes.csi_volume_handle)) = volumes.csi_volume_handle)
)

),
Expand Down

0 comments on commit 94d2544

Please sign in to comment.