pitrou commented on code in PR #48203:
URL: https://github.com/apache/arrow/pull/48203#discussion_r2556408154
##########
cpp/src/parquet/decoder.cc:
##########
@@ -458,7 +470,24 @@ inline int DecodePlain(const uint8_t* data, int64_t
data_size, int num_values,
}
// If bytes_to_decode == 0, data could be null
if (bytes_to_decode > 0) {
+#if ARROW_LITTLE_ENDIAN
memcpy(out, data, static_cast<size_t>(bytes_to_decode));
+#else
+ // On big-endian systems, we need to byte-swap each value
+ // since Parquet data is stored in little-endian format.
+ // Only apply to integer and floating-point types that have
FromLittleEndian support.
+ if constexpr (std::is_same_v<T, int32_t> || std::is_same_v<T, uint32_t> ||
+ std::is_same_v<T, int64_t> || std::is_same_v<T, uint64_t> ||
+ std::is_same_v<T, float> || std::is_same_v<T, double>) {
Review Comment:
I think we should be a bit more future-proof and write something like:
```suggestion
if constexpr (std::is_arithmetic_v<T>) {
```
--
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]