You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/28 19:11:52 UTC

[GitHub] [arrow-datafusion] WinkerDu opened a new pull request #2108: fix df union all bug

WinkerDu opened a new pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108


   # 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 #1818.
   
    # 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.  
   -->
   Comment later.
   
   # 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.
   -->
   Comment later.
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   No.
   <!--
   If there are any breaking changes to public APIs, please add the `api 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



[GitHub] [arrow-datafusion] WinkerDu commented on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1086470970


   cc @alamb @yjshen @xudong963 
   PTAL, thanks


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



[GitHub] [arrow-datafusion] Ted-Jiang commented on a change in pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on a change in pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#discussion_r837294373



##########
File path: datafusion-common/src/dfschema.rs
##########
@@ -281,6 +281,14 @@ impl DFSchema {
             .all(|(dffield, arrowfield)| dffield.name() == arrowfield.name())
     }
 
+    /// Check to see if df field data types in df schema matches with input df schema
+    pub fn matches_arrow_schema_with_type(&self, df_schema: &DFSchema) -> bool {
+        self.fields
+            .iter()

Review comment:
       in postgresql union support  type cast like below
   ```
   postgres=# select '1.2' as a union select 2.3 as b union select 3 as b ;
     a
   -----
    2.3
      3
    1.2
   (3 rows)
   
   postgres=# \gdesc
    Column |  Type
   --------+---------
    a      | numeric
   (1 row)
   ```
   
   Maybe we can open a ticket support 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



[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#discussion_r839422630



##########
File path: datafusion/common/src/dfschema.rs
##########
@@ -281,6 +282,18 @@ impl DFSchema {
             .all(|(dffield, arrowfield)| dffield.name() == arrowfield.name())
     }
 
+    /// Check to see if fields in 2 Arrow schemas are compatible
+    pub fn check_arrow_schema_type_compatible(&self, arrow_schema: &Schema) -> bool {
+        let self_arrow_schema: Schema = self.into();
+        self_arrow_schema
+            .fields()
+            .iter()
+            .zip(arrow_schema.fields().iter())
+            .all(|(l_field, r_field)| {
+                can_cast_types(r_field.data_type(), l_field.data_type())

Review comment:
       If this would return a `Result<()>` we could return a more specific error of the type mismatch here (and pass it to the user). 




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



[GitHub] [arrow-datafusion] WinkerDu commented on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1086470432


   @Dandandan PTAL, thanks


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



[GitHub] [arrow-datafusion] WinkerDu commented on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1081650018


   > Thanks @WinkerDu ❤️! would you mind fix the conflicts?
   
   OK, ASAP 


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



[GitHub] [arrow-datafusion] alamb commented on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1086613228


   Thank you for sticking with this @WinkerDu  -- 👍 


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



[GitHub] [arrow-datafusion] alamb edited a comment on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
alamb edited a comment on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1086613228


   Thank you for sticking with this @WinkerDu  -- 👍  and thank you @Ted-Jiang  for the assist


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



[GitHub] [arrow-datafusion] yjshen merged pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
yjshen merged pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108


   


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



[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#discussion_r839422630



##########
File path: datafusion/common/src/dfschema.rs
##########
@@ -281,6 +282,18 @@ impl DFSchema {
             .all(|(dffield, arrowfield)| dffield.name() == arrowfield.name())
     }
 
+    /// Check to see if fields in 2 Arrow schemas are compatible
+    pub fn check_arrow_schema_type_compatible(&self, arrow_schema: &Schema) -> bool {
+        let self_arrow_schema: Schema = self.into();
+        self_arrow_schema
+            .fields()
+            .iter()
+            .zip(arrow_schema.fields().iter())
+            .all(|(l_field, r_field)| {
+                can_cast_types(r_field.data_type(), l_field.data_type())

Review comment:
       If this would return a Result<()> we could return a more specific error of the type mismatch here (and pass it to the user). 




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



[GitHub] [arrow-datafusion] WinkerDu commented on a change in pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on a change in pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#discussion_r840199054



##########
File path: datafusion/common/src/dfschema.rs
##########
@@ -281,6 +282,18 @@ impl DFSchema {
             .all(|(dffield, arrowfield)| dffield.name() == arrowfield.name())
     }
 
+    /// Check to see if fields in 2 Arrow schemas are compatible
+    pub fn check_arrow_schema_type_compatible(&self, arrow_schema: &Schema) -> bool {
+        let self_arrow_schema: Schema = self.into();
+        self_arrow_schema
+            .fields()
+            .iter()
+            .zip(arrow_schema.fields().iter())
+            .all(|(l_field, r_field)| {
+                can_cast_types(r_field.data_type(), l_field.data_type())

Review comment:
       @Dandandan OK, I'll fix 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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] WinkerDu commented on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1081134759


   cc @xudong963 @alamb PTAL


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



[GitHub] [arrow-datafusion] WinkerDu commented on pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#issuecomment-1083509253


   cc @xudong963  @Ted-Jiang 
   PTAL, thanks.


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



[GitHub] [arrow-datafusion] WinkerDu commented on a change in pull request #2108: fix df union all bug

Posted by GitBox <gi...@apache.org>.
WinkerDu commented on a change in pull request #2108:
URL: https://github.com/apache/arrow-datafusion/pull/2108#discussion_r837357519



##########
File path: datafusion-common/src/dfschema.rs
##########
@@ -281,6 +281,14 @@ impl DFSchema {
             .all(|(dffield, arrowfield)| dffield.name() == arrowfield.name())
     }
 
+    /// Check to see if df field data types in df schema matches with input df schema
+    pub fn matches_arrow_schema_with_type(&self, df_schema: &DFSchema) -> bool {
+        self.fields
+            .iter()

Review comment:
       @Ted-Jiang Agree with that.
   Maybe we can solve `Alias` issue first, than open a new issue to fully discuss data type compatible cast?




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