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

Implement scalar macro #1836

Merged
merged 1 commit into from
Jul 19, 2023
Merged

Implement scalar macro #1836

merged 1 commit into from
Jul 19, 2023

Conversation

acquamarin
Copy link
Collaborator

@acquamarin acquamarin commented Jul 19, 2023

Implements scalar macro.
Scalar macro allows user to create a scalar function in the catalog.
Grammar to create a scalar macro:
CREATE MACRO MACRO_NAME(PARAM1, PARAM2 := defaultVal) AS MACRO_BODY

@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Patch coverage: 92.09% and project coverage change: -0.02% ⚠️

Comparison is base (1e9d4fd) 91.19% compared to head (fbc47c0) 91.18%.

❗ Current head fbc47c0 differs from pull request most recent head f3c0d5b. Consider uploading reports for the commit f3c0d5b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1836      +/-   ##
==========================================
- Coverage   91.19%   91.18%   -0.02%     
==========================================
  Files         779      793      +14     
  Lines       28606    28856     +250     
==========================================
+ Hits        26088    26311     +223     
- Misses       2518     2545      +27     
Files Changed Coverage Δ
src/include/binder/binder.h 100.00% <ø> (ø)
src/include/binder/expression_binder.h 100.00% <ø> (ø)
src/include/catalog/catalog.h 100.00% <ø> (ø)
src/include/common/statement_type.h 100.00% <ø> (ø)
...de/parser/expression/parsed_parameter_expression.h 60.00% <0.00%> (-40.00%) ⬇️
...ude/parser/expression/parsed_subquery_expression.h 66.66% <0.00%> (-33.34%) ⬇️
.../include/parser/query/graph_pattern/node_pattern.h 100.00% <ø> (ø)
src/include/parser/transformer.h 100.00% <ø> (ø)
...ical_plan/logical_operator/base_logical_operator.h 100.00% <ø> (ø)
src/include/processor/mapper/plan_mapper.h 100.00% <ø> (ø)
... and 32 more

... and 29 files with indirect coverage changes

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

src/antlr4/Cypher.g4 Outdated Show resolved Hide resolved
src/include/common/expression_type.h Outdated Show resolved Hide resolved
src/include/parser/macro/create_macro.h Outdated Show resolved Hide resolved
src/include/parser/macro/create_macro.h Outdated Show resolved Hide resolved
src/include/function/scalar_macro.h Outdated Show resolved Hide resolved
src/include/parser/macro/create_macro.h Outdated Show resolved Hide resolved
namespace kuzu {
namespace parser {

std::unique_ptr<ParsedExpression> ParsedExpressionVisitor::replaceMacroParameters(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the exact way to write a visitor.

I think you want ParsedExpressionVisitor to only define getChildren() interface because some expression, e.g. CASE children are stored separately inside of children directly.

And you want an other class like ParsedExpressionParameterReplacor to implement such logic.

src/include/parser/parsed_expression_visitor.h Outdated Show resolved Hide resolved
src/include/parser/parsed_expression_visitor.h Outdated Show resolved Hide resolved
@acquamarin acquamarin merged commit c2e1acf into master Jul 19, 2023
10 checks passed
@acquamarin acquamarin deleted the macro branch July 19, 2023 23:47
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