Skip to content

MINOR: [C++] use std::move to avoid unnecessary copies - #49342

Open
SYaoJun wants to merge 2 commits into
apache:mainfrom
SYaoJun:219_move
Open

SYaoJun wants to merge 2 commits into
apache:mainfrom
SYaoJun:219_move

Conversation

@SYaoJun

@SYaoJun SYaoJun commented Feb 20, 2026

Copy link
Copy Markdown

Rationale for this change

avoid unnecessary copies

What changes are included in this PR?

use std::move to avoid unnecessary copies

Are these changes tested?

yes

Are there any user-facing changes?

no

@lriggs

lriggs commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

The change looks good. Can you fill in the description and remove the boiler plate?

@SYaoJun

SYaoJun commented Apr 25, 2026

Copy link
Copy Markdown
Author

The change looks good. Can you fill in the description and remove the boiler plate?
@lriggs Thank you for the code review. I've updated the description accordingly.

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Apr 29, 2026

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @SYaoJun , but one of these two looks incorrect to me. See below.

Comment thread cpp/src/parquet/metadata.cc Outdated
Comment on lines +180 to +182
for (auto& it : source.key_value_metadata) {
keys.push_back(std::move(it.key));
values.push_back(std::move(it.value));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source is semantically constant (it's marked const) so we should not move any values from it like this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will restore it.

Signed-off-by: Jason <libevent@yeah.net>
@SYaoJun
SYaoJun requested a review from pitrou May 14, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants