viirya commented on code in PR #4028:
URL: https://github.com/apache/arrow-rs/pull/4028#discussion_r1160157083


##########
arrow-array/src/record_batch.rs:
##########
@@ -204,6 +204,25 @@ impl RecordBatch {
         })
     }
 
+    /// Override the schema of this [`RecordBatch`]
+    ///
+    /// Returns an error if `schema` is not a superset of the current schema
+    /// as determined by [`Schema::contains`]
+    pub fn with_schema(self, schema: SchemaRef) -> Result<Self, ArrowError> {
+        if !schema.contains(self.schema.as_ref()) {
+            return Err(ArrowError::SchemaError(format!(
+                "{schema} is not a superset of {}",
+                self.schema
+            )));
+        }

Review Comment:
   It looks like this is particular used for metadata only? Although looks like 
you can override the schema with new field (superset?), but this batch doesn't 
have it.



-- 
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]

Reply via email to