You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "matthewgapp (via GitHub)" <gi...@apache.org> on 2023/09/24 19:28:32 UTC

[GitHub] [arrow-datafusion] matthewgapp opened a new pull request, #7637: take schema from record batch when creating mem table if any

matthewgapp opened a new pull request, #7637:
URL: https://github.com/apache/arrow-datafusion/pull/7637

   ## 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 #7636
   
   ## 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 these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ## 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 `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] alamb commented on a diff in pull request #7637: take schema from record batch when creating mem table if any

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #7637:
URL: https://github.com/apache/arrow-datafusion/pull/7637#discussion_r1336379786


##########
datafusion/core/src/execution/context.rs:
##########
@@ -534,6 +534,13 @@ impl SessionContext {
                 let physical = DataFrame::new(self.state(), input);
 
                 let batches: Vec<_> = physical.collect_partitioned().await?;
+                let schema = {

Review Comment:
   I agree `input.schema()` should be fixed (in the sense that in the `RecordBatch`es produced don't match the schema declared) that is the root cause of the issue 
   
   Perhaps this is related to https://github.com/apache/arrow-datafusion/issues/7636 that you filed 



-- 
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] matthewgapp commented on a diff in pull request #7637: take schema from record batch when creating mem table if any

Posted by "matthewgapp (via GitHub)" <gi...@apache.org>.
matthewgapp commented on code in PR #7637:
URL: https://github.com/apache/arrow-datafusion/pull/7637#discussion_r1338732789


##########
datafusion/core/src/execution/context.rs:
##########
@@ -534,6 +534,13 @@ impl SessionContext {
                 let physical = DataFrame::new(self.state(), input);
 
                 let batches: Vec<_> = physical.collect_partitioned().await?;
+                let schema = {

Review Comment:
   This was my initial and quick attempt at fixing #7636 before I dove deeper toward a more correct solution. I'm going to close this out since it should be replaced by https://github.com/apache/arrow-datafusion/pull/7638



-- 
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] matthewgapp commented on a diff in pull request #7637: take schema from record batch when creating mem table if any

Posted by "matthewgapp (via GitHub)" <gi...@apache.org>.
matthewgapp commented on code in PR #7637:
URL: https://github.com/apache/arrow-datafusion/pull/7637#discussion_r1335234281


##########
datafusion/core/src/execution/context.rs:
##########
@@ -534,6 +534,13 @@ impl SessionContext {
                 let physical = DataFrame::new(self.state(), input);
 
                 let batches: Vec<_> = physical.collect_partitioned().await?;
+                let schema = {

Review Comment:
   This solves the bug but feels like the input.schema() should already be correct. We shouldn't need to reach into the record batch to find out the true schema



-- 
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 a diff in pull request #7637: take schema from record batch when creating mem table if any

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #7637:
URL: https://github.com/apache/arrow-datafusion/pull/7637#discussion_r1338535329


##########
datafusion/core/src/execution/context.rs:
##########
@@ -534,6 +534,13 @@ impl SessionContext {
                 let physical = DataFrame::new(self.state(), input);
 
                 let batches: Vec<_> = physical.collect_partitioned().await?;
+                let schema = {

Review Comment:
   See also https://github.com/apache/arrow-datafusion/issues/7636#issuecomment-1737225422



-- 
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] matthewgapp closed pull request #7637: take schema from record batch when creating mem table if any

Posted by "matthewgapp (via GitHub)" <gi...@apache.org>.
matthewgapp closed pull request #7637: take schema from record batch when creating mem table if any
URL: https://github.com/apache/arrow-datafusion/pull/7637


-- 
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] matthewgapp commented on a diff in pull request #7637: take schema from record batch when creating mem table if any

Posted by "matthewgapp (via GitHub)" <gi...@apache.org>.
matthewgapp commented on code in PR #7637:
URL: https://github.com/apache/arrow-datafusion/pull/7637#discussion_r1335234317


##########
datafusion/core/src/execution/context.rs:
##########
@@ -534,6 +534,13 @@ impl SessionContext {
                 let physical = DataFrame::new(self.state(), input);
 
                 let batches: Vec<_> = physical.collect_partitioned().await?;
+                let schema = {

Review Comment:
   I haven't investigated enough to know what is the "correct" fix.



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