@@ -39,7 +39,7 @@ namespace iceberg {
3939
4040class ProjectionUtil {
4141 private:
42- static Result<std::shared_ptr <UnboundPredicate>> TransformSet (
42+ static Result<std::unique_ptr <UnboundPredicate>> TransformSet (
4343 std::string_view name, const std::shared_ptr<BoundSetPredicate>& predicate,
4444 const std::shared_ptr<TransformFunction>& func) {
4545 std::vector<Literal> transformed;
@@ -57,7 +57,7 @@ class ProjectionUtil {
5757
5858 // General transform for all literal predicates. This is used as a fallback for special
5959 // cases that are not handled by the other transform functions.
60- static Result<std::shared_ptr <UnboundPredicate>> GenericTransform (
60+ static Result<std::unique_ptr <UnboundPredicate>> GenericTransform (
6161 std::unique_ptr<NamedReference> ref,
6262 const std::shared_ptr<BoundLiteralPredicate>& predicate,
6363 const std::shared_ptr<TransformFunction>& func) {
@@ -88,7 +88,7 @@ class ProjectionUtil {
8888 }
8989 }
9090
91- static Result<std::shared_ptr <UnboundPredicate>> TruncateByteArray (
91+ static Result<std::unique_ptr <UnboundPredicate>> TruncateByteArray (
9292 std::string_view name, const std::shared_ptr<BoundLiteralPredicate>& predicate,
9393 const std::shared_ptr<TransformFunction>& func) {
9494 ICEBERG_ASSIGN_OR_RAISE (auto ref, NamedReference::Make (std::string (name)));
@@ -107,7 +107,7 @@ class ProjectionUtil {
107107
108108 template <typename T>
109109 requires std::is_same_v<T, int32_t > || std::is_same_v<T, int64_t >
110- static Result<std::shared_ptr <UnboundPredicate>> TruncateInteger (
110+ static Result<std::unique_ptr <UnboundPredicate>> TruncateInteger (
111111 std::string_view name, const std::shared_ptr<BoundLiteralPredicate>& predicate,
112112 const std::shared_ptr<TransformFunction>& func) {
113113 const Literal& literal = predicate->literal ();
@@ -159,7 +159,7 @@ class ProjectionUtil {
159159 }
160160 }
161161
162- static Result<std::shared_ptr <UnboundPredicate>> TransformTemporal (
162+ static Result<std::unique_ptr <UnboundPredicate>> TransformTemporal (
163163 std::string_view name, const std::shared_ptr<BoundLiteralPredicate>& predicate,
164164 const std::shared_ptr<TransformFunction>& func) {
165165 const Literal& literal = predicate->literal ();
@@ -251,7 +251,7 @@ class ProjectionUtil {
251251 }
252252 }
253253
254- static Result<std::shared_ptr <UnboundPredicate>> TruncateDecimal (
254+ static Result<std::unique_ptr <UnboundPredicate>> TruncateDecimal (
255255 std::string_view name, const std::shared_ptr<BoundLiteralPredicate>& predicate,
256256 const std::shared_ptr<TransformFunction>& func) {
257257 const Literal& boundary = predicate->literal ();
@@ -288,7 +288,7 @@ class ProjectionUtil {
288288 }
289289 }
290290
291- static Result<std::shared_ptr <UnboundPredicate>> TruncateStringLiteral (
291+ static Result<std::unique_ptr <UnboundPredicate>> TruncateStringLiteral (
292292 std::string_view name, const std::shared_ptr<BoundLiteralPredicate>& predicate,
293293 const std::shared_ptr<TransformFunction>& func) {
294294 const auto op = predicate->op ();
@@ -337,8 +337,8 @@ class ProjectionUtil {
337337 // Fixes an inclusive projection to account for incorrectly transformed values.
338338 // align with Java implementation:
339339 // https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/transforms/ProjectionUtil.java#L275
340- static Result<std::shared_ptr <UnboundPredicate>> FixInclusiveTimeProjection (
341- const std::shared_ptr <UnboundPredicateImpl<BoundReference>>& projected) {
340+ static Result<std::unique_ptr <UnboundPredicate>> FixInclusiveTimeProjection (
341+ std::unique_ptr <UnboundPredicateImpl<BoundReference>> projected) {
342342 if (projected == nullptr ) {
343343 return nullptr ;
344344 }
@@ -382,7 +382,7 @@ class ProjectionUtil {
382382 case Expression::Operation::kGt :
383383 case Expression::Operation::kGtEq :
384384 // incorrect projected values are already greater than the bound for GT, GT_EQ
385- return projected;
385+ return std::move ( projected) ;
386386
387387 case Expression::Operation::kEq : {
388388 ICEBERG_DCHECK (!projected->literals ().empty (), " Expected at least one literal" );
@@ -446,7 +446,7 @@ class ProjectionUtil {
446446 }
447447
448448 public:
449- static Result<std::shared_ptr <UnboundPredicate>> IdentityProject (
449+ static Result<std::unique_ptr <UnboundPredicate>> IdentityProject (
450450 std::string_view name, const std::shared_ptr<BoundPredicate>& predicate) {
451451 ICEBERG_ASSIGN_OR_RAISE (auto ref, NamedReference::Make (std::string (name)));
452452 switch (predicate->kind ()) {
@@ -478,7 +478,7 @@ class ProjectionUtil {
478478 std::unreachable ();
479479 }
480480
481- static Result<std::shared_ptr <UnboundPredicate>> BucketProject (
481+ static Result<std::unique_ptr <UnboundPredicate>> BucketProject (
482482 std::string_view name, const std::shared_ptr<BoundPredicate>& predicate,
483483 const std::shared_ptr<TransformFunction>& func) {
484484 ICEBERG_ASSIGN_OR_RAISE (auto ref, NamedReference::Make (std::string (name)));
@@ -519,7 +519,7 @@ class ProjectionUtil {
519519 return nullptr ;
520520 }
521521
522- static Result<std::shared_ptr <UnboundPredicate>> TruncateProject (
522+ static Result<std::unique_ptr <UnboundPredicate>> TruncateProject (
523523 std::string_view name, const std::shared_ptr<BoundPredicate>& predicate,
524524 const std::shared_ptr<TransformFunction>& func) {
525525 ICEBERG_ASSIGN_OR_RAISE (auto ref, NamedReference::Make (std::string (name)));
@@ -561,7 +561,7 @@ class ProjectionUtil {
561561 }
562562 }
563563
564- static Result<std::shared_ptr <UnboundPredicate>> TemporalProject (
564+ static Result<std::unique_ptr <UnboundPredicate>> TemporalProject (
565565 std::string_view name, const std::shared_ptr<BoundPredicate>& predicate,
566566 const std::shared_ptr<TransformFunction>& func) {
567567 ICEBERG_ASSIGN_OR_RAISE (auto ref, NamedReference::Make (std::string (name)));
@@ -581,7 +581,7 @@ class ProjectionUtil {
581581 auto fixed,
582582 FixInclusiveTimeProjection (
583583 internal::checked_pointer_cast<UnboundPredicateImpl<BoundReference>>(
584- projected)));
584+ std::move ( projected) )));
585585 return fixed;
586586 }
587587 return projected;
@@ -599,13 +599,13 @@ class ProjectionUtil {
599599 auto fixed,
600600 FixInclusiveTimeProjection (
601601 internal::checked_pointer_cast<UnboundPredicateImpl<BoundReference>>(
602- projected)));
602+ std::move ( projected) )));
603603 return fixed;
604604 }
605605 return projected;
606606 }
607607
608- static Result<std::shared_ptr <UnboundPredicate>> RemoveTransform (
608+ static Result<std::unique_ptr <UnboundPredicate>> RemoveTransform (
609609 std::string_view name, const std::shared_ptr<BoundPredicate>& predicate) {
610610 ICEBERG_ASSIGN_OR_RAISE (auto ref, NamedReference::Make (std::string (name)));
611611 switch (predicate->kind ()) {
0 commit comments