From 6a4d98ac43b2332ceddc2c2354939bc0fda5b3d2 Mon Sep 17 00:00:00 2001 From: Alex Owens Date: Fri, 19 Apr 2024 14:38:29 +0100 Subject: [PATCH] Throw appropriate error if resampling dynamic schema with missing agg column --- cpp/arcticdb/processing/aggregation.cpp | 9 +++++---- cpp/arcticdb/processing/clause.cpp | 2 ++ .../tests/unit/arcticdb/version_store/test_resample.py | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cpp/arcticdb/processing/aggregation.cpp b/cpp/arcticdb/processing/aggregation.cpp index 1ee3d65d9a..0d4df5b799 100644 --- a/cpp/arcticdb/processing/aggregation.cpp +++ b/cpp/arcticdb/processing/aggregation.cpp @@ -707,7 +707,9 @@ Column SortedAggregator::aggregate(const } ); } else { - // Column is missing from this row-slice due to dynamic schema + // Column is missing from this row-slice due to dynamic schema, currently unsupported + schema::raise("Resample: Cannot aggregate column '{}' as it is missing from some row slices", + get_input_column_name().value); } } // We were in the middle of aggregating a bucket when we ran out of index values @@ -728,10 +730,9 @@ Column SortedAggregator::aggregate(const } } ); - } else { - // All input columns are nullopt - dynamic schema } - internal::check(res.has_value(), "Dynamic schema not currently supported with resampling"); + internal::check(res.has_value(), + "Should not be able to reach end of SortedAggregator without a column to return"); return std::move(*res); } diff --git a/cpp/arcticdb/processing/clause.cpp b/cpp/arcticdb/processing/clause.cpp index e539fd793e..a4c1013138 100644 --- a/cpp/arcticdb/processing/clause.cpp +++ b/cpp/arcticdb/processing/clause.cpp @@ -733,6 +733,8 @@ Composite ResampleClause::process(Composite