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/04/10 12:44:51 UTC

[GitHub] [arrow-datafusion] Ted-Jiang opened a new pull request, #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Ted-Jiang opened a new pull request, #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192

   # 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 #.
   
    # 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 `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] yjshen merged pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

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


-- 
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] liukun4515 commented on pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1096498971

   I think we should add the function in https://github.com/apache/arrow-datafusion/blob/28a6da3d2d175eb9d2f4ff8a6ea58e7c22dae97c/ballista/rust/core/proto/datafusion.proto#L203 proto


-- 
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 pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1097510156

   > I think we should add the function in
   > 
   > https://github.com/apache/arrow-datafusion/blob/28a6da3d2d175eb9d2f4ff8a6ea58e7c22dae97c/ballista/rust/core/proto/datafusion.proto#L203
   > 
   > proto
   
   Yes , but there is some issue in #2221 
   


-- 
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 commented on a diff in pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
yjshen commented on code in PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#discussion_r846936268


##########
ballista/rust/client/src/context.rs:
##########
@@ -718,6 +719,199 @@ mod tests {
             )
             .await
             .unwrap();
+
+        let df = context.sql("select min(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| MIN(test.id) |",
+            "+--------------+",
+            "| 0            |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select max(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| MAX(test.id) |",
+            "+--------------+",
+            "| 7            |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select SUM(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| SUM(test.id) |",
+            "+--------------+",
+            "| 28           |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select AVG(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| AVG(test.id) |",
+            "+--------------+",
+            "| 3.5          |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select COUNT(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+----------------+",
+            "| COUNT(test.id) |",
+            "+----------------+",
+            "| 8              |",
+            "+----------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select approx_distinct(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+-------------------------+",
+            "| APPROXDISTINCT(test.id) |",
+            "+-------------------------+",
+            "| 8                       |",
+            "+-------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select ARRAY_AGG(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------------+",
+            "| ARRAYAGG(test.id)        |",
+            "+--------------------------+",
+            "| [4, 5, 6, 7, 2, 3, 0, 1] |",
+            "+--------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select VAR(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+-------------------+",
+            "| VARIANCE(test.id) |",
+            "+-------------------+",
+            "| 6.000000000000001 |",
+            "+-------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select VAR_POP(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+----------------------+",
+            "| VARIANCEPOP(test.id) |",
+            "+----------------------+",
+            "| 5.250000000000001    |",
+            "+----------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select VAR_SAMP(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+-------------------+",
+            "| VARIANCE(test.id) |",
+            "+-------------------+",
+            "| 6.000000000000001 |",
+            "+-------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select STDDEV(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------+",
+            "| STDDEV(test.id)    |",
+            "+--------------------+",
+            "| 2.4494897427831783 |",
+            "+--------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select STDDEV_SAMP(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------+",
+            "| STDDEV(test.id)    |",
+            "+--------------------+",
+            "| 2.4494897427831783 |",
+            "+--------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select COVAR(id, tinyint_col) from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------------------------+",
+            "| COVARIANCE(test.id,test.tinyint_col) |",
+            "+--------------------------------------+",
+            "| 0.28571428571428586                  |",
+            "+--------------------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select CORR(id, tinyint_col) from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+---------------------------------------+",
+            "| CORRELATION(test.id,test.tinyint_col) |",
+            "+---------------------------------------+",
+            "| 0.21821789023599245                   |",
+            "+---------------------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select approx_percentile_cont_with_weight(\"id\", 2, 0.5) from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+---------------------------------------------------------------+",
+            "| APPROXPERCENTILECONTWITHWEIGHT(test.id,Int64(2),Float64(0.5)) |",

Review Comment:
   🤔 hard to read a little bit.



-- 
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 pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1094495108

   @houqp @yjshen plz take a look.


-- 
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 diff in pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on code in PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#discussion_r849028186


##########
ballista/rust/client/src/context.rs:
##########
@@ -718,6 +719,199 @@ mod tests {
             )
             .await
             .unwrap();
+
+        let df = context.sql("select min(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| MIN(test.id) |",
+            "+--------------+",
+            "| 0            |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select max(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| MAX(test.id) |",
+            "+--------------+",
+            "| 7            |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select SUM(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| SUM(test.id) |",
+            "+--------------+",
+            "| 28           |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select AVG(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------+",
+            "| AVG(test.id) |",
+            "+--------------+",
+            "| 3.5          |",
+            "+--------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select COUNT(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+----------------+",
+            "| COUNT(test.id) |",
+            "+----------------+",
+            "| 8              |",
+            "+----------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select approx_distinct(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+-------------------------+",
+            "| APPROXDISTINCT(test.id) |",
+            "+-------------------------+",
+            "| 8                       |",
+            "+-------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select ARRAY_AGG(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------------+",
+            "| ARRAYAGG(test.id)        |",
+            "+--------------------------+",
+            "| [4, 5, 6, 7, 2, 3, 0, 1] |",
+            "+--------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context.sql("select VAR(\"id\") from test").await.unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+-------------------+",
+            "| VARIANCE(test.id) |",
+            "+-------------------+",
+            "| 6.000000000000001 |",
+            "+-------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select VAR_POP(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+----------------------+",
+            "| VARIANCEPOP(test.id) |",
+            "+----------------------+",
+            "| 5.250000000000001    |",
+            "+----------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select VAR_SAMP(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+-------------------+",
+            "| VARIANCE(test.id) |",
+            "+-------------------+",
+            "| 6.000000000000001 |",
+            "+-------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select STDDEV(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------+",
+            "| STDDEV(test.id)    |",
+            "+--------------------+",
+            "| 2.4494897427831783 |",
+            "+--------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select STDDEV_SAMP(\"id\") from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------+",
+            "| STDDEV(test.id)    |",
+            "+--------------------+",
+            "| 2.4494897427831783 |",
+            "+--------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select COVAR(id, tinyint_col) from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+--------------------------------------+",
+            "| COVARIANCE(test.id,test.tinyint_col) |",
+            "+--------------------------------------+",
+            "| 0.28571428571428586                  |",
+            "+--------------------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select CORR(id, tinyint_col) from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+---------------------------------------+",
+            "| CORRELATION(test.id,test.tinyint_col) |",
+            "+---------------------------------------+",
+            "| 0.21821789023599245                   |",
+            "+---------------------------------------+",
+        ];
+        assert_result_eq(expected, &*res);
+
+        let df = context
+            .sql("select approx_percentile_cont_with_weight(\"id\", 2, 0.5) from test")
+            .await
+            .unwrap();
+        let res = df.collect().await.unwrap();
+        let expected = vec![
+            "+---------------------------------------------------------------+",
+            "| APPROXPERCENTILECONTWITHWEIGHT(test.id,Int64(2),Float64(0.5)) |",

Review Comment:
   I thinks this name is align with proto file, it try to rewrite `debug` or `display` of this struct , it not works😂



-- 
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 pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1097509398

   > 
   
   There is some issue in #2221 


-- 
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 pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1097508664

   > I think we should add the function in
   > 
   > https://github.com/apache/arrow-datafusion/blob/28a6da3d2d175eb9d2f4ff8a6ea58e7c22dae97c/ballista/rust/core/proto/datafusion.proto#L203
   > 
   > proto
   
   


-- 
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 closed pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang closed pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT 
URL: https://github.com/apache/arrow-datafusion/pull/2192


-- 
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 pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
Ted-Jiang commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1097509602

   > 
   
   There is some issue in https://github.com/apache/arrow-datafusion/issues/2221


-- 
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] liukun4515 commented on pull request #2192: [Ballista] Enable ApproxPercentileWithWeight in Ballista and fill UT

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on PR #2192:
URL: https://github.com/apache/arrow-datafusion/pull/2192#issuecomment-1098076947

   > > I think we should add the function in
   > > https://github.com/apache/arrow-datafusion/blob/28a6da3d2d175eb9d2f4ff8a6ea58e7c22dae97c/ballista/rust/core/proto/datafusion.proto#L203
   > > 
   > > proto
   > 
   > Yes , but there is some issue in #2221 but in df it just rewrite `APPROX_MEDIAN` to `APPROX_PERCENTILE(0.5)`
   
   My thought is that we should add 
   ```
   APPROX_PERCENTILE_CONT_WITH_WEIGHT = 16;
   ```
   behind the  `APPROX_MEDIAN=15; ` in the proto file.


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