You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "comphead (via GitHub)" <gi...@apache.org> on 2023/06/27 15:25:37 UTC

[GitHub] [arrow-datafusion] comphead commented on pull request #6722: Fix inserting into a table with non-nullable columns

comphead commented on PR #6722:
URL: https://github.com/apache/arrow-datafusion/pull/6722#issuecomment-1609745250

   > > Thanks. Functionally wise it works as expected, I still think we can reuse `Schema::equivalent_names_and_types` and not creating a separate method. So it can be replaced something like
   > > ```
   > > fn foo(schema: DFSchema, other: DFSchema) -> Result<bool> {
   > >     SchemaRef::from(schema).equivalent_names_and_types(SchemaRef::from(other))
   > > }
   > > ```
   > 
   > Perhaps the best way is to have upstream support for this similar functionality.
   
   ideally yes. but I think upstream will be resisting, saying `.contains` method is enough. I'm ok with this PR with minor thing about code duplication. we will have to maintenance this trait and method and have test coverage for it, which currently is missing. @alamb I'll leave it to you
   
   Basically this wrapper should do the trick
   ```
   pub trait SchemaExt {
       /// This is a specialized version of Eq that ignores differences
       /// in nullability and metadata.
       ///
       /// It works the same as [`DFSchema::equivalent_names_and_types`].
       fn equivalent_names_and_types(&self, other: &Self) -> bool;
   }
   impl SchemaExt for Schema {
       fn equivalent_names_and_types(&self, other: &Self) -> bool {
           DFSchema::from(&self).equivalent_names_and_types(&DFSchema::from(other))
       }
   }
   ```
   


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