-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema-level metadata is not encoded in Flight responses #3779
Labels
Comments
@alamb I can confirm that with this patch: Index: arrow-flight/src/encode.rs
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/arrow-flight/src/encode.rs b/arrow-flight/src/encode.rs
--- a/arrow-flight/src/encode.rs (revision bbc1469077e13ba2e5a61f130917ad7eccfcb569)
+++ b/arrow-flight/src/encode.rs (date 1677712010122)
@@ -323,7 +323,7 @@
})
.collect();
- Schema::new(fields)
+ Schema::new(fields).with_metadata(schema.metadata().clone())
}
/// Split [`RecordBatch`] so it hopefully fits into a gRPC response.
@@ -453,6 +453,7 @@
#[cfg(test)]
mod tests {
+ use std::collections::HashMap;
use arrow::{
array::{UInt32Array, UInt8Array},
compute::concat_batches,
@@ -502,6 +503,16 @@
);
}
+ #[test]
+ fn test_schema_metadata_encoded() {
+ let schema = Schema::new(vec![
+ Field::new("data", DataType::Int32, false),
+ ]).with_metadata(HashMap::from([("some_key".to_owned(), "some_value".to_owned())]));
+
+ let got = prepare_schema_for_flight(&schema);
+ assert!(got.metadata().contains_key("some_key"));
+ }
+
#[test]
fn test_encode_no_column_batch() {
let batch = RecordBatch::try_new_with_options( and minor fixes in IOx, the schema metadata propagates across RPC requests |
stuartcarnie
added a commit
to stuartcarnie/arrow-rs
that referenced
this issue
Mar 7, 2023
tustvold
pushed a commit
that referenced
this issue
Mar 8, 2023
* fix: Ensure prepared schema includes parent metadata Closes #3779 * Add a test and run fmt --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
When preparing schema for encoding into a Flight response, the schema-level metadata from the source schema is dropped:
arrow-rs/arrow-flight/src/encode.rs
Line 326 in e7eb304
To Reproduce
Expected behavior
Schema-level metadata should be included permitting test to pass.
Additional context
The text was updated successfully, but these errors were encountered: