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

[no-op] Clang format all files #175

Merged
merged 1 commit into from
Dec 9, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ EXT_NAME=duckpgq
EXT_CONFIG=${PROJ_DIR}extension_config.cmake

# Include the Makefile from extension-ci-tools
include extension-ci-tools/makefiles/duckdb_extension.Makefile
include extension-ci-tools/makefiles/duckdb_extension.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ bool IterativeLengthFunctionData::Equals(const FunctionData &other_p) const {
return other.csr_id == csr_id;
}


unique_ptr<FunctionData> IterativeLengthFunctionData::IterativeLengthBind(
ClientContext &context, ScalarFunction &bound_function,
vector<unique_ptr<Expression>> &arguments) {
Expand All @@ -29,7 +28,6 @@ unique_ptr<FunctionData> IterativeLengthFunctionData::IterativeLengthBind(
return make_uniq<IterativeLengthFunctionData>(context, csr_id);
}


} // namespace core

} //namespace duckpgq
} // namespace duckpgq
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ namespace core {

LocalClusteringCoefficientFunctionData::LocalClusteringCoefficientFunctionData(
ClientContext &context, int32_t csr_id)
: context(context), csr_id(csr_id) {

}
: context(context), csr_id(csr_id) {}

unique_ptr<FunctionData>
LocalClusteringCoefficientFunctionData::LocalClusteringCoefficientBind(
Expand All @@ -29,7 +27,8 @@ unique_ptr<FunctionData> LocalClusteringCoefficientFunctionData::Copy() const {
return make_uniq<LocalClusteringCoefficientFunctionData>(context, csr_id);
}

bool LocalClusteringCoefficientFunctionData::Equals(const FunctionData &other_p) const {
bool LocalClusteringCoefficientFunctionData::Equals(
const FunctionData &other_p) const {
auto &other = (const LocalClusteringCoefficientFunctionData &)other_p;
return other.csr_id == csr_id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,41 @@ namespace duckpgq {

namespace core {

WeaklyConnectedComponentFunctionData::WeaklyConnectedComponentFunctionData(ClientContext &context, int32_t csr_id)
WeaklyConnectedComponentFunctionData::WeaklyConnectedComponentFunctionData(
ClientContext &context, int32_t csr_id)
: context(context), csr_id(csr_id) {
componentId = vector<int64_t>();
component_id_initialized = false;
componentId = vector<int64_t>();
component_id_initialized = false;
}

WeaklyConnectedComponentFunctionData::WeaklyConnectedComponentFunctionData(ClientContext &context, int32_t csr_id, const vector<int64_t> &componentId)
WeaklyConnectedComponentFunctionData::WeaklyConnectedComponentFunctionData(
ClientContext &context, int32_t csr_id, const vector<int64_t> &componentId)
: context(context), csr_id(csr_id), componentId(componentId) {
component_id_initialized = false;
component_id_initialized = false;
}

unique_ptr<FunctionData> WeaklyConnectedComponentFunctionData::WeaklyConnectedComponentBind(ClientContext &context, ScalarFunction &bound_function,
vector<unique_ptr<Expression>> &arguments) {
unique_ptr<FunctionData>
WeaklyConnectedComponentFunctionData::WeaklyConnectedComponentBind(
ClientContext &context, ScalarFunction &bound_function,
vector<unique_ptr<Expression>> &arguments) {
if (!arguments[0]->IsFoldable()) {
throw InvalidInputException("Id must be constant.");
}

int32_t csr_id = ExpressionExecutor::EvaluateScalar(context, *arguments[0])
.GetValue<int32_t>();

return make_uniq<WeaklyConnectedComponentFunctionData>(context, csr_id);
return make_uniq<WeaklyConnectedComponentFunctionData>(context, csr_id);
}

unique_ptr<FunctionData> WeaklyConnectedComponentFunctionData::Copy() const {
auto result = make_uniq<WeaklyConnectedComponentFunctionData>(context, csr_id, componentId);
auto result = make_uniq<WeaklyConnectedComponentFunctionData>(context, csr_id,
componentId);
result->component_id_initialized = component_id_initialized;
return std::move(result);

}
bool WeaklyConnectedComponentFunctionData::Equals(const FunctionData &other_p) const {
bool WeaklyConnectedComponentFunctionData::Equals(
const FunctionData &other_p) const {
auto &other = (const WeaklyConnectedComponentFunctionData &)other_p;
if (csr_id != other.csr_id) {
return false;
Expand Down
24 changes: 14 additions & 10 deletions src/core/functions/scalar/csr_creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ static void CreateCsrEdgeFunction(DataChunk &args, ExpressionState &state,
auto &func_expr = (BoundFunctionExpression &)state.expr;
auto &info = (CSRFunctionData &)*func_expr.bind_info;

auto duckpgq_state = info.context.registered_state->Get<DuckPGQState>("duckpgq");
auto duckpgq_state =
info.context.registered_state->Get<DuckPGQState>("duckpgq");
if (!duckpgq_state) {
//! Wondering how you can get here if the extension wasn't loaded, but
//! leaving this check in anyways
Expand All @@ -136,8 +137,9 @@ static void CreateCsrEdgeFunction(DataChunk &args, ExpressionState &state,
int64_t edge_size = args.data[2].GetValue(0).GetValue<int64_t>();
int64_t edge_size_count = args.data[3].GetValue(0).GetValue<int64_t>();
if (edge_size != edge_size_count) {
duckpgq_state->csr_to_delete.insert(info.id);
throw ConstraintException("Non-unique vertices detected. Make sure all vertices are unique for path-finding queries.");
duckpgq_state->csr_to_delete.insert(info.id);
throw ConstraintException("Non-unique vertices detected. Make sure all "
"vertices are unique for path-finding queries.");
}

auto csr_entry = duckpgq_state->csr_list.find(info.id);
Expand Down Expand Up @@ -211,24 +213,25 @@ ScalarFunctionSet GetCSREdgeFunction() {

//! No edge weight
set.AddFunction(ScalarFunction({LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT},
LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT},
LogicalType::INTEGER, CreateCsrEdgeFunction,
CSRFunctionData::CSREdgeBind));

//! Integer for edge weight
set.AddFunction(ScalarFunction({LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT},
LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT},
LogicalType::INTEGER, CreateCsrEdgeFunction,
CSRFunctionData::CSREdgeBind));

//! Double for edge weight
set.AddFunction(ScalarFunction({LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::DOUBLE},
LogicalType::BIGINT, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::DOUBLE},
LogicalType::INTEGER, CreateCsrEdgeFunction,
CSRFunctionData::CSREdgeBind));

Expand All @@ -238,7 +241,8 @@ ScalarFunctionSet GetCSREdgeFunction() {
//------------------------------------------------------------------------------
// Register functions
//------------------------------------------------------------------------------
void CoreScalarFunctions::RegisterCSRCreationScalarFunctions(DatabaseInstance &db) {
void CoreScalarFunctions::RegisterCSRCreationScalarFunctions(
DatabaseInstance &db) {
ExtensionUtil::RegisterFunction(db, GetCSREdgeFunction());
ExtensionUtil::RegisterFunction(db, GetCSRVertexFunction());
}
Expand Down
7 changes: 2 additions & 5 deletions src/core/functions/scalar/csr_deletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ static void DeleteCsrFunction(DataChunk &args, ExpressionState &state,

auto duckpgq_state = GetDuckPGQState(info.context);


int flag = duckpgq_state->csr_list.erase(info.id);
result.SetVectorType(VectorType::CONSTANT_VECTOR);
auto result_data = ConstantVector::GetData<bool>(result);
Expand All @@ -30,12 +29,10 @@ void CoreScalarFunctions::RegisterCSRDeletionScalarFunction(
DatabaseInstance &db) {
ExtensionUtil::RegisterFunction(
db,
ScalarFunction("delete_csr", {LogicalType::INTEGER}, LogicalType::BOOLEAN, DeleteCsrFunction,
CSRFunctionData::CSRBind));
ScalarFunction("delete_csr", {LogicalType::INTEGER}, LogicalType::BOOLEAN,
DeleteCsrFunction, CSRFunctionData::CSRBind));
}


} // namespace core

} // namespace duckpgq

8 changes: 3 additions & 5 deletions src/core/functions/scalar/csr_get_w_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ static void GetCsrWTypeFunction(DataChunk &args, ExpressionState &state,
void CoreScalarFunctions::RegisterGetCSRWTypeScalarFunction(
DatabaseInstance &db) {
ExtensionUtil::RegisterFunction(
db,
ScalarFunction("csr_get_w_type", {LogicalType::INTEGER},
LogicalType::INTEGER, GetCsrWTypeFunction,
CSRFunctionData::CSRBind));
db, ScalarFunction("csr_get_w_type", {LogicalType::INTEGER},
LogicalType::INTEGER, GetCsrWTypeFunction,
CSRFunctionData::CSRBind));
}

} // namespace core

} // namespace duckpgq

13 changes: 5 additions & 8 deletions src/core/functions/scalar/iterativelength.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ static void IterativeLengthFunction(DataChunk &args, ExpressionState &state,
auto &info = (IterativeLengthFunctionData &)*func_expr.bind_info;
auto duckpgq_state = GetDuckPGQState(info.context);


D_ASSERT(duckpgq_state->csr_list[info.csr_id]);

if ((uint64_t)info.csr_id + 1 > duckpgq_state->csr_list.size()) {
Expand Down Expand Up @@ -160,15 +159,13 @@ static void IterativeLengthFunction(DataChunk &args, ExpressionState &state,
void CoreScalarFunctions::RegisterIterativeLengthScalarFunction(
DatabaseInstance &db) {
ExtensionUtil::RegisterFunction(
db,
ScalarFunction("iterativelength",
{LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT},
LogicalType::BIGINT, IterativeLengthFunction,
IterativeLengthFunctionData::IterativeLengthBind));
db, ScalarFunction("iterativelength",
{LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT},
LogicalType::BIGINT, IterativeLengthFunction,
IterativeLengthFunctionData::IterativeLengthBind));
}

} // namespace core

} // namespace duckpgq

12 changes: 5 additions & 7 deletions src/core/functions/scalar/iterativelength2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,13 @@ static void IterativeLength2Function(DataChunk &args, ExpressionState &state,
void CoreScalarFunctions::RegisterIterativeLength2ScalarFunction(
DatabaseInstance &db) {
ExtensionUtil::RegisterFunction(
db,
ScalarFunction("iterativelength2",
{LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT},
LogicalType::BIGINT, IterativeLength2Function,
IterativeLengthFunctionData::IterativeLengthBind));
db, ScalarFunction("iterativelength2",
{LogicalType::INTEGER, LogicalType::BIGINT,
LogicalType::BIGINT, LogicalType::BIGINT},
LogicalType::BIGINT, IterativeLength2Function,
IterativeLengthFunctionData::IterativeLengthBind));
}

} // namespace core

} // namespace duckpgq

2 changes: 0 additions & 2 deletions src/core/functions/scalar/iterativelength_bidirectional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ static void IterativeLengthBidirectionalFunction(DataChunk &args,

auto duckpgq_state = GetDuckPGQState(info.context);


D_ASSERT(duckpgq_state->csr_list[info.csr_id]);
int64_t v_size = args.data[1].GetValue(0).GetValue<int64_t>();
int64_t *v = (int64_t *)duckpgq_state->csr_list[info.csr_id]->v;
Expand Down Expand Up @@ -182,4 +181,3 @@ void CoreScalarFunctions::RegisterIterativeLengthBidirectionalScalarFunction(
} // namespace core

} // namespace duckpgq

12 changes: 6 additions & 6 deletions src/core/functions/scalar/local_clustering_coefficient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ namespace duckpgq {

namespace core {

static void LocalClusteringCoefficientFunction(DataChunk &args, ExpressionState &state,
Vector &result) {
static void LocalClusteringCoefficientFunction(DataChunk &args,
ExpressionState &state,
Vector &result) {
auto &func_expr = (BoundFunctionExpression &)state.expr;
auto &info = (LocalClusteringCoefficientFunctionData &)*func_expr.bind_info;
auto duckpgq_state = GetDuckPGQState(info.context);

auto csr_entry = duckpgq_state->csr_list.find((uint64_t)info.csr_id);
if (csr_entry == duckpgq_state->csr_list.end()) {
throw ConstraintException(
"CSR not found. Is the graph populated?");
throw ConstraintException("CSR not found. Is the graph populated?");
}

if (!(csr_entry->second->initialized_v && csr_entry->second->initialized_e)) {
Expand Down Expand Up @@ -68,7 +68,8 @@ static void LocalClusteringCoefficientFunction(DataChunk &args, ExpressionState
}
}

float local_result = static_cast<float>(count) / (number_of_edges * (number_of_edges - 1));
float local_result =
static_cast<float>(count) / (number_of_edges * (number_of_edges - 1));
result_data[n] = local_result;
}
duckpgq_state->csr_to_delete.insert(info.csr_id);
Expand All @@ -90,4 +91,3 @@ void CoreScalarFunctions::RegisterLocalClusteringCoefficientScalarFunction(
} // namespace core

} // namespace duckpgq

Loading
Loading