fix daily aggregation sample count
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1293,7 +1293,9 @@ func BuildDailySummaryInsert(tableName string, unionQuery string) (string, error
|
||||
WITH snapshots AS (
|
||||
%s
|
||||
), totals AS (
|
||||
SELECT COUNT(DISTINCT "SnapshotTime") AS total_samples, MAX("SnapshotTime") AS max_snapshot FROM snapshots
|
||||
SELECT "Vcenter", COUNT(DISTINCT "SnapshotTime") AS total_samples, MAX("SnapshotTime") AS max_snapshot
|
||||
FROM snapshots
|
||||
GROUP BY "Vcenter"
|
||||
), agg AS (
|
||||
SELECT
|
||||
s."InventoryId", s."Name", s."Vcenter", s."VmId", s."EventKey", s."CloudId",
|
||||
@@ -1449,13 +1451,13 @@ SELECT
|
||||
THEN 100.0 * agg.gold_hits / agg.samples_present
|
||||
ELSE NULL END AS "Gold"
|
||||
FROM agg
|
||||
CROSS JOIN totals
|
||||
JOIN totals ON totals."Vcenter" = agg."Vcenter"
|
||||
GROUP BY
|
||||
agg."InventoryId", agg."Name", agg."Vcenter", agg."VmId", agg."EventKey", agg."CloudId",
|
||||
agg."Datacenter", agg."Cluster", agg."Folder",
|
||||
agg."IsTemplate", agg."PoweredOn", agg."SrmPlaceholder", agg."VmUuid",
|
||||
agg.any_creation, agg.any_deletion, agg.first_present, agg.last_present,
|
||||
totals.total_samples;
|
||||
totals.total_samples, totals.max_snapshot;
|
||||
`, unionQuery, tableName)
|
||||
return insert, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user