Skip to content

Commit 1b0a220

Browse files
authored
GH-47721: [C++][FlightRPC] Followup to remove unncessary std::move to resolve compliation flakiness (#48687)
### Rationale for this change Fixes compilation error on macOS: `-Wpessimizing-move` warning. `std::move()` on a ternary expression prevents copy elision. `shared_ptr` assignment already handles moves automatically, so `std::move` is unnecessary and hurts optimization. ### What changes are included in this PR? Removed `std::move()` from ternary expression in `ColumnMetadata` constructor (`cpp/src/arrow/flight/sql/column_metadata.cc:62`). Behavior unchanged - still ensures `metadata_map_` is never null. ### Are these changes tested? Yes. Existing tests cover `ColumnMetadata` functionality. No behavioral changes, so tests continue to pass. ### Are there any user-facing changes? No. Compilation fix only. Behavior identical, may have slight performance improvement from better compiler optimizations. * GitHub Issue: #47721 Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: David Li <li.davidm96@gmail.com>
1 parent 0c694e7 commit 1b0a220

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cpp/src/arrow/flight/sql/column_metadata.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ const char* ColumnMetadata::kRemarks = "ARROW:FLIGHT:SQL:REMARKS";
5959

6060
ColumnMetadata::ColumnMetadata(
6161
std::shared_ptr<const arrow::KeyValueMetadata> metadata_map) {
62-
metadata_map_ = std::move(metadata_map ? metadata_map
63-
: std::make_shared<arrow::KeyValueMetadata>());
62+
metadata_map_ =
63+
metadata_map ? metadata_map : std::make_shared<arrow::KeyValueMetadata>();
6464
}
6565

6666
arrow::Result<std::string> ColumnMetadata::GetCatalogName() const {

0 commit comments

Comments
 (0)