Imri Paran b92b950060
Fix 18434: feat(statistics-profiler): use statistics tables to profile trino tables (#18433)
* feat(statistics-profiler): use statistics tables to profile trino tables

- implemented the collaborative root class
- added the "useStatistics" profiler parameter
- added the "supportsStatistics" database connection property
- implemented the ProfilerWithStatistics and StoredStatisticsSource to add this functionality to specific profilers
- implemented TrinoStoredStatisticsSource for specific trino statistics logic

* added ABC to terminal classes in collaborative root

* fixed docstring for TestSuiteInterface

* reverted unintended changes

* typo
2024-11-07 18:37:31 +01:00

24 lines
799 B
Python

def merge(source: dict, destination: dict):
"""
Merge source dictionary into destination dictionary recursively in place.
Examples
# >>> a = { 'first' : { 'all_rows' : { 'pass' : 'dog', 'number' : '1' } } }
# >>> b = { 'first' : { 'all_rows' : { 'fail' : 'cat', 'number' : '5' } } }
# >>> merge(b, a) == { 'first' : { 'all_rows' : { 'pass' : 'dog', 'fail' : 'cat', 'number' : '5' } } }
True
Args:
source (dict): Source dictionary
destination (dict): Destination dictionary
"""
for key, value in source.items():
if isinstance(value, dict):
# get node or create one
node = destination.setdefault(key, {})
merge(value, node)
else:
destination[key] = value
return destination