Vishwanatha-HD commented on code in PR #48205: URL: https://github.com/apache/arrow/pull/48205#discussion_r2601918022
########## cpp/src/parquet/column_writer.h: ########## @@ -267,9 +267,14 @@ inline void ArrowTimestampToImpalaTimestamp(const int64_t time, Int96* impala_ti } impala_timestamp->value[2] = static_cast<uint32_t>(julian_days); uint64_t last_day_nanos = static_cast<uint64_t>(last_day_units) * NanosecondsPerUnit; +#if ARROW_LITTLE_ENDIAN // impala_timestamp will be unaligned every other entry so do memcpy instead // of assign and reinterpret cast to avoid undefined behavior. - std::memcpy(impala_timestamp, &last_day_nanos, sizeof(uint64_t)); + std::memcpy(impala_timestamp, &last_day_nanos, sizeof(int64_t)); +#else + (*impala_timestamp).value[0] = static_cast<uint32_t>(last_day_nanos); + (*impala_timestamp).value[1] = static_cast<uint32_t>(last_day_nanos >> 32); Review Comment: @kou.. I dont think that is necessary.. Otherwise the testcase would have failed.. Its just the way the 3 uint32_t values of "last_day_nanos" are arranged into the "(*impala_timestamp).value" variable.. -- 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]
