bkmgit commented on a change in pull request #11882: URL: https://github.com/apache/arrow/pull/11882#discussion_r780786506
########## File path: cpp/src/arrow/compute/kernels/scalar_compare.cc ########## @@ -156,39 +210,50 @@ struct Maximum { } }; +// Check if timestamp timezones are comparable (either all are empty or none is). +Status CheckCompareTimestamps(const ExecBatch& batch) { + if (batch.num_values() > 0) { + const auto& ts0 = checked_cast<const TimestampType&>(*batch[0].type()); + bool invalid_state = ts0.timezone().empty(); + for (int i = 1; i < batch.num_values(); ++i) { + const auto& ts = checked_cast<const TimestampType&>(*batch[i].type()); + invalid_state ^= ts.timezone().empty(); + } + if (invalid_state) { + return Status::Invalid( + "Cannot compare timestamp with timezone to timestamp without timezone"); + } Review comment: Fixed. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org