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

cleanup: replace NotImplementedException #2401

Merged
merged 1 commit into from
Nov 13, 2023
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
3 changes: 1 addition & 2 deletions src/binder/bind/bind_graph_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "catalog/rel_table_group_schema.h"
#include "catalog/rel_table_schema.h"
#include "common/exception/binder.h"
#include "common/exception/not_implemented.h"
#include "common/keyword/rdf_keyword.h"
#include "common/string_format.h"
#include "function/cast/functions/cast_string_to_functions.h"
Expand Down Expand Up @@ -116,7 +115,7 @@ std::shared_ptr<Expression> Binder::createPath(
extraFieldFromStructType(
recursiveInfo->rel->getDataType(), relFieldNameSet, relFieldNames, relFieldTypes);
} else {
throw NotImplementedException("Binder::createPath");
KU_UNREACHABLE;
}
}
auto nodeExtraInfo = std::make_unique<StructTypeInfo>(nodeFieldNames, nodeFieldTypes);
Expand Down
5 changes: 1 addition & 4 deletions src/catalog/catalog_content.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "catalog/rel_table_group_schema.h"
#include "catalog/rel_table_schema.h"
#include "common/exception/catalog.h"
#include "common/exception/not_implemented.h"
#include "common/exception/runtime.h"
#include "common/serializer/buffered_file.h"
#include "common/serializer/deserializer.h"
Expand Down Expand Up @@ -218,9 +217,7 @@ ExpressionType CatalogContent::getFunctionType(const std::string& name) const {
case function::FunctionType::AGGREGATE:
return ExpressionType::AGGREGATE_FUNCTION;
default:
// LCOV_EXCL_START
throw NotImplementedException("CatalogContent::getFunctionType");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/catalog/table_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "catalog/rel_table_schema.h"
#include "common/constants.h"
#include "common/exception/internal.h"
#include "common/exception/not_implemented.h"
#include "common/exception/runtime.h"
#include "common/serializer/deserializer.h"
#include "common/serializer/serializer.h"
Expand Down Expand Up @@ -115,9 +114,7 @@ std::unique_ptr<TableSchema> TableSchema::deserialize(Deserializer& deserializer
result = RdfGraphSchema::deserialize(deserializer);
} break;
default: {
// LCOV_EXCL_START
throw NotImplementedException{"TableSchema::deserialize"};
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}
result->tableName = tableName;
Expand Down
4 changes: 2 additions & 2 deletions src/common/rel_direction.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "common/enums/rel_direction.h"

#include "common/exception/not_implemented.h"
#include "common/assert.h"

namespace kuzu {
namespace common {
Expand All @@ -14,7 +14,7 @@ std::string RelDataDirectionUtils::relDataDirectionToString(RelDataDirection dir
return "backward";
}
default:
throw NotImplementedException("RelDataDirectionUtils::relDataDirectionToString");
KU_UNREACHABLE;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/common/table_type.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "common/enums/table_type.h"

#include "common/exception/not_implemented.h"
#include "common/assert.h"

namespace kuzu {
namespace common {
Expand All @@ -22,8 +22,8 @@ std::string TableTypeUtils::toString(TableType tableType) {
case TableType::REL_GROUP: {
return "REL_GROUP";
}
default: // LCOV_EXCL_START
throw NotImplementedException("TableTypeUtils::toString"); // LCOV_EXCL_STOP
default:
KU_UNREACHABLE;
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/common/type_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "common/type_utils.h"

#include "common/exception/not_implemented.h"
#include "common/types/blob.h"
#include "common/vector/value_vector.h"

Expand Down Expand Up @@ -49,10 +48,8 @@ std::string TypeUtils::castValueToString(
return TypeUtils::toString(*reinterpret_cast<const list_entry_t*>(value), valueVector);
case LogicalTypeID::STRUCT:
return TypeUtils::toString(*reinterpret_cast<const struct_entry_t*>(value), valueVector);
// LCOV_EXCL_START
default:
throw NotImplementedException("TypeUtils::castValueToString.");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/common/types/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,8 @@ std::string LogicalType::toString() const {
case LogicalTypeID::SERIAL:
case LogicalTypeID::RDF_VARIANT:
return LogicalTypeUtils::toString(typeID);
// LCOV_EXCL_START
default:
throw NotImplementedException("LogicalType::toString");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down
17 changes: 4 additions & 13 deletions src/common/types/value/value.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "common/types/value/value.h"

#include "common/exception/not_implemented.h"
#include "common/null_buffer.h"
#include "common/serializer/deserializer.h"
#include "common/serializer/serializer.h"
Expand Down Expand Up @@ -112,10 +111,8 @@ Value Value::createDefaultValue(const LogicalType& dataType) {
}
return Value(dataType, std::move(children));
}
// LCOV_EXCL_START
default:
throw NotImplementedException("Value::createDefaultValue.");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down Expand Up @@ -296,10 +293,8 @@ void Value::copyValueFrom(const uint8_t* value) {
case LogicalTypeID::RDF_VARIANT: {
copyFromStruct(value);
} break;
// LCOV_EXCL_START
default:
throw NotImplementedException("Value::copyValueFrom.");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down Expand Up @@ -576,9 +571,7 @@ void Value::serialize(Serializer& serializer) const {
}
} break;
default: {
// LCOV_EXCL_START
throw NotImplementedException("Value::serialize");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}
serializer.serializeValue(childrenSize);
Expand Down Expand Up @@ -641,9 +634,7 @@ std::unique_ptr<Value> Value::deserialize(Deserializer& deserializer) {
deserializer.deserializeVectorOfPtrs(val->children);
} break;
default: {
// LCOV_EXCL_START
throw NotImplementedException("Value::deserializeValue");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}
deserializer.deserializeValue(val->childrenSize);
Expand Down
9 changes: 2 additions & 7 deletions src/expression_evaluator/case_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <cmath>

#include "common/exception/not_implemented.h"
#include "common/types/date_t.h"
#include "common/types/interval_t.h"
#include "common/types/ku_string.h"
Expand Down Expand Up @@ -136,10 +135,8 @@ void CaseExpressionEvaluator::fillAllSwitch(const ValueVector& thenVector) {
case LogicalTypeID::VAR_LIST: {
fillAll<list_entry_t>(thenVector);
} break;
// LCOV_EXCL_START
default:
throw NotImplementedException("CaseExpressionEvaluator::fillAllSwitch");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down Expand Up @@ -170,10 +167,8 @@ void CaseExpressionEvaluator::fillSelectedSwitch(
case LogicalTypeID::VAR_LIST: {
fillSelected<list_entry_t>(selVector, thenVector);
} break;
// LCOV_EXCL_START
default:
throw NotImplementedException("CaseExpressionEvaluator::fillSelectedSwitch");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/expression_evaluator/path_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void PathExpressionEvaluator::init(
recursiveRel->dataType, *pathExpression->getRelType(), vectors->relsDataInput);
} break;
default:
throw NotImplementedException("PathExpressionEvaluator::init");
KU_UNREACHABLE;
}
inputVectorsPerChild.push_back(std::move(vectors));
}
Expand Down
5 changes: 1 addition & 4 deletions src/function/aggregate_function.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "function/aggregate_function.h"

#include "common/exception/not_implemented.h"
#include "common/types/interval_t.h"
#include "function/aggregate/avg.h"
#include "function/aggregate/min_max.h"
Expand Down Expand Up @@ -199,10 +198,8 @@ std::unique_ptr<AggregateFunction> AggregateFunctionUtil::getMinMaxFunction(cons
MinMaxFunction<internalID_t>::updatePos<FUNC>,
MinMaxFunction<internalID_t>::combine<FUNC>, MinMaxFunction<internalID_t>::finalize,
isDistinct);
// LCOV_EXCL_START
default:
throw NotImplementedException("AggregateFunctionUtil::getMinMaxFunction.");
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/function/built_in_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,8 @@ uint32_t BuiltInFunctions::getFunctionCost(
}
case FunctionType::TABLE:
return matchParameters(inputTypes, function->parameterTypeIDs, isOverload);
// LCOV_EXCL_START
default:
throw NotImplementedException{"BuiltInFunctions::getFunctionCost"};
// LCOC_EXCL_STOP
KU_UNREACHABLE;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/function/cast_string_to_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,9 @@ void CastString::copyStringToVector(ValueVector* vector, uint64_t rowToAdd, std:
CastStringHelper::cast(
strVal.data(), strVal.length(), val, vector, rowToAdd, csvReaderConfig);
} break;
default: { // LCOV_EXCL_START
throw NotImplementedException("CastString::operation");
} // LCOV_EXCL_STOP
default: {
KU_UNREACHABLE;
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/function/comparison_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <cmath>

#include "common/exception/not_implemented.h"
#include "common/types/int128_t.h"
#include "common/types/interval_t.h"

Expand Down Expand Up @@ -99,7 +98,7 @@ static void executeNestedOperation(uint8_t& result, ValueVector* leftVector,
rightVector->getValue<struct_entry_t>(rightPos), result, leftVector, rightVector);
} break;
default: {
throw NotImplementedException("comparison operation");
KU_UNREACHABLE;
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/function/table_functions/call_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "catalog/rel_table_group_schema.h"
#include "catalog/rel_table_schema.h"
#include "common/exception/binder.h"
#include "common/exception/not_implemented.h"

namespace kuzu {
namespace function {
Expand Down Expand Up @@ -241,9 +240,7 @@ void ShowConnectionFunction::tableFunc(TableFunctionInput& input, DataChunk& out
}
} break;
default:
// LCOV_EXCL_START
throw NotImplementedException{"ShowConnectionFunction::tableFunc"};
// LCOV_EXCL_STOP
KU_UNREACHABLE;
}
outputChunk.state->selVector->selectedSize = vectorPos;
}
Expand Down
13 changes: 6 additions & 7 deletions src/function/vector_list_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "binder/expression_binder.h"
#include "common/exception/binder.h"
#include "common/exception/not_implemented.h"
#include "common/exception/runtime.h"
#include "function/list/functions/list_any_value_function.h"
#include "function/list/functions/list_append_function.h"
Expand Down Expand Up @@ -219,7 +218,7 @@ std::unique_ptr<FunctionBindData> ListExtractFunction::bindFunc(
BinaryExecListExtractFunction<list_entry_t, int64_t, internalID_t, ListExtract>;
} break;
default: {
throw NotImplementedException("ListExtractFunction::bindFunc");
KU_UNREACHABLE;
}
}
return std::make_unique<FunctionBindData>(*resultType);
Expand Down Expand Up @@ -429,7 +428,7 @@ std::unique_ptr<FunctionBindData> ListSortFunction::bindFunc(
getExecFunction<interval_t>(arguments, scalarFunction->execFunc);
} break;
default: {
throw NotImplementedException("ListSortFunction::bindFunc");
KU_UNREACHABLE;
}
}
return std::make_unique<FunctionBindData>(arguments[0]->getDataType());
Expand Down Expand Up @@ -519,7 +518,7 @@ std::unique_ptr<FunctionBindData> ListReverseSortFunction::bindFunc(
getExecFunction<interval_t>(arguments, scalarFunction->execFunc);
} break;
default: {
throw NotImplementedException("ListReverseSortFunction::bindFunc");
KU_UNREACHABLE;
}
}
return std::make_unique<FunctionBindData>(arguments[0]->getDataType());
Expand Down Expand Up @@ -639,7 +638,7 @@ std::unique_ptr<FunctionBindData> ListDistinctFunction::bindFunc(
list_entry_t, ListDistinct<internalID_t>>;
} break;
default: {
throw NotImplementedException("ListDistinctFunction::bindFunc");
KU_UNREACHABLE;
}
}
return std::make_unique<FunctionBindData>(arguments[0]->getDataType());
Expand Down Expand Up @@ -727,7 +726,7 @@ std::unique_ptr<FunctionBindData> ListUniqueFunction::bindFunc(
int64_t, ListUnique<internalID_t>>;
} break;
default: {
throw NotImplementedException("ListUniqueFunction::bindFunc");
KU_UNREACHABLE;
}
}
return std::make_unique<FunctionBindData>(LogicalType(LogicalTypeID::INT64));
Expand Down Expand Up @@ -820,7 +819,7 @@ std::unique_ptr<FunctionBindData> ListAnyValueFunction::bindFunc(
ScalarFunction::UnaryExecListStructFunction<list_entry_t, internalID_t, ListAnyValue>;
} break;
default: {
throw NotImplementedException("ListAnyValueFunction::bindFunc");
KU_UNREACHABLE;
}
}
return std::make_unique<FunctionBindData>(*resultType);
Expand Down
5 changes: 1 addition & 4 deletions src/include/expression_evaluator/node_rel_evaluator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "binder/expression/expression.h"
#include "common/exception/not_implemented.h"
#include "expression_evaluator.h"

namespace kuzu {
Expand All @@ -15,9 +14,7 @@ class NodeRelExpressionEvaluator final : public ExpressionEvaluator {

void evaluate() override;

bool select(common::SelectionVector& /*selVector*/) override {
throw common::NotImplementedException("NodeExpressionEvaluator::select");
}
bool select(common::SelectionVector& /*selVector*/) override { KU_UNREACHABLE; }

inline std::unique_ptr<ExpressionEvaluator> clone() override {
std::vector<std::unique_ptr<ExpressionEvaluator>> clonedChildren;
Expand Down
5 changes: 1 addition & 4 deletions src/include/expression_evaluator/path_evaluator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "binder/expression/expression.h"
#include "common/exception/not_implemented.h"
#include "expression_evaluator.h"

namespace kuzu {
Expand All @@ -17,9 +16,7 @@ class PathExpressionEvaluator final : public ExpressionEvaluator {

void evaluate();

bool select(common::SelectionVector& /*selVector*/) {
throw common::NotImplementedException("PathExpressionEvaluator::select");
}
bool select(common::SelectionVector& /*selVector*/) { KU_UNREACHABLE; }

inline std::unique_ptr<ExpressionEvaluator> clone() {
std::vector<std::unique_ptr<ExpressionEvaluator>> clonedChildren;
Expand Down
Loading