Historian aggregates: Average/Minimum/Maximum include Uncertain samples (Part 13 / SDK use Good only) #684
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Left out of scope in #680. On SqlServer/QuestDB the per-sample Average/Minimum/Maximum (and Range, *ActualTime) value columns use Good and Uncertain samples (
uin both SQL builders), consistent with treatingTreatUncertainAsBad=false. Part 13 says these aggregates use "Good values" and the SDKAggregateCalculatoruses Good only, so results differ whenever an interval holds an Uncertain sample.SdkAggregateParityTestswould need an Uncertain-bearing dataset to pin it.Decide: align (switch the value columns from
utoginSqlAggregateQueries/QuestDbAggregateQueries, status rules per the spec tables) or document as intentional (and say whichAggregateConfigurationit corresponds to — the server rejects non-default client configurations since #677).Fixed (aligned) — merged
dbdf29c8. Part 13 defines Average/Minimum/Maximum/Range (and *ActualTime) over Good raw values; §4.2.1.2's TreatUncertainAsBad=false applies "unless the Aggregate definition says otherwise", and these definitions do (confirmed by the OPC Foundation on its forum, and by the SDKAggregateCalculator). So the Good+Uncertain value columns were a defect, not a configuration choice; the advertisedTreatUncertainAsBad=falsestays accurate (it governs the time-weighted family and status calculations).Now on SqlServer, QuestDB (and Gateway via #681):
BadNoData;Uncertain_DataSubNormalif a Bad value exists or an Uncertain value lies beyond the Good extreme (deliberate spec-over-SDK deviation — the SDK computes those extremes and never reads them);BadAggregateInvalidInputs).⚠️ Client-visible: results change whenever an interval holds Uncertain samples.
Verification:
DenseUncertain/UncertainBeyond/UncertainTextparity datasets vs the SDK (unmasked except the documented deviation), real-SQL conformance (Uncertain above/below the Good range, Uncertain-only interval, Uncertain string), falsified; live gate 9 G2 on both backends (byte-identical between them) — every SDK difference is a documented one.