asdfgh19 opened a new pull request, #3169: URL: https://github.com/apache/calcite/pull/3169
jira: [CALCITE-5665](https://issues.apache.org/jira/browse/CALCITE-5665) What this PR can bring: 1. Reduce the number of MaterializedViewRule matches 2. Reduce RelOptMaterialization meta recalculation 3. Usually RelMetadataQuery is created in the sql preparation phase (CalcitePrepareImpl#prepare_), after which if RelMetadataQuery is recycled by gc, the cache entry will be removed and can be recycled by gc 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 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
