GitHub user stanzhai opened a pull request: https://github.com/apache/spark/pull/16874
[SPARK-19509][SQL][branch-2.1]Fix a NPE problem in grouping sets when using an empty column ## What changes were proposed in this pull request? If a column of a table is all null values, the follow SQL will throw an NPE: `select count(1) from test group by e grouping sets(e)`. The reason is that when transformUp a `GroupingSets` in `ResolveGroupingAnalytics` it uses a `nullBitmask` to set an attribute with null ability, the nullable attribute may be modified. This pr just set all attribute's null ability to `true` in group by expressions to fix the problem. The pr #15484 in master branch has fixed this problem. ## How was this patch tested? Test with Hive in my environment. You can merge this pull request into a Git repository by running: $ git pull https://github.com/stanzhai/spark fix-grouping-sets Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16874.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16874 ---- commit 3690cb29a3c15903dd6290502fb736daa99157b4 Author: Stan Zhai <zhaishi...@haizhi.com> Date: 2017-02-09T13:22:02Z fix a NPE issue of grouping sets ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org