Implement expression evaluation in RETURN projections#407
Conversation
56914ab to
15d0d15
Compare
0b906f4 to
a0c927c
Compare
|
|
||
| const auto& expectedFirstCol = std::views::iota(1000, 2000); | ||
| const auto& expectedSecondCol = std::views::iota(2000, 300); | ||
| const auto& expectedSecondCol = std::views::iota(2000, 3000); |
There was a problem hiding this comment.
Fixes a bug which was caught by gcc15
There was a problem hiding this comment.
Do you have the bug logs? I'm curious! If not don't worry about it
There was a problem hiding this comment.
I can't seem to repro now haha. But it was a static_assert failing because the start of the range (2000) was greater than the end of the range (300)
8c55eac to
9dacd54
Compare
query/analyzer/ExprAnalyzer.cpp
Outdated
|
|
||
| // Create a variable declaration for the binary expression so that it can be retrieved | ||
| // later (for projection or in an expression / filter), e.g. RETURN COUNT(5 + 5) | ||
| expr->setExprVarDecl(_ctxt->createUnnamedVariable(_ast, expr->getType())); |
There was a problem hiding this comment.
It would look better if you created a temporary for the variable declaration pointer instead of a nested call line
| } | ||
|
|
||
| void CountProcessor::prepare(ExecutionContext* ctxt) { | ||
| void CountProcessor::prepare(ExecutionContext* /*ctxt*/) { |
|
|
||
| // @ref _col is nullptr in the case of a COUNT(*), which in Cypher means "count the | ||
| // number of rows in the output". Unlike a COUNT(n.name), COUNT(*) also includes | ||
| // null-valued rows |
There was a problem hiding this comment.
It's a bit weird that there is nothing in that sense in the prepare function which gives the impression that _col will always be non-null
| inline constexpr bool is_template_t = is_template<T, Template>::value; | ||
|
|
||
| /// Functor to pass to column dispatcher to count rows | ||
| struct Counter { |
There was a problem hiding this comment.
Do you really need it to be a struct? It is almost always better to have a class. Especially if you actually don't access the public members
There was a problem hiding this comment.
Made Counter a class
|
|
||
| Counter counter(localCount); | ||
| using Types = OutputtedTypes; | ||
| using CountDispatch = |
There was a problem hiding this comment.
It looks very compact otherwise it is much better
|
|
||
| // Methods such as @ref Dataframe::getLogicalRowCount return a size_t; ensure types are | ||
| // compatible. | ||
| static_assert(std::numeric_limits<size_t>::max() |
There was a problem hiding this comment.
Should we rather put this static_assert inside the CountProcessor class?
There was a problem hiding this comment.
What is the benefit of putting it inside the class?
There was a problem hiding this comment.
There is none really besides an esthetic one, it avoids having a statement at global scope in principle when it is about a type alias defined with using inside the class
There was a problem hiding this comment.
Moved the static_assert into the class
query/plan/PipelineGenerator.cpp
Outdated
| const ColumnTag tag = findColIt->second; | ||
|
|
||
| items.push_back({tag, *name}); | ||
|
|
8d1b281 to
5ad15b6
Compare
Claude Code ReviewViolations found (click to expand)
Checked against CODING_STYLE.md and REVIEW.md. @rjb32 false positive, as per our discussion about "requires" clauses after function parameter lists |
cb63918 to
2963ecd
Compare
19cd1bb to
f538f59
Compare
Implements #359
Overview:
CountProcessorto use newColumnOperatorDispatcherExprEvalProcessorto evaluate expressions and store the results in the output dataframeExprProgramGeneratorwith more support for unary expressionsPipelineGeneratorfor the newExprEvalProcessor