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

[GitHub] [arrow-datafusion] jiangzhx opened a new pull request, #5686: remove unnecessary logic on sql count wildcard

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

   # 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.
   -->
   now the count wildcard login already move to Analyzer #5671
   so remove duplicate the logic in SQL planning.
   
   Closes #.
   
   # Rationale for this change
   related issues: https://github.com/apache/arrow-datafusion/issues/5473
   related PR: https://github.com/apache/arrow-datafusion/pull/5671
   <!--
    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] jiangzhx commented on pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx commented on PR #5686:
URL: https://github.com/apache/arrow-datafusion/pull/5686#issuecomment-1486618404

   > I am sorry for the delay in review. I will try and find more time to review this carefully tomorrow but initially I am surprised that says it removes duplicated logic adds more code than it removes 🤔
   
   
   Because when I started to remove the duplicate logic between the DataFrame API and SQL planning, I found that count_wildcard_rule did not cover all scenarios, such as union, window, etc.
   Currently, these test cases are all based on SQL, so they are not discovered when running cargo test.
   After I covered more scenarios for count_wildcard_rule, it resulted in more code added than removed. 
   


-- 
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] jiangzhx commented on pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx commented on PR #5686:
URL: https://github.com/apache/arrow-datafusion/pull/5686#issuecomment-1502758910

   SQL test case Regression in 22.0.0 with count(*) on window


-- 
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 #5686: remove duplicate the logic b/w DataFrame API and SQL planning

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

   > Because when I started to remove the duplicate logic between the DataFrame API and SQL planning, I found that count_wildcard_rule did not cover all scenarios, such as union, window, etc.
   
   This makes sense -- thank you for the explanation @jiangzhx 
   
   Can you please add DataFrame tests the relevant behavior (mostly so that we don't break it in the future by accident)


-- 
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] jiangzhx commented on pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx commented on PR #5686:
URL: https://github.com/apache/arrow-datafusion/pull/5686#issuecomment-1486495590

   > I am sorry for the delay in review. I will try and find more time to review this carefully tomorrow but initially I am surprised that says it removes duplicated logic adds more code than it removes 🤔
   
   A large number of test cases are based on SQL, 
   like window,union scenarios are not covered dataframe api. 
   also the first version of count_wildcard_rule did not cover it.
   When I remove the duplicate logic between the DataFrame API and SQL planning, all the problems are exposed.
   
    


-- 
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] remove duplicate the logic b/w DataFrame API and SQL planning [arrow-datafusion]

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

   Since this has been open for more than a year, closing it down. Feel free to reopen if/when you keep working on 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] alamb commented on pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning

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

   Marking as draft to signify this PR has feedback and is not waiting for another review at the moment. 


-- 
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] jiangzhx commented on pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx commented on PR #5686:
URL: https://github.com/apache/arrow-datafusion/pull/5686#issuecomment-1488168803

   > > Because when I started to remove the duplicate logic between the DataFrame API and SQL planning, I found that count_wildcard_rule did not cover all scenarios, such as union, window, etc.
   > 
   > This makes sense -- thank you for the explanation @jiangzhx
   > 
   > Can you please add DataFrame tests the relevant behavior (mostly so that we don't break it in the future by accident)
   
   i add some testcase in tests/dataframe.rs
   
   - test_count_wildcard_on_sort
   - test_count_wildcard_on_where_exist
   - test_count_wildcard_on_window
   - test_count_wildcard_on_aggregate


-- 
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] remove duplicate the logic b/w DataFrame API and SQL planning [arrow-datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning
URL: https://github.com/apache/arrow-datafusion/pull/5686


-- 
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] jiangzhx commented on pull request #5686: remove duplicate the logic b/w DataFrame API and SQL planning

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx commented on PR #5686:
URL: https://github.com/apache/arrow-datafusion/pull/5686#issuecomment-1508260655

   split this pr in two part.
   
   1. #6010 
   2. remove duplicate the logic b/w DataFrame API and SQL planning 


-- 
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 #5686: remove duplicate the logic b/w DataFrame API and SQL planning

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


##########
datafusion/common/src/dfschema.rs:
##########
@@ -630,9 +630,9 @@ impl ExprSchema for DFSchema {
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct DFField {
     /// Optional qualifier (usually a table or relation name)
-    qualifier: Option<OwnedTableReference>,
+    pub qualifier: Option<OwnedTableReference>,

Review Comment:
   Can you please explain the rationale for this change?



##########
datafusion/core/tests/sql/mod.rs:
##########
@@ -1161,15 +1161,6 @@ async fn try_execute_to_batches(
 /// Execute query and return results as a Vec of RecordBatches
 async fn execute_to_batches(ctx: &SessionContext, sql: &str) -> Vec<RecordBatch> {
     let df = ctx.sql(sql).await.unwrap();
-
-    // We are not really interested in the direct output of optimized_logical_plan

Review Comment:
   Why was this removed?



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