martin-g commented on code in PR #8829:
URL: https://github.com/apache/arrow-rs/pull/8829#discussion_r2527643605
##########
arrow-cast/src/pretty.rs:
##########
@@ -208,10 +206,24 @@ fn create_table(
}
for batch in results {
+ let schema = schema_opt.as_ref().unwrap_or(batch.schema_ref());
+
+ // Could be a custom schema that was provided.
+ if batch.columns().len() != schema.fields().len() {
+ return Err(ArrowError::InvalidArgumentError("Expected the same
number of columns in a record batch as the number of fields in the
schema".to_owned()));
Review Comment:
Consider adding the actual lengths in the error message for easier debugging.
##########
arrow-cast/src/display.rs:
##########
@@ -82,6 +91,43 @@ impl Default for FormatOptions<'_> {
}
}
+impl PartialEq for FormatOptions<'_> {
+ fn eq(&self, other: &Self) -> bool {
+ self.safe == other.safe
+ && self.null == other.null
+ && self.date_format == other.date_format
+ && self.datetime_format == other.datetime_format
+ && self.timestamp_format == other.timestamp_format
+ && self.timestamp_tz_format == other.timestamp_tz_format
+ && self.time_format == other.time_format
+ && self.duration_format == other.duration_format
+ && match (self.formatter_factory, other.formatter_factory) {
+ (Some(f1), Some(f2)) => std::ptr::eq(f1, f2),
+ (None, None) => true,
+ _ => false,
+ }
+ }
+}
+
+impl Eq for FormatOptions<'_> {}
+
+impl Hash for FormatOptions<'_> {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.safe.hash(state);
+ self.null.hash(state);
+ self.date_format.hash(state);
+ self.datetime_format.hash(state);
+ self.timestamp_format.hash(state);
+ self.timestamp_tz_format.hash(state);
+ self.time_format.hash(state);
+ self.duration_format.hash(state);
+ self.types_info.hash(state);
Review Comment:
The Hash/Equality contract is broken - the `types_info` is used for the
Hash, but not for the PartialEq impl.
--
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]