calcite
calcite copied to clipboard
[CALCITE-5665] Reducing ineffective matches for MaterializedViewRules
jira: CALCITE-5665
- Reduce the number of MaterializedViewRule matches
- Reduce RelOptMaterialization metadata recalculation
For example, in the test MaterializedViewRelOptRulesTest#testJoinAggregateMaterializationNoAggregateFuncs9, MaterializedViewRule#perform was triggered 489 times in the original implementation, but in this pr, it was only triggered 23 times.
I did a simple test on my personal computer and added a timer to the MaterializedViewRelOptRulesTest#TESTER#optimize method. Here are the milliseconds this method executes before and after optimization.
before: 237 237 229 250 241 227 258 239 253 267 256 244 228 228 241 245 245 238 273 243 after: 199 202 191 190 243 206 207 204 213 239 239 205 192 200 215 196 195 200 193 217 before avg: 243.95 ms after avg: 207.3 ms
before: 225 239 244 236 240 225 281 239 240 236 238 236 228 239 241 238 237 265 256 233 after: 204 201 187 196 192 213 197 186 200 194 189 200 207 199 210 213 188 214 201 206 before avg: 240.8 ms after avg: 199.85 ms