@@ -111,12 +111,13 @@ class ICEBERG_EXPORT BoundAggregate : public Aggregate<BoundTerm>, public Bound
111111
112112 virtual Status Update (const DataFile& file) = 0;
113113
114- virtual bool IsValid () const { return true ; }
114+ // / \brief Whether the aggregator is still valid.
115+ virtual bool IsValid () const = 0;
115116
116117 // / \brief Get the result of the aggregation.
117118 // / \return The result of the aggregation.
118119 // / \note It is an undefined behavior to call this method if any previous Update call
119- // / has returned an error.
120+ // / has returned an error or if IsValid() returns false .
120121 virtual Literal GetResult () const = 0;
121122 };
122123
@@ -127,6 +128,7 @@ class ICEBERG_EXPORT BoundAggregate : public Aggregate<BoundTerm>, public Bound
127128 }
128129
129130 Result<Literal> Evaluate (const StructLike& data) const override = 0;
131+
130132 virtual Result<Literal> Evaluate (const DataFile& file) const = 0;
131133
132134 // / \brief Whether metrics in the data file are sufficient to evaluate.
@@ -146,7 +148,7 @@ class ICEBERG_EXPORT BoundAggregate : public Aggregate<BoundTerm>, public Bound
146148// / \brief Base class for COUNT aggregates.
147149class ICEBERG_EXPORT CountAggregate : public BoundAggregate {
148150 public:
149- Result<Literal> Evaluate (const StructLike& data) const final ;
151+ Result<Literal> Evaluate (const StructLike& data) const override ;
150152 Result<Literal> Evaluate (const DataFile& file) const override ;
151153
152154 std::unique_ptr<Aggregator> NewAggregator () const override ;
@@ -156,8 +158,6 @@ class ICEBERG_EXPORT CountAggregate : public BoundAggregate {
156158 // / \brief Count using metrics from a data file.
157159 virtual Result<int64_t > CountFor (const DataFile& file) const = 0;
158160
159- bool HasValue (const DataFile& file) const override = 0;
160-
161161 protected:
162162 CountAggregate (Expression::Operation op, std::shared_ptr<BoundTerm> term)
163163 : BoundAggregate(op, std::move(term)) {}
@@ -171,7 +171,6 @@ class ICEBERG_EXPORT CountNonNullAggregate : public CountAggregate {
171171
172172 Result<int64_t > CountFor (const StructLike& data) const override ;
173173 Result<int64_t > CountFor (const DataFile& file) const override ;
174-
175174 bool HasValue (const DataFile& file) const override ;
176175
177176 private:
@@ -186,7 +185,6 @@ class ICEBERG_EXPORT CountNullAggregate : public CountAggregate {
186185
187186 Result<int64_t > CountFor (const StructLike& data) const override ;
188187 Result<int64_t > CountFor (const DataFile& file) const override ;
189-
190188 bool HasValue (const DataFile& file) const override ;
191189
192190 private:
@@ -200,7 +198,6 @@ class ICEBERG_EXPORT CountStarAggregate : public CountAggregate {
200198
201199 Result<int64_t > CountFor (const StructLike& data) const override ;
202200 Result<int64_t > CountFor (const DataFile& file) const override ;
203-
204201 bool HasValue (const DataFile& file) const override ;
205202
206203 private:
@@ -213,12 +210,11 @@ class ICEBERG_EXPORT MaxAggregate : public BoundAggregate {
213210 static std::shared_ptr<MaxAggregate> Make (std::shared_ptr<BoundTerm> term);
214211
215212 Result<Literal> Evaluate (const StructLike& data) const override ;
216- Result<Literal> Evaluate (const DataFile& file) const final ;
213+ Result<Literal> Evaluate (const DataFile& file) const override ;
214+ bool HasValue (const DataFile& file) const override ;
217215
218216 std::unique_ptr<Aggregator> NewAggregator () const override ;
219217
220- bool HasValue (const DataFile& file) const override ;
221-
222218 private:
223219 explicit MaxAggregate (std::shared_ptr<BoundTerm> term);
224220};
@@ -229,12 +225,11 @@ class ICEBERG_EXPORT MinAggregate : public BoundAggregate {
229225 static std::shared_ptr<MinAggregate> Make (std::shared_ptr<BoundTerm> term);
230226
231227 Result<Literal> Evaluate (const StructLike& data) const override ;
232- Result<Literal> Evaluate (const DataFile& file) const final ;
228+ Result<Literal> Evaluate (const DataFile& file) const override ;
229+ bool HasValue (const DataFile& file) const override ;
233230
234231 std::unique_ptr<Aggregator> NewAggregator () const override ;
235232
236- bool HasValue (const DataFile& file) const override ;
237-
238233 private:
239234 explicit MinAggregate (std::shared_ptr<BoundTerm> term);
240235};
0 commit comments