HyukjinKwon commented on code in PR #36773:
URL: https://github.com/apache/spark/pull/36773#discussion_r916569488


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -1685,6 +1709,42 @@ class JDBCV2Suite extends QueryTest with 
SharedSparkSession with ExplainSuiteHel
     checkAnswer(df2, Seq(Row(1d), Row(1d), Row(null)))
   }
 
+  test("scan with aggregate push-down: linear regression functions with filter 
and group by") {

Review Comment:
   Hm, this test seems flaky:
   
   ```
   org.scalatest.exceptions.TestFailedException: "== Parsed Logical Plan ==
   'Aggregate ['DePt], [unresolvedalias('REGR_INTERCEPT('bonus, 'bonus), None), 
unresolvedalias('REGR_R2('bonus, 'bonus), None), 
unresolvedalias('REGR_SLOPE('bonus, 'bonus), None), 
unresolvedalias('REGR_SXY('bonus, 'bonus), None)]
   +- 'Filter ('dept > 0)
      +- 'UnresolvedRelation [h2, test, employee], [], false
   
   == Analyzed Logical Plan ==
   regr_intercept(bonus, bonus): double, regr_r2(bonus, bonus): double, 
regr_slope(bonus, bonus): double, regr_sxy(bonus, bonus): double
   Aggregate [DePt#x], [regr_intercept(bonus#x, bonus#x) AS 
regr_intercept(bonus, bonus)#x, regr_r2(bonus#x, bonus#x) AS regr_r2(bonus, 
bonus)#x, regr_slope(bonus#x, bonus#x) AS regr_slope(bonus, bonus)#x, 
regr_sxy(bonus#x, bonus#x) AS regr_sxy(bonus, bonus)#x]
   +- Filter (dept#x > 0)
      +- SubqueryAlias h2.test.employee
         +- RelationV2[DEPT#x, NAME#x, SALARY#x, BONUS#x, IS_MANAGER#x] 
h2.test.employee test.employee
   
   == Optimized Logical Plan ==
   Project [REGR_INTERCEPT(BONUS, BONUS)#x AS regr_intercept(bonus#x, 
bonus#x)#x AS regr_intercept(bonus, bonus)#x, REGR_R2(BONUS, BONUS)#x AS 
regr_r2(bonus#x, bonus#x)#x AS regr_r2(bonus, bonus)#x, REGR_SLOPE(BONUS, 
BONUS)#x AS regr_slope(bonus#x, bonus#x)#x AS regr_slope(bonus, bonus)#x, 
REGR_SXY(BONUS, BONUS)#x AS regr_sxy(bonus#x, bonus#x)#x AS regr_sxy(bonus, 
bonus)#x]
   +- RelationV2[DEPT#x, REGR_INTERCEPT(BONUS, BONUS)#x, REGR_R2(BONUS, 
BONUS)#x, REGR_SLOPE(BONUS, BONUS)#x, REGR_SXY(BONUS, BONUS)#x] test.employee
   
   == Physical Plan ==
   *(1) Project [REGR_INTERCEPT(BONUS, BONUS)#x AS regr_intercept(bonus#x, 
bonus#x)#x AS regr_intercept(bonus, bonus)#x, REGR_R2(BONUS, BONUS)#x AS 
regr_r2(bonus#x, bonus#x)#x AS regr_r2(bonus, bonus)#x, REGR_SLOPE(BONUS, 
BONUS)#x AS regr_slope(bonus#x, bonus#x)#x AS regr_slope(bonus, bonus)#x, 
REGR_SXY(BONUS, BONUS)#x AS regr_sxy(bonus#x, bonus#x)#x AS regr_sxy(bonus, 
bonus)#x]
   +- *(1) Scan 
org.apache.spark.sql.execution.datasources.v2.jdbc.JDBCScan$$anon$1@6cbb46ad 
[DEPT#x,REGR_INTERCEPT(BONUS, BONUS)#x,REGR_R2(BONUS, 
BONUS)#x,REGR_SLOPE(BONUS, BONUS)#x,REGR_SXY(BONUS, BONUS)#x] PushedAggregates: 
[REGR_INTERCEPT(BONUS, BONUS), REGR_R2(BONUS, BONUS), REGR_SLOPE(BONUS, BONUS), 
REGR_SXY(BONUS, BONUS)], PushedFilters: [DEPT IS NOT NULL, DEPT > 0], 
PushedGroupByExpressions: [DEPT], ReadSchema: 
struct<DEPT:int,REGR_INTERCEPT(BONUS, BONUS):double,REGR_R2(BONUS, 
BONUS):double,REGR_SLOPE(BONUS, BONUS):double,REGR_SXY(BONUS, BONUS):double>
   
   " did not contain " PushedAggregates: [REGR_INTERCEPT(BONUS, BONUS), 
REGR_R2(BONUS, BONUS), REGR_SLOPE(BONUS, BONUS), REGR_SXY(BONUS, B..., 
PushedFilters: [DEPT IS NOT NULL, DEPT > 0], PushedGroupByExpressions: [DEPT], "
   ```
   
   https://github.com/apache/spark/runs/7247205123



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to