Commit 8edd708
authored
fix: fix batch transform modify schema (#1483)
## Which issue does this PR close?
- Previously, we used `record_batch.with_schema(target_schema.clone())`
to change the schema name of a record batch, but unfortunately,
`with_schema` would check the schema name and throw an error. So I think
we should convert the RecordBatch like how `BatchTransform::Modify`
does, but keep the same columns.
```rust
pub fn with_schema(self, schema: SchemaRef) -> Result<Self, ArrowError> {
if !schema.contains(self.schema.as_ref()) {
return Err(ArrowError::SchemaError(format!(
"target schema is not superset of current schema target={schema} current={}",
self.schema
)));
}
Ok(Self {
schema,
columns: self.columns,
row_count: self.row_count,
})
}
```
- Closes #.
## What changes are included in this PR?
## Are these changes tested?1 parent 69686ba commit 8edd708
1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
| |||
0 commit comments