What are the best practices for sorting tables with sections?

When you have a table with sections, the sections denote a hierarchy for instance:

Name                             Corners                     Perimeter
- Standard Shapes                 7                          105
    Rectangle A                   4                           25
    Triangle B                    3                           23
    Circle C                      0                           57
+ Red Shapes                     34                          235
+ Blue Shapes                    24                          145

What would you expect the table header sort to do? Or what are some good design patterns to implement a sort also for the bottom level rows?