-
[OPIK-4518] [BE] fix: remove cross-version dedup from multi-version CTEs (#5852)
发布于
2026-03-26 09:21:28 +00:00 - [OPIK-4518] [BE] fix: remove cross-version dedup from multi-version CTEs
The second-level LIMIT 1 BY dataset_item_id collapsed all versions to
one row per logical item, keeping only one physical row_id. Experiments
run against non-surviving versions could not match their physical row
IDs via the dual-join, causing NULL dataset item data in the comparison
view.Removed from: dataset_items_resolved (count+main), dataset_items_agg_resolved,
dataset_items_aggr_resolved, dataset_item_versions_resolved (count+main),
experiment_items_filtered inner join, and both dataset_item_filters inline
subqueries in the stats query.Single-version queries (list/stream items, batch update, workspace lookup)
retain LIMIT 1 BY dataset_item_id as they operate within one version.- [OPIK-4518] [BE] fix: add version-scoped join to ExperimentAggregatesDAO
Scope the LEFT JOIN with dataset_item_versions_resolved by
dataset_version_id so each experiment item matches only the row
from its specific version. Eliminates potential duplicate matches
without needing cross-version dedup.- [OPIK-4518] [BE] fix: add version-scoped joins to DatasetItemVersionDAO
Thread resolved_dataset_version_id from experiments_resolved through
experiment_items_scope → experiment_items_final, and add dataset_version_id
to all dataset item CTEs. All LEFT JOINs now scope by version:- Raw path: AND di.dataset_version_id = ei.resolved_dataset_version_id
- Aggregated path: AND di.dataset_version_id = (SELECT ... FROM experiment_aggregated_scope_ids WHERE id = ei.experiment_id)
- Stats path: AND dibv.dataset_version_id = ei.resolved_dataset_version_id
Each experiment item now matches exactly one dataset item row — the one
from the version the experiment was run against.
下载附件