From ec6b540dca7e081e38616c58ae9500556ba8c7d4 Mon Sep 17 00:00:00 2001 From: Or Avidov Date: Wed, 29 Nov 2023 20:25:44 +0200 Subject: [PATCH] Perf improvements and debug logs (#622) * Perf improvements and debug logs * Perf improvements and debug logs * Removed test status check before calling original test materialization * Update macros/edr/materializations/test/test.sql --------- Co-authored-by: Itamar Hartstein --- macros/edr/materializations/test/test.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/macros/edr/materializations/test/test.sql b/macros/edr/materializations/test/test.sql index f3bf72c80..782bd80c3 100644 --- a/macros/edr/materializations/test/test.sql +++ b/macros/edr/materializations/test/test.sql @@ -102,20 +102,27 @@ {% do return(materialization_macro()) %} {% endif %} + {% set test_unique_id = model.get('unique_id') %} + {% do elementary.debug_log(test_unique_id ~ ": starting test materialization hook") %} {% if elementary.get_config_var("tests_use_temp_tables") %} {% set temp_table_sql = elementary.create_test_result_temp_table() %} {% do context.update({"sql": temp_table_sql}) %} + {% do elementary.debug_log(test_unique_id ~ ": created test temp table") %} {% endif %} {% set flattened_test = elementary.flatten_test(model) %} + {% do elementary.debug_log(test_unique_id ~ ": flattened test node") %} {% set test_type_handler = elementary.get_test_type_handler(flattened_test) %} {% set result = test_type_handler(flattened_test, materialization_macro) %} + {% do elementary.debug_log(test_unique_id ~ ": handler called by test type - " ~ elementary.get_test_type(flattened_test)) %} {% if elementary.get_config_var("calculate_failed_count") %} {% set failed_row_count = elementary.get_failed_row_count(flattened_test) %} {% if failed_row_count is not none %} {% do elementary.get_cache("elementary_test_failed_row_counts").update({model.unique_id: failed_row_count}) %} + {% do elementary.debug_log(test_unique_id ~ ": calculated failed row count") %} {% endif %} {% endif %} + {% do elementary.debug_log(test_unique_id ~ ": finished test materialization hook") %} {% do return(result) %} {% endmacro %}