bkietz commented on a change in pull request #7026: URL: https://github.com/apache/arrow/pull/7026#discussion_r414184803
########## File path: r/src/expression.cpp ########## @@ -21,99 +21,97 @@ // [[arrow::export]] std::shared_ptr<ds::Expression> dataset___expr__field_ref(std::string name) { - return std::make_shared<ds::FieldExpression>(std::move(name)); + return ds::field_ref(std::move(name)); } // [[arrow::export]] -std::shared_ptr<ds::ComparisonExpression> dataset___expr__equal( +std::shared_ptr<ds::Expression> dataset___expr__equal( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<ds::Expression>& rhs) { return ds::equal(lhs, rhs); } // [[arrow::export]] -std::shared_ptr<ds::ComparisonExpression> dataset___expr__not_equal( +std::shared_ptr<ds::Expression> dataset___expr__not_equal( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<ds::Expression>& rhs) { return ds::not_equal(lhs, rhs); } // [[arrow::export]] -std::shared_ptr<ds::ComparisonExpression> dataset___expr__greater( +std::shared_ptr<ds::Expression> dataset___expr__greater( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<ds::Expression>& rhs) { return ds::greater(lhs, rhs); } // [[arrow::export]] -std::shared_ptr<ds::ComparisonExpression> dataset___expr__greater_equal( +std::shared_ptr<ds::Expression> dataset___expr__greater_equal( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<ds::Expression>& rhs) { return ds::greater_equal(lhs, rhs); } // [[arrow::export]] -std::shared_ptr<ds::ComparisonExpression> dataset___expr__less( +std::shared_ptr<ds::Expression> dataset___expr__less( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<ds::Expression>& rhs) { return ds::less(lhs, rhs); } // [[arrow::export]] -std::shared_ptr<ds::ComparisonExpression> dataset___expr__less_equal( +std::shared_ptr<ds::Expression> dataset___expr__less_equal( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<ds::Expression>& rhs) { return ds::less_equal(lhs, rhs); } // [[arrow::export]] -std::shared_ptr<ds::InExpression> dataset___expr__in( +std::shared_ptr<ds::Expression> dataset___expr__in( const std::shared_ptr<ds::Expression>& lhs, const std::shared_ptr<arrow::Array>& rhs) { - return std::make_shared<ds::InExpression>(lhs->In(rhs)); + return lhs->In(rhs).Copy(); Review comment: `Copy()` moves the expression from the stack into a shared_ptr, replacing make_shared. I can add them if desired. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org