lidavidm commented on code in PR #13037:
URL: https://github.com/apache/arrow/pull/13037#discussion_r865076491
##########
cpp/src/arrow/compute/kernels/scalar_compare_test.cc:
##########
@@ -503,23 +503,24 @@ TEST(TestCompareTimestamps, DifferentParameters) {
}
TEST(TestCompareTimestamps, ScalarArray) {
- const char* scalar_json = R"("1970-01-02")";
- const char* array_json = R"(["1970-01-02","2000-02-01",null,"1900-02-28"])";
+ std::string scalar_json = R"("1970-01-02")";
+ std::string array_json = R"(["1970-01-02","2000-02-01",null,"1900-02-28"])";
struct ArrayCase {
Datum side1, side2, expected;
};
auto CheckArrayCase = [&](std::shared_ptr<DataType> scalar_type,
std::shared_ptr<DataType> array_type,
CompareOperator op,
- const char* expected_json, const char*
flip_expected_json) {
+ const std::string& expected_json,
+ const std::string& flip_expected_json) {
auto scalar_side = ScalarFromJSON(scalar_type, scalar_json);
auto array_side = ArrayFromJSON(array_type, array_json);
auto expected = ArrayFromJSON(boolean(), expected_json);
auto flip_expected = ArrayFromJSON(boolean(), flip_expected_json);
- for (auto array_case :
+ for (const auto& array_case :
std::vector<ArrayCase>{{scalar_side, array_side, expected},
{array_side, scalar_side, flip_expected}}) {
- auto lhs = array_case.side1, rhs = array_case.side2;
+ const auto &lhs = array_case.side1, rhs = array_case.side2;
Review Comment:
```suggestion
const auto &lhs = array_case.side1, &rhs = array_case.side2;
```
##########
cpp/src/arrow/compute/kernels/scalar_compare_test.cc:
##########
@@ -535,15 +536,15 @@ TEST(TestCompareTimestamps, ScalarArray) {
}
};
- for (auto unit : TimeUnit::values()) {
- for (auto types :
+ for (const auto& unit : TimeUnit::values()) {
+ for (const auto& types :
std::vector<std::pair<std::shared_ptr<DataType>,
std::shared_ptr<DataType>>>{
{timestamp(unit), timestamp(unit)},
{timestamp(unit), timestamp(unit, "utc")},
{timestamp(unit, "utc"), timestamp(unit)},
{timestamp(unit, "utc"), timestamp(unit, "utc")},
}) {
- auto t0 = types.first, t1 = types.second;
+ const auto &t0 = types.first, t1 = types.second;
Review Comment:
```suggestion
const auto &t0 = types.first, &t1 = types.second;
```
--
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]