kou commented on code in PR #40067:
URL: https://github.com/apache/arrow/pull/40067#discussion_r1535278183
##########
cpp/src/arrow/compute/kernels/scalar_cast_test.cc:
##########
@@ -2228,6 +2237,10 @@ TEST(Cast, FloatingToString) {
CheckCast(
ArrayFromJSON(float64(), "[0.0, -0.0, 1.5, -Inf, Inf, NaN, null]"),
ArrayFromJSON(string_type, R"(["0", "-0", "1.5", "-inf", "inf", "nan",
null])"));
+
+ CheckCast(
+ ArrayFromJSON(float16(), "[0.0, -0.0, 1.5, -Inf, Inf, NaN, null]"),
+ ArrayFromJSON(string_type, R"(["0", "-0", "1.5", "-inf", "inf", "nan",
null])"));
Review Comment:
How about using `float16()` -> `float32()` -> `float64()` order like other
places?
```cpp
CheckCast(
ArrayFromJSON(float16(), "[0.0, -0.0, 1.5, -Inf, Inf, NaN, null]"),
ArrayFromJSON(string_type, R"(["0", "-0", "1.5", "-inf", "inf",
"nan", null])"));
CheckCast(
ArrayFromJSON(float32(), "[0.0, -0.0, 1.5, -Inf, Inf, NaN, null]"),
ArrayFromJSON(string_type, R"(["0", "-0", "1.5", "-inf", "inf",
"nan", null])"));
CheckCast(
ArrayFromJSON(float64(), "[0.0, -0.0, 1.5, -Inf, Inf, NaN, null]"),
ArrayFromJSON(string_type, R"(["0", "-0", "1.5", "-inf", "inf",
"nan", null])"));
```
Or we may want to use `for (auto float_type : {float16(), float32(),
float64()})` style:
```cpp
for (auto float_type : {float16(), float32(), float64()}) {
for (auto string_type : {utf8(), large_utf8()}) {
CheckCast(
ArrayFromJSON(float_type, "[0.0, -0.0, 1.5, -Inf, Inf, NaN,
null]"),
ArrayFromJSON(string_type, R"(["0", "-0", "1.5", "-inf", "inf",
"nan", null])"));
}
}
```
--
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]