iotdb
iotdb copied to clipboard
ConstantsFoldingRewriter
Description
1.achieve constants folding: including ArithmeticBinaryExpression, ComparisonExpression, BetweenPredicate, LogicalExpression, NotExpression, InPredicate etc. 2.After constants folding, pushdown BETWEEN Predicate
TESE CASE
| before constants folding | after constants folding |
|---|---|
7 > (5 + 3) |
false |
7 < (5 + 3) |
true |
| --- | --- |
3 between 4 and 7 |
false |
4 between 3 and 7 |
true |
| --- | --- |
3 + 4 between 4 + 2 and 5 + 6 |
true |
4 + 2 between 3 + 4 and 5 + 6 |
false |
| --- | --- |
7 > 5 and 4 < 3 |
false |
7 > 5 or 4 < 3 |
true |
| --- | --- |
7 > 5 and s1 < 3 |
s1 < 3 |
5 > 7 or s1 < 3 |
s1 < 3 |
| --- | --- |
s1 between 5 + 7 and 6 + 12 |
s1 between 12 and 18 |
4 + 7 between s1 and 6 + 2 + 9 |
11 between s1 and 17 |
4 + 7 between s1 and 6 + 2 |
false |
s1 between 4 + 7 and 6 + 2 |
false |
| --- | --- |
s1 < 2 + 2 |
s1 < 4 |
3 + 5 < s2 |
8 < s2 |
| --- | --- |
(s1 < 4 + 7) and (s1 between 4 + 7 and 6 + 2) |
false |
(s1 < 4 + 7) and (s1 between 4 + 7 and 6 + 2 + 9) |
s1 < 11 and s1 between 11 and 17 |
(s1 < 4 + 7) and (4 + 7 between s1 and 6 + 2) |
false |
(s1 < 4 + 7) and (4 + 7 between s1 and 6 + 2 + 9) |
s1 < 11 and 11 between s1 and 17 |
(s1 < 4 + 7) and (4 + 7 between 6 + 2 and s1) |
s1 < 11 and 11 between 8 and s1 |
(s1 < 4 + 7) and (6 + 2 between 4 + 7 and s1) |
false |
| --- | --- |
not((s1 < 4 + 7) and (6 + 2 between 4 + 7 and s1)) |
true |
not((s1 < 4 + 7) and (4 + 7 between 6 + 2 and s1)) |
not(s1 < 11 and 11 between 8 and s1) |
| --- | --- |
3 in (3,4) |
true |
3 in (1+2,4) |
true |
3 in (5+7,3+9,6*3+5-7) |
false |
3 not in (5+7,3+9,6*3+5-7) |
true |
s1 in (5+7,3+9,6*3+5-7) |
s1 in (12,12,16) |
s2 not in (7*5+(4-2), 3*8-1, 8/6%2) |
not(s2 in (37,23,1)) |
This PR has:
- [ ] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, license, or notice information
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
- [ ] added integration tests.
- [ ] been tested in a test IoTDB cluster.