This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new bec88a6 [SPARK-34269][SQL][TESTS][FOLLOWUP] Test a subquery with view
in aggregate's grouping expression
bec88a6 is described below
commit bec88a66bdce7fae6ed71c834297ec081fd86b58
Author: Terry Kim <[email protected]>
AuthorDate: Sat Jan 30 17:07:40 2021 -0800
[SPARK-34269][SQL][TESTS][FOLLOWUP] Test a subquery with view in
aggregate's grouping expression
### What changes were proposed in this pull request?
This PR is a follow-up to #31368 to add a test case that has a subquery
with "view" in aggregate's grouping expression. The existing test tests a
subquery with dataframe's temp view, so it doesn't contain a `View` node.
### Why are the changes needed?
To increase the test coverage.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Added a new test.
Closes #31352 from imback82/grouping_expr.
Authored-by: Terry Kim <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../src/test/scala/org/apache/spark/sql/SubquerySuite.scala | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
index 73b2349..629a06b 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
@@ -512,6 +512,18 @@ class SubquerySuite extends QueryTest with
SharedSparkSession with AdaptiveSpark
Row(1, null) :: Row(2, 6.0) :: Row(3, 2.0) :: Row(null, null) :: Row(6,
null) :: Nil)
}
+ test("SPARK-34269: correlated subquery with view in aggregate's grouping
expression") {
+ withTable("tr") {
+ withView("vr") {
+ r.write.saveAsTable("tr")
+ sql("create view vr as select * from tr")
+ checkAnswer(
+ sql("select a, (select sum(d) from vr where a = c) sum_d from l l1
group by 1, 2"),
+ Row(1, null) :: Row(2, 6.0) :: Row(3, 2.0) :: Row(null, null) ::
Row(6, null) :: Nil)
+ }
+ }
+ }
+
test("SPARK-18504 extra GROUP BY column in correlated scalar subquery is not
permitted") {
withTempView("t") {
Seq((1, 1), (1, 2)).toDF("c1", "c2").createOrReplaceTempView("t")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]