Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COST-5565] - dont match on empty resource ids (OCP/AWS managed tables) #5425

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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