Skip to Content

Grouping function in HANA

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 31, 2017 at 04:35 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • May 31, 2017 at 05:18 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Already did :)

      Looks like a docu-bug indeed.

  • May 31, 2017 at 02:48 PM

    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

    Add comment
    10|10000 characters needed characters exceeded