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

Remove parser unit test and unstr related operators #1043

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/parser/expression/include/parsed_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ class ParsedExpression {

inline ParsedExpression* getChild(uint32_t idx) const { return children[idx].get(); }

virtual bool equals(const ParsedExpression& other) const;

bool operator==(const ParsedExpression& other) const { return equals(other); }

bool operator!=(const ParsedExpression& other) const { return !equals(other); }

protected:
ParsedExpression(ExpressionType type, string rawName) : type{type}, rawName{move(rawName)} {}

Expand Down
6 changes: 0 additions & 6 deletions src/parser/expression/include/parsed_function_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ class ParsedFunctionExpression : public ParsedExpression {
// A function might have more than 2 parameters.
void addChild(unique_ptr<ParsedExpression> child) { children.push_back(move(child)); }

bool equals(const ParsedExpression& other) const override {
auto& functionExpression = (ParsedFunctionExpression&)other;
return ParsedExpression::equals(other) && isDistinct == functionExpression.isDistinct &&
functionName == functionExpression.functionName;
}

private:
bool isDistinct;
string functionName;
Expand Down
6 changes: 0 additions & 6 deletions src/parser/expression/include/parsed_literal_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ class ParsedLiteralExpression : public ParsedExpression {

inline Literal* getLiteral() const { return literal.get(); }

bool equals(const ParsedExpression& other) const override {
return ParsedExpression::equals(other) &&
TypeUtils::toString(*literal) ==
TypeUtils::toString(*((ParsedLiteralExpression&)other).literal);
}

private:
unique_ptr<Literal> literal;
};
Expand Down
5 changes: 0 additions & 5 deletions src/parser/expression/include/parsed_parameter_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ class ParsedParameterExpression : public ParsedExpression {

inline string getParameterName() const { return parameterName; }

bool equals(const ParsedExpression& other) const override {
return ParsedExpression::equals(other) &&
parameterName == ((ParsedParameterExpression&)other).parameterName;
}

private:
string parameterName;
};
Expand Down
5 changes: 0 additions & 5 deletions src/parser/expression/include/parsed_property_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ class ParsedPropertyExpression : public ParsedExpression {

inline string getPropertyName() const { return propertyName; }

bool equals(const ParsedExpression& other) const override {
return ParsedExpression::equals(other) &&
propertyName == ((ParsedPropertyExpression&)other).propertyName;
}

private:
string propertyName;
};
Expand Down
17 changes: 0 additions & 17 deletions src/parser/expression/include/parsed_subquery_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,6 @@ class ParsedSubqueryExpression : public ParsedExpression {
inline bool hasWhereClause() const { return whereClause != nullptr; }
inline ParsedExpression* getWhereClause() const { return whereClause.get(); }

bool equals(const ParsedExpression& other) const override {
auto& otherSubquery = (ParsedSubqueryExpression&)other;
if (!ParsedExpression::equals(other) ||
patternElements.size() != otherSubquery.patternElements.size()) {
return false;
}
if (hasWhereClause() && *whereClause != *otherSubquery.whereClause) {
return false;
}
for (auto i = 0u; i < patternElements.size(); ++i) {
if (*patternElements[i] != *otherSubquery.patternElements[i]) {
return false;
}
}
return true;
}

private:
vector<unique_ptr<PatternElement>> patternElements;
unique_ptr<ParsedExpression> whereClause;
Expand Down
5 changes: 0 additions & 5 deletions src/parser/expression/include/parsed_variable_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ class ParsedVariableExpression : public ParsedExpression {

inline string getVariableName() const { return variableName; }

bool equals(const ParsedExpression& other) const override {
return ParsedExpression::equals(other) &&
variableName == ((ParsedVariableExpression&)other).variableName;
}

private:
string variableName;
};
Expand Down
12 changes: 0 additions & 12 deletions src/parser/expression/parsed_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,5 @@ ParsedExpression::ParsedExpression(ExpressionType type, unique_ptr<ParsedExpress
children.push_back(move(right));
}

bool ParsedExpression::equals(const ParsedExpression& other) const {
if (type != other.type || alias != other.alias || children.size() != other.children.size()) {
return false;
}
for (auto i = 0u; i < children.size(); ++i) {
if (*children[i] != *other.children[i]) {
return false;
}
}
return true;
}

} // namespace parser
} // namespace kuzu
3 changes: 0 additions & 3 deletions src/parser/query/graph_pattern/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
cc_library(
name = "graph_pattern",
srcs = glob([
"*.cpp",
]),
hdrs = glob([
"include/*.h",
]),
Expand Down
19 changes: 0 additions & 19 deletions src/parser/query/graph_pattern/include/node_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,6 @@ class NodePattern {
return make_pair(propertyKeyValPairs[idx].first, propertyKeyValPairs[idx].second.get());
}

virtual bool equals(const NodePattern& other) const {
if (!(variableName == other.variableName && tableName == other.tableName &&
propertyKeyValPairs.size() == other.propertyKeyValPairs.size())) {
return false;
}
for (auto i = 0u; i < propertyKeyValPairs.size(); ++i) {
auto& [name, expression] = propertyKeyValPairs[i];
auto& [otherName, otherExpression] = other.propertyKeyValPairs[i];
if (!(name == otherName && *expression == *otherExpression)) {
return false;
}
}
return true;
}

bool operator==(const NodePattern& other) const { return equals(other); }

bool operator!=(const NodePattern& other) const { return !equals(other); }

private:
string variableName;
string tableName;
Expand Down
4 changes: 0 additions & 4 deletions src/parser/query/graph_pattern/include/pattern_element.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class PatternElement {
return patternElementChains[idx].get();
}

bool operator==(const PatternElement& other) const;

bool operator!=(const PatternElement& other) const { return !operator==(other); }

private:
unique_ptr<NodePattern> nodePattern;
vector<unique_ptr<PatternElementChain>> patternElementChains;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ class PatternElementChain {

inline NodePattern* getNodePattern() const { return nodePattern.get(); }

bool operator==(const PatternElementChain& other) const {
return *relPattern == *other.relPattern;
}

bool operator!=(const PatternElementChain& other) const { return !operator==(other); }

private:
unique_ptr<RelPattern> relPattern;
unique_ptr<NodePattern> nodePattern;
Expand Down
6 changes: 0 additions & 6 deletions src/parser/query/graph_pattern/include/rel_pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ class RelPattern : public NodePattern {

inline ArrowDirection getDirection() const { return arrowDirection; }

bool equals(const kuzu::parser::NodePattern& other) const override {
auto& otherRel = (RelPattern&)other;
return NodePattern::equals(other) && lowerBound == otherRel.lowerBound &&
upperBound == otherRel.upperBound && arrowDirection == otherRel.arrowDirection;
}

private:
string lowerBound;
string upperBound;
Expand Down
20 changes: 0 additions & 20 deletions src/parser/query/graph_pattern/pattern_element.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions src/parser/query/include/query_part.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ class QueryPart {

inline WithClause* getWithClause() const { return withClause.get(); }

bool operator==(const QueryPart& other) const;

bool operator!=(const QueryPart& other) const { return !operator==(other); }

private:
vector<unique_ptr<ReadingClause>> readingClauses;
vector<unique_ptr<UpdatingClause>> updatingClauses;
Expand Down
2 changes: 0 additions & 2 deletions src/parser/query/include/single_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class SingleQuery {

bool isFirstReadingClauseOptionalMatch() const;

bool operator==(const SingleQuery& other) const;

private:
vector<unique_ptr<QueryPart>> queryParts;
vector<unique_ptr<ReadingClause>> readingClauses;
Expand Down
20 changes: 0 additions & 20 deletions src/parser/query/query_part.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions src/parser/query/reading_clause/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "reading_clause",
srcs = glob([
"*.cpp",
]),
hdrs = glob([
"include/*.h",
]),
Expand Down
2 changes: 0 additions & 2 deletions src/parser/query/reading_clause/include/match_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class MatchClause : public ReadingClause {

inline bool getIsOptional() const { return isOptional; }

bool equals(const ReadingClause& other) const override;

private:
vector<unique_ptr<PatternElement>> patternElements;
unique_ptr<ParsedExpression> whereClause;
Expand Down
6 changes: 0 additions & 6 deletions src/parser/query/reading_clause/include/reading_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ class ReadingClause {

inline ClauseType getClauseType() const { return clauseType; }

virtual bool equals(const ReadingClause& other) const { return clauseType == other.clauseType; }

bool operator==(const ReadingClause& other) const { return equals(other); }

bool operator!=(const ReadingClause& other) const { return equals(other); }

private:
ClauseType clauseType;
};
Expand Down
2 changes: 0 additions & 2 deletions src/parser/query/reading_clause/include/unwind_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class UnwindClause : public ReadingClause {

inline const string getAlias() const { return alias; }

bool equals(const ReadingClause& other) const override;

private:
unique_ptr<ParsedExpression> expression;
string alias;
Expand Down
27 changes: 0 additions & 27 deletions src/parser/query/reading_clause/match_clause.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions src/parser/query/reading_clause/unwind_clause.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions src/parser/query/return_with_clause/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "return_with_clause",
srcs = glob([
"*.cpp",
]),
hdrs = glob([
"include/*.h",
]),
Expand Down
4 changes: 0 additions & 4 deletions src/parser/query/return_with_clause/include/projection_body.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ class ProjectionBody {

inline ParsedExpression* getLimitExpression() const { return limitExpression.get(); }

bool operator==(const ProjectionBody& other) const;

bool operator!=(const ProjectionBody& other) const { return !operator==(other); }

private:
bool isDistinct;
bool containsStar;
Expand Down
6 changes: 0 additions & 6 deletions src/parser/query/return_with_clause/include/return_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ class ReturnClause {

inline ProjectionBody* getProjectionBody() const { return projectionBody.get(); }

bool operator==(const ReturnClause& other) const {
return *projectionBody == *other.projectionBody;
}

bool operator!=(const ReturnClause& other) const { return !operator==(other); }

private:
unique_ptr<ProjectionBody> projectionBody;
};
Expand Down
2 changes: 0 additions & 2 deletions src/parser/query/return_with_clause/include/with_clause.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class WithClause : public ReturnClause {

inline ParsedExpression* getWhereExpression() const { return whereExpression.get(); }

bool operator==(const WithClause& other) const;

private:
unique_ptr<ParsedExpression> whereExpression;
};
Expand Down
Loading