Commit c273133
perf(ingestion): pre-compile regex patterns in hot paths
Extends Rob's regex optimization pattern (#15463) to additional ingestion hot paths:
1. **SqlQueriesSource**: Pre-compile temp_table_patterns using @cached_property
- Called for every table during query processing
- Eliminates repeated regex compilation overhead
2. **BigQuery**: Pre-compile sharded table & wildcard patterns at module level
- get_table_and_shard(): Called for every BigQuery table
- get_table_display_name(): Called for table name normalization
- is_sharded_table(): Called during table classification
3. **PowerBI ODBC**: Pre-compile platform detection patterns at module level
- normalize_platform_from_driver(): Called for every ODBC connection
- normalize_platform_name(): Called during platform normalization
- Affects 18+ database platform patterns
All changes follow the same optimization strategy as #15463:
- Compile regex patterns once at initialization
- Use compiled Pattern objects in hot path
- Maintain exact behavioral equivalence
- No config changes or breaking changes
Expected impact: Performance improvement for ingestion workloads with:
- High volume of temp table checks (SqlQueriesSource)
- Large BigQuery datasets with sharded tables
- PowerBI sources with many ODBC connections
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent a039705 commit c273133
File tree
3 files changed
+32
-22
lines changed- metadata-ingestion/src/datahub/ingestion/source
- bigquery_v2
- powerbi/m_query
3 files changed
+32
-22
lines changedLines changed: 10 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 138 | + | |
| 139 | + | |
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
| |||
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
157 | 163 | | |
158 | 164 | | |
159 | 165 | | |
160 | | - | |
161 | | - | |
| 166 | + | |
| 167 | + | |
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
| |||
178 | 184 | | |
179 | 185 | | |
180 | 186 | | |
181 | | - | |
182 | | - | |
183 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
184 | 190 | | |
185 | 191 | | |
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
422 | 427 | | |
423 | 428 | | |
424 | 429 | | |
425 | | - | |
426 | | - | |
| 430 | + | |
| 431 | + | |
427 | 432 | | |
428 | | - | |
| 433 | + | |
429 | 434 | | |
430 | 435 | | |
431 | 436 | | |
432 | 437 | | |
433 | | - | |
| 438 | + | |
434 | 439 | | |
435 | 440 | | |
436 | 441 | | |
| |||
0 commit comments