Vishwanatha-HD commented on code in PR #48205: URL: https://github.com/apache/arrow/pull/48205#discussion_r2599786362
########## 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: @pitrou.. If I am understanding correctly, this logic is trying to put the lower 4-bytes (32-bits) of "last_day_nanos" into value[0] and upper 4-bytes (32-bits) into value[1].. "memcpy of 8-bytes (64-bits) will keep the values as is.. Hence we wont be able to use "memcpy" on BE machines.. Hope I am making things clear here.. -- 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]
