Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression Constant Folding #1989

Merged
merged 1 commit into from
Sep 4, 2023
Merged

Expression Constant Folding #1989

merged 1 commit into from
Sep 4, 2023

Conversation

andyfengHKU
Copy link
Contributor

This PR adds the base infrastructure for constant expression folding.

We now have the capability to evaluate a constant expression (e.g. 1 + 1) and compile time through ExpressionEvaluatorUtils and return back a Value.

As a consequence

  • We reduce the depth of expression evaluator at runtime e.g. a + 1 + 1 will be evaluated as a + 2
  • We now have the capability to expand literal binding as constant expression binding, e.g. we now support LIMIT 1 + 1

@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Patch coverage: 93.50% and project coverage change: -0.01% ⚠️

Comparison is base (3c2086b) 89.86% compared to head (8f51962) 89.85%.

❗ Current head 8f51962 differs from pull request most recent head 57fef9a. Consider uploading reports for the commit 57fef9a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1989      +/-   ##
==========================================
- Coverage   89.86%   89.85%   -0.01%     
==========================================
  Files         881      882       +1     
  Lines       32560    32653      +93     
==========================================
+ Hits        29259    29340      +81     
- Misses       3301     3313      +12     
Files Changed Coverage Δ
...inder/bind_expression/bind_function_expression.cpp 96.42% <ø> (-0.27%) ⬇️
...inder/bind_expression/bind_property_expression.cpp 87.14% <ø> (ø)
src/expression_evaluator/expression_evaluator.cpp 100.00% <ø> (ø)
src/function/built_in_vector_functions.cpp 99.39% <ø> (-0.01%) ⬇️
src/include/binder/expression/case_expression.h 100.00% <ø> (ø)
...rc/include/binder/expression/function_expression.h 100.00% <ø> (ø)
...rc/include/binder/expression/variable_expression.h 75.00% <0.00%> (-25.00%) ⬇️
src/include/binder/expression_binder.h 100.00% <ø> (ø)
src/include/common/types/value.h 88.00% <ø> (ø)
src/include/common/vector/value_vector.h 100.00% <ø> (ø)
... and 43 more

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/binder/expression_visitor.cpp Outdated Show resolved Hide resolved
src/common/vector/value_vector.cpp Show resolved Hide resolved
@andyfengHKU andyfengHKU merged commit b7b10b0 into master Sep 4, 2023
10 checks passed
@andyfengHKU andyfengHKU deleted the evaluate-scalar branch September 4, 2023 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants