forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-42609][CONNECT][TESTS] Add tests for grouping() and grouping_i…
…d() functions ### What changes were proposed in this pull request? Add tests for grouping() and grouping_id() functions. ### Why are the changes needed? Improve testing coverage. ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? UT Closes apache#40259 from amaliujia/rw-test-grouping-groupingset. Authored-by: Rui Wang <rui.wang@databricks.com> Signed-off-by: Ruifeng Zheng <ruifengz@apache.org> (cherry picked from commit 6874fd1) Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
- Loading branch information
1 parent
530fb2c
commit 3d09b40
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ct/common/src/test/resources/query-tests/explain-results/grouping_and_grouping_id.explain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Aggregate [a#0, b#0, spark_grouping_id#0L], [a#0, b#0, cast((shiftright(spark_grouping_id#0L, 1) & 1) as tinyint) AS grouping(a)#0, cast((shiftright(spark_grouping_id#0L, 0) & 1) as tinyint) AS grouping(b)#0, spark_grouping_id#0L AS grouping_id(a, b)#0L] | ||
+- Expand [[id#0L, a#0, b#0, a#0, b#0, 0], [id#0L, a#0, b#0, a#0, null, 1], [id#0L, a#0, b#0, null, b#0, 2], [id#0L, a#0, b#0, null, null, 3]], [id#0L, a#0, b#0, a#0, b#0, spark_grouping_id#0L] | ||
+- Project [id#0L, a#0, b#0, a#0 AS a#0, b#0 AS b#0] | ||
+- LocalRelation <empty>, [id#0L, a#0, b#0] |
57 changes: 57 additions & 0 deletions
57
...ector/connect/common/src/test/resources/query-tests/queries/grouping_and_grouping_id.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"common": { | ||
"planId": "1" | ||
}, | ||
"aggregate": { | ||
"input": { | ||
"common": { | ||
"planId": "0" | ||
}, | ||
"localRelation": { | ||
"schema": "struct\u003cid:bigint,a:int,b:double\u003e" | ||
} | ||
}, | ||
"groupType": "GROUP_TYPE_CUBE", | ||
"groupingExpressions": [{ | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "a" | ||
} | ||
}, { | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "b" | ||
} | ||
}], | ||
"aggregateExpressions": [{ | ||
"unresolvedFunction": { | ||
"functionName": "grouping", | ||
"arguments": [{ | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "a" | ||
} | ||
}] | ||
} | ||
}, { | ||
"unresolvedFunction": { | ||
"functionName": "grouping", | ||
"arguments": [{ | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "b" | ||
} | ||
}] | ||
} | ||
}, { | ||
"unresolvedFunction": { | ||
"functionName": "grouping_id", | ||
"arguments": [{ | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "a" | ||
} | ||
}, { | ||
"unresolvedAttribute": { | ||
"unparsedIdentifier": "b" | ||
} | ||
}] | ||
} | ||
}] | ||
} | ||
} |
Binary file added
BIN
+138 Bytes
.../connect/common/src/test/resources/query-tests/queries/grouping_and_grouping_id.proto.bin
Binary file not shown.