Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Kalmbach <[email protected]>
  • Loading branch information
joka921 committed Nov 14, 2024
1 parent 95d3e15 commit 19b2f43
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/engine/Operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Operation {
// Add a warning to the `Operation`. The warning will be returned by
// `collectWarnings()` above.
void addWarning(std::string warning) {
_warnings.push_back(std::move(warning));
warnings_.push_back(std::move(warning));
}

/**
Expand Down Expand Up @@ -249,9 +249,9 @@ class Operation {
[[nodiscard]] virtual vector<ColumnIndex> resultSortedOn() const = 0;

/// interface to the generated warnings of this operation
std::vector<std::string>& getWarnings() { return _warnings; }
std::vector<std::string>& getWarnings() { return warnings_; }

Check warning on line 252 in src/engine/Operation.h

View check run for this annotation

Codecov / codecov/patch

src/engine/Operation.h#L252

Added line #L252 was not covered by tests
[[nodiscard]] const std::vector<std::string>& getWarnings() const {
return _warnings;
return warnings_;
}

// Check if the cancellation flag has been set and throw an exception if
Expand Down Expand Up @@ -380,7 +380,7 @@ class Operation {

// Collect all the warnings that were created during the creation or
// execution of this operation.
std::vector<std::string> _warnings;
std::vector<std::string> warnings_;

// The limit from a SPARQL `LIMIT` clause.

Expand Down
6 changes: 3 additions & 3 deletions src/parser/ParsedQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ void ParsedQuery::addOrderByClause(OrderClause orderClause, bool isGroupBy,
variablesFromAliases, additionalError);
} else if (!ad_utility::contains(_groupByVariables, orderKey.variable_) &&
(!variablesFromAliases.contains(orderKey.variable_))) {
// Check whether grouping is done. The variable being ordered by
// must then be either grouped or the result of an alias in the select
// clause.
// If the query (in addition to the ORDER BY) also contains a GROUP BY,
// the variables in the ORDER BY must be either grouped or the result
// of an alias in the SELECT clause.
addWarningOrThrow(absl::StrCat(
"Variable " + orderKey.variable_.name(),
" was used in an ORDER BY clause, but is neither grouped nor "
Expand Down
8 changes: 2 additions & 6 deletions src/parser/sparqlParser/SparqlQleverVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ PathObjectPairs joinPredicateAndObject(const VarOrPath& predicate,
}

// ___________________________________________________________________________
SparqlExpressionPimpl Visitor::visitExpressionPimpl(
auto* ctx, [[maybe_unused]] bool allowLanguageFilters) {
SparqlExpressionPimpl Visitor::visitExpressionPimpl(auto* ctx) {
return {visit(ctx), getOriginalInputForContext(ctx)};
}

Expand Down Expand Up @@ -1269,14 +1268,11 @@ void Visitor::warnOrThrowIfUnboundVariables(

// ____________________________________________________________________________________
SparqlFilter Visitor::visit(Parser::FilterRContext* ctx) {
// The second argument means that the expression `LANG(?var) = "langtag"` is
// allowed.
//
// NOTE: We cannot add a warning or throw an exception if the FILTER
// expression contains unbound variables, because the variables of the FILTER
// might be bound after the filter appears in the query (which is perfectly
// legal).
return SparqlFilter{visitExpressionPimpl(ctx->constraint(), true)};
return SparqlFilter{visitExpressionPimpl(ctx->constraint())};
}

// ____________________________________________________________________________________
Expand Down
3 changes: 1 addition & 2 deletions src/parser/sparqlParser/SparqlQleverVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,7 @@ class SparqlQleverVisitor {
// Return the `SparqlExpressionPimpl` for a context that returns a
// `ExpressionPtr` when visited. The descriptor is set automatically on the
// `SparqlExpressionPimpl`.
SparqlExpressionPimpl visitExpressionPimpl(auto* ctx,
bool allowLanguageFilters = false);
SparqlExpressionPimpl visitExpressionPimpl(auto* ctx);

template <typename Expr>
ExpressionPtr createExpression(auto... children) {
Expand Down

0 comments on commit 19b2f43

Please sign in to comment.