tp: implement tree partitioning by group algorithm

This CL implements an algorithm to partition tree into a forest based
on a grouping key and preserving the structure of the original tree.

This algorithm will be used to prevent double-counting for heap graphs
and also might be generally useful in the future for critical path
work.

Change-Id: I0f0e89227d7da53f2b7bb89c4dfc9ba070ff872b
diff --git a/Android.bp b/Android.bp
index 3832040..dce7dbc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12189,6 +12189,7 @@
         "src/trace_processor/perfetto_sql/intrinsics/functions/pprof_functions.cc",
         "src/trace_processor/perfetto_sql/intrinsics/functions/sqlite3_str_split.cc",
         "src/trace_processor/perfetto_sql/intrinsics/functions/stack_functions.cc",
+        "src/trace_processor/perfetto_sql/intrinsics/functions/structural_tree_partition.cc",
         "src/trace_processor/perfetto_sql/intrinsics/functions/to_ftrace.cc",
     ],
 }
@@ -12408,6 +12409,7 @@
         "src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/thread_states.sql",
         "src/trace_processor/perfetto_sql/stdlib/deprecated/v42/common/timestamps.sql",
         "src/trace_processor/perfetto_sql/stdlib/graphs/dominator_tree.sql",
+        "src/trace_processor/perfetto_sql/stdlib/graphs/partition.sql",
         "src/trace_processor/perfetto_sql/stdlib/graphs/search.sql",
         "src/trace_processor/perfetto_sql/stdlib/intervals/intersect.sql",
         "src/trace_processor/perfetto_sql/stdlib/intervals/overlap.sql",