Skip to Content
0

Grouping function in HANA

May 30, 2017 at 04:58 PM

114

avatar image

Hi

Am I getting correct result in Grouping function ? My understanding is , I should have got 0 instead of 1 and vice versa . I am in SPS 12.

capture.png (17.3 kB)
SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Lars Breddemann
May 31, 2017 at 04:35 AM
0

Based on the documentation I'd say this is a bug.

The GROUPING() function currently (122.08 and 210.11) seems to return 1 for columns that are _not_ used in the grouping and 0 for columns used in the grouping. So, it seems to be the exact opposite of what the documentation says.

Share
10 |10000 characters needed characters left characters exceeded
Florian Pfeffer
May 31, 2017 at 05:18 AM
1

According to the GROUPING function documentation I would have the same understanding than you, but the result values are vice versa. 0 inidicates that no aggregation is done over the column, 1 inidicates that an aggregation is done over the column.

As I did not found any note saying that this is a bug, the behavior is the same on a HANA 2.0 SPS01 system, the (old) SAP HANA Academy video shows the same behavior and the similiar functions of competitor databases (I don't say a name, you know which ones I mean :-)) have also the same behavior, I think that the documentation is misleading.

But as I have no internal insights I only can assume this.

Maybe @lars.breddemann can add his knowlegde here.

Best Regards,
Florian

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Already did :)

Looks like a docu-bug indeed.

1
Anindya Bose May 31, 2017 at 02:48 PM
0

Thanks Florian and Lars for the confirmation . Is it not possible mark "Helpful Answer" once I accept reply from another person as "Correct Answer" ? :(

I have another thread which probably need some expert's help . Please help here

Best Regards

Anindya

Share
10 |10000 characters needed characters left characters exceeded