You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "fansehep (via GitHub)" <gi...@apache.org> on 2023/10/20 03:41:25 UTC
[PR] feat: support datatype struct reorder [arrow-rs]
fansehep opened a new pull request, #4962:
URL: https://github.com/apache/arrow-rs/pull/4962
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes https://github.com/apache/arrow-rs/issues/4908.
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "Folyd (via GitHub)" <gi...@apache.org>.
Folyd commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366580713
##########
arrow-schema/src/fields.rs:
##########
@@ -41,7 +41,7 @@ use std::sync::Arc;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
-pub struct Fields(Arc<[FieldRef]>);
+pub struct Fields(Arc<Vec<FieldRef>>);
Review Comment:
I don't think change `[FieldRef]` to `Vec<FieldRef]` is necessary
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep closed pull request #4962: feat: support datatype struct reorder
URL: https://github.com/apache/arrow-rs/pull/4962
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "Folyd (via GitHub)" <gi...@apache.org>.
Folyd commented on PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#issuecomment-1772226707
This PR try to fix the failed CI: https://github.com/apache/arrow-rs/pull/4957
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368590476
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
> I think the better question is, why not use SchemaBuilder, it will be faster, less complicated, and avoid having to make changes to Fields?
The problem is that the transformation of Fields into SchemaBuilder appears to be performance intensive.
Here it look like we can only use
```rust
SchemaBuilder::from(self.clone());
```
The result could be something like this:
```Rust
pub fn push(&mut self, field: Field) {
let mut new_fields = SchemaBuilder::from(self.clone());
new_fields.push(field);
*self = new_fields.finish().fields;
}
```
I am not sure why `ShemaBuilder` is better than old?
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368618525
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
I'm suggesting not adding these methods to Schema and instead using SchemaBuilder instead where you were intending to use them.
As you've discovered Schema, like the arrays, is not designed to be mutated in place, especially given it is normally wrapped in an Arc itself as a SchemaRef
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "Folyd (via GitHub)" <gi...@apache.org>.
Folyd commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366580713
##########
arrow-schema/src/fields.rs:
##########
@@ -41,7 +41,7 @@ use std::sync::Arc;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
-pub struct Fields(Arc<[FieldRef]>);
+pub struct Fields(Arc<Vec<FieldRef>>);
Review Comment:
I think change `[FieldRef]` to `Vec<FieldRef]` is unnecessary
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366595597
##########
arrow-schema/src/fields.rs:
##########
@@ -41,7 +41,7 @@ use std::sync::Arc;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
-pub struct Fields(Arc<[FieldRef]>);
+pub struct Fields(Arc<Vec<FieldRef>>);
Review Comment:
> I don't think change `[FieldRef]` to `Vec<FieldRef]` is necessary
Rust [] is a fixed size vector in compile time, if we want to push a field, should use ‘Vec’?
##########
arrow-schema/src/fields.rs:
##########
@@ -41,7 +41,7 @@ use std::sync::Arc;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
-pub struct Fields(Arc<[FieldRef]>);
+pub struct Fields(Arc<Vec<FieldRef>>);
Review Comment:
> I don't think change `[FieldRef]` to `Vec<FieldRef]` is necessary
Rust [] is a fixed size vector in compile time, if we want to push a field, should use ‘Vec’?
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#issuecomment-1772068036
Looks i break the python binding API. 😢
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368618525
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
I'm suggesting not adding these methods to Schema and instead using SchemaBuilder instead where you were intending to use them.
As you've discovered Schema, like the arrays, is not designed to be mutated in place
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1370127045
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
SchemaBuilder has support `push`, so what else do i need to do?
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366419611
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
Review Comment:
here only support reverse, but should we provide more function like this?
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368572935
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
The proposal in this PR will add an additional pointer indirection to field access, whilst still requiring atomics for every call to push.
I think the better question is, why not use SchemaBuilder, it will be faster, less complicated, and avoid having to make changes to Fields?
TLDR is I don't think any of the changes in this PR should be necessary for #4908
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368695508
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
> I'm suggesting not adding these methods to Schema and instead using SchemaBuilder instead where you were intending to use them.
Really thanks for you. ❤️ So we need an function like
```rust
pub fn push(&mut self, builder: &mut SchemaBuilder, field: Field) { }
```
When the user want to push a new field, should take the `builder`.
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
> I'm suggesting not adding these methods to Schema and instead using SchemaBuilder instead where you were intending to use them.
Really thanks for you. ❤️ So we need an function like
```rust
pub fn push(&mut self, builder: &mut SchemaBuilder, field: Field) { }
```
When the user want to push a new field, should take the `builder`.
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366857069
##########
arrow-schema/src/fields.rs:
##########
@@ -41,7 +41,7 @@ use std::sync::Arc;
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
-pub struct Fields(Arc<[FieldRef]>);
+pub struct Fields(Arc<Vec<FieldRef>>);
Review Comment:
This is not necessary, as a result of unsized coercion - https://doc.rust-lang.org/std/ops/trait.CoerceUnsized.html
https://docs.rs/arrow-schema/latest/arrow_schema/struct.SchemaBuilder.html provides an easy to use interface on top of this, but `Fields` also implements `FromIterator` and so can be collected into directly
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368572935
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
The proposal in this PR will add an additional pointer indirection to field access, whilst still requiring atomics for every call to push.
I think the better question is, why not use SchemaBuilder, it will be faster, less complicated, and avoid having to make changes to Fields?
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368698055
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
No, they'd just use https://docs.rs/arrow-schema/latest/arrow_schema/struct.SchemaBuilder.html#method.push
I'm suggesting not trying to make Schema support in place mutation, it isn't designed for it, SchemaBuilder is
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1370148852
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
Nothing, I am suggesting we close this PR, and you work on implementing #4908 using SchemaBuilder
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366858545
##########
arrow-schema/src/fields.rs:
##########
@@ -50,9 +50,13 @@ impl std::fmt::Debug for Fields {
}
impl Fields {
+ pub fn new(fields: Arc<Vec<FieldRef>>) -> Self {
Review Comment:
We provide `From` implementations that would supercede this
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1368564824
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
But `SchemaBuilder` also use `Vec<FieldRef>`, And `Vector` is not expanding too often.
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "fansehep (via GitHub)" <gi...@apache.org>.
fansehep commented on PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#issuecomment-1772230147
> This PR try to fix the failed CI: #4957此 PR 尝试修复失败的 CI:#4957
hope it can merge quickly.
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: support datatype struct reorder [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4962:
URL: https://github.com/apache/arrow-rs/pull/4962#discussion_r1366857818
##########
arrow-schema/src/fields.rs:
##########
@@ -83,6 +87,16 @@ impl Fields {
.zip(other.iter())
.all(|(a, b)| Arc::ptr_eq(a, b) || a.contains(b))
}
+
+ pub fn reverse(&mut self) {
+ let new_fields: Vec<FieldRef> = self.iter().rev().map(|f| f.clone() as FieldRef).collect();
+ self.0 = Arc::new(new_fields);
+ }
+
+ pub fn push(&mut self, field: Field) {
Review Comment:
This will be extremely inefficient, performing multiple allocations each time, I would recommend using https://docs.rs/arrow-schema/latest/arrow_schema/struct.SchemaBuilder.html instead
--
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-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org