当前位置:网站首页>On Calc optimization of calcite
On Calc optimization of calcite
2022-07-25 02:27:00 【Xie, who likes coding】
List of articles
background
Recently, I asked the community CSE Related work , Community feedback can be used Calc. I don't know much about this at present , So learn .
Code
- RelNode
Calc It's an interface , One implementation is LogicalCalc. The relevant optimization rules are mentioned in the comments .
- Rule
Calc Relevant rules are collected in CALC_RULES in .
- Program
calc There is a special HepProgram
The program Also encapsulated in standard Of program in
standard Will be in Prepare Called , It means Calcite perform query Unit tests of can be used standard Of program, That is to say, it may trigger Calc Related optimizations .

test
stay JdbcTest Write the following test cases in Calcite adopt RexProgram Support CSE
@Test void testCommonSubExpression() throws SQLException {
CalciteAssert.hr()
.query("select \"salary\","
+ "12 * \"salary\", "
+ "3 * \"salary\", "
+ "\"salary\" * 12 + \"salary\" * 3,"
+ "\"salary\" * 3 + \"salary\" * 12 from \"hr\".\"emps\"")
.returns("");
}
As shown in the figure below :salary * 12 + salary * 3 and salary * 3 + salary * 12 All point to $t13, so Calcite extract CSE Support simple commutative law
Notice the conditionExpr by null, combination LogicalCalc It's not difficult to guess Filter It is also possible to trigger this optimization , And build new program.

in addition , Finished SQL and no CSE The optimization of the , That is to say, it cannot be reused directly by other engines .
边栏推荐
- Simulation Implementation of [STL] string class
- On the economic model of open source ecology
- Win10 configuring CUDA and cudnn
- "Ask the sky" is in place! Yu Jingchuan's "China Space Station" in 2013 is about to set sail in the sea of stars
- Using multithreaded execution method in Lua script based on nlua implementation
- [circular array] JS method collection of circular array
- Query the thread information of MySQL server (detailed explanation)
- MySQL advanced (13) command line export import database
- Pycharm writes SQLite statements without code prompts
- Digital commerce cloud fine chemical industry management platform integrated informatization solution
猜你喜欢

Using ODBC to consume SAP ABAP CDs view in Excel

Digital power supply -- Chapter 1

What do growth enterprises need most to build a data-driven organization?

R language uses logistic regression, ANOVA, outlier analysis and visual classification iris iris data set

"I gave up programming and wrote a 1.3 million word hard science fiction."

Deep understanding of string class

Explorer TSSD 2019 software installation package download and installation tutorial

How to use ES6 async and await (basic)
![[system design] distributed key value database](/img/57/4d835d83f0e6ffb87e8ba39ec3b482.png)
[system design] distributed key value database
![[recognize cloud Nativity] Chapter 4 cloud network section 4.9.4.3 - smart network card usage scenario - network acceleration implementation](/img/9a/b69036bf920706360d8b293dad2a89.png)
[recognize cloud Nativity] Chapter 4 cloud network section 4.9.4.3 - smart network card usage scenario - network acceleration implementation
随机推荐
Use SAP ui5 application to consume create and delete operations of OData in business application studio
"Nowadays, more than 99.9% of the code is garbage!"
"I gave up programming and wrote a 1.3 million word hard science fiction."
Eolink - quickly develop interfaces through document driven
UDP message structure and precautions
Coal industry supply chain centralized mining system: digitalization to promote the transformation and upgrading of coal industry
HAC cluster is modified to stand-alone
ByteDance confirmation will be self-developed chip: for internal use only; Musk: I have uploaded my brain to the cloud; Go language product head leaves | geek headline
C traps and defects Chapter 2 lexical "traps" 2.4 switch statements
Rolling division, Young's matrix and three-step flip
Hbuilderx developed by uni app connects to night God simulator
Cloudrev deploy your own public cloud disk (pagoda installation method)
Using the artifact typora+picgo, Youdao cloud can automatically upload pictures in markdown without members
Ecosystem long-term observation data product system
AWD thinking
How to use ES6 async and await (basic)
What are the basic skills of engineers? How to practice? -- Learning experience sharing "suggestions collection"
Simulate the implementation of strstr
Redis unauthorized access vulnerability recurrence (www.hetianlab.com)
Summary thinking caused by the function of a SMS verification code [easy to understand]