wgtmac commented on code in PR #335:
URL: https://github.com/apache/iceberg-cpp/pull/335#discussion_r2549038441


##########
src/iceberg/expression/aggregate.h:
##########
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+/// \file iceberg/expression/aggregate.h
+/// Aggregate expression definitions.
+
+#include <memory>
+
+#include "iceberg/expression/expression.h"
+#include "iceberg/expression/term.h"
+#include "iceberg/result.h"
+
+namespace iceberg {
+
+class AggregateEvaluator;
+
+/// \brief Base class for aggregate expressions.
+class ICEBERG_EXPORT Aggregate : public Expression {
+ public:
+  ~Aggregate() override = default;
+
+  Expression::Operation op() const override { return operation_; }
+
+  bool is_unbound_aggregate() const override { return false; }
+  bool is_bound_aggregate() const override { return false; }
+
+ protected:
+  explicit Aggregate(Expression::Operation op) : operation_(op) {}
+
+ private:
+  Expression::Operation operation_;
+};
+
+/// \brief Unbound aggregate with an optional term.
+class ICEBERG_EXPORT UnboundAggregate : public Aggregate, public 
Unbound<Expression> {
+ public:
+  ~UnboundAggregate() override = default;
+
+  bool is_unbound_aggregate() const override { return true; }
+
+  /// \brief Returns the unbound reference if the aggregate has a term.
+  std::shared_ptr<NamedReference> reference() override = 0;
+
+ protected:
+  explicit UnboundAggregate(Expression::Operation op) : Aggregate(op) {}
+};
+
+/// \brief Bound aggregate with an optional term.
+class ICEBERG_EXPORT BoundAggregate : public Aggregate {
+ public:
+  ~BoundAggregate() override = default;
+
+  bool is_bound_aggregate() const override { return true; }
+
+  const std::shared_ptr<BoundTerm>& term() const { return term_; }
+
+ protected:
+  BoundAggregate(Expression::Operation op, std::shared_ptr<BoundTerm> term)
+      : Aggregate(op), term_(std::move(term)) {}
+
+ private:
+  std::shared_ptr<BoundTerm> term_;
+};
+
+/// \brief COUNT aggregate variants.
+class ICEBERG_EXPORT CountAggregate : public UnboundAggregate {

Review Comment:
   We don't need to define subclass for unbound aggregates. Please check the 
current design of `Predicate` in both C++ and Java implementations.



##########
src/iceberg/expression/aggregate.h:
##########
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#pragma once
+
+/// \file iceberg/expression/aggregate.h
+/// Aggregate expression definitions.
+
+#include <memory>
+
+#include "iceberg/expression/expression.h"
+#include "iceberg/expression/term.h"
+#include "iceberg/result.h"
+
+namespace iceberg {
+
+class AggregateEvaluator;
+
+/// \brief Base class for aggregate expressions.
+class ICEBERG_EXPORT Aggregate : public Expression {
+ public:
+  ~Aggregate() override = default;
+
+  Expression::Operation op() const override { return operation_; }
+
+  bool is_unbound_aggregate() const override { return false; }
+  bool is_bound_aggregate() const override { return false; }
+

Review Comment:
   ```suggestion
   ```
   
   We don't need to override them here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to