当前位置:网站首页>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 .
边栏推荐
- Industrial control safety PLC firmware reverse II
- Beijing Zhun electric clock, Beidou clock server, GPS network time server, NTP satellite timing system
- Ecosystem long-term observation data product system
- Scalar, vector, matrix calculus
- Actf questions (dropper+master_of_dns)
- Large number processing -- use case
- Using ODBC to consume SAP ABAP CDs view in Excel
- PostgreSQL views tables, table indexes, views, table structures, and parameter settings
- UDP message structure and precautions
- See you in Suzhou! "Cloud Intelligence Technology Forum - industry special" will be held soon
猜你喜欢

Redux best practices "Redux toolkit"

Focus on improving women's and children's sense of gain, happiness and security! In the next ten years, Guangzhou Women's and children's undertakings will make such efforts
![Codeforces:d1. choosing carrots (easy version) [max min problem + control one side to make the other side as close as possible + thinking]](/img/53/69276cb390016a0de980643dfc599a.png)
Codeforces:d1. choosing carrots (easy version) [max min problem + control one side to make the other side as close as possible + thinking]

Peripherals: timer, watchdog and RTC
![[leetcode] 3. Longest substring without repeated characters - go language problem solution](/img/63/57d3557d77d44b51b7d0f71669568f.png)
[leetcode] 3. Longest substring without repeated characters - go language problem solution

Custom types in C language

String class

Industrial control safety PLC firmware reverse II

See you in Suzhou! "Cloud Intelligence Technology Forum - industry special" will be held soon

Introduction to web security telent testing and defense
随机推荐
Use SAP ui5 application to consume create and delete operations of OData in business application studio
[hero planet July training leetcode problem solving daily] 20th BST
Freedom and self action Hegel
Industrial control safety PLC firmware reverse II
It's still a synchronization problem
Jenkins configuration plug-in interface displays "suggestions collection" in Chinese
Rolling division, Young's matrix and three-step flip
About the relationship between parent process and child process (UAC bypass idea)
6-11 vulnerability exploitation - use the built environment to send emails
Introduction to ORM framework - what is ORM framework?
On the economic model of open source ecology
Ecosystem long-term observation data product system
Pycharm writes SQLite statements without code prompts
[circular array] JS method collection of circular array
Babbitt | metauniverse daily must read: Dubai launched the national metauniverse strategy, which plans to increase the number of related companies of metauniverse by five times in the next five years
HAC cluster is modified to stand-alone
In the post deep learning era, where is the recommendation system going?
Flutter apple native Pinyin keyboard input exception on textfield | Pinyin input process callback problem
Upgrade the leapfrog products again, and the 2023 Geely Xingrui will be sold from 113700 yuan
Google launched another "man grabbing war" for core making, and Intel's 17 year veteran joined!