Skip to content

Commit

Permalink
Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfengHKU committed Jan 17, 2025
1 parent 71c1650 commit 338462e
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 26 deletions.
4 changes: 3 additions & 1 deletion extension/fts/src/catalog/fts_index_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ std::string FTSIndexAuxInfo::toCypher(const catalog::IndexCatalogEntry& indexEnt
main::ClientContext* context) {
std::string cypher;
auto catalog = context->getCatalog();
auto tableName = catalog->getTableCatalogEntry(context->getTransaction(), indexEntry.getTableID())->getName();
auto tableName =
catalog->getTableCatalogEntry(context->getTransaction(), indexEntry.getTableID())
->getName();
std::string propertyStr;
for (auto i = 0u; i < properties.size(); i++) {
propertyStr +=
Expand Down
6 changes: 4 additions & 2 deletions extension/fts/src/function/query_fts_bind_data.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "function/query_fts_bind_data.h"

#include "binder/expression/expression_util.h"
#include "catalog/fts_index_catalog_entry.h"
#include "catalog/catalog_entry/table_catalog_entry.h"
#include "catalog/fts_index_catalog_entry.h"
#include "common/string_utils.h"
#include "function/fts_utils.h"
#include "function/stem.h"
Expand Down Expand Up @@ -58,7 +58,9 @@ struct StopWordsChecker {
StopWordsChecker::StopWordsChecker(main::ClientContext& context)
: termsVector{LogicalType::STRING(), context.getMemoryManager()}, tx{context.getTransaction()} {
termsVector.state = common::DataChunkState::getSingleValueDataChunkState();
auto tableID = context.getCatalog()->getTableCatalogEntry(tx, FTSUtils::getStopWordsTableName())->getTableID();
auto tableID = context.getCatalog()
->getTableCatalogEntry(tx, FTSUtils::getStopWordsTableName())
->getTableID();
stopWordsTable = context.getStorageManager()->getTable(tableID)->ptrCast<storage::NodeTable>();
}

Expand Down
3 changes: 2 additions & 1 deletion src/binder/bind_expression/bind_function_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ std::shared_ptr<Expression> ExpressionBinder::bindEndNodeExpression(const Expres
return rel.getDstNode();
}

static std::vector<std::unique_ptr<Value>> populateLabelValues(std::vector<TableCatalogEntry*> entries) {
static std::vector<std::unique_ptr<Value>> populateLabelValues(
std::vector<TableCatalogEntry*> entries) {
std::unordered_map<table_id_t, std::string> map;
common::table_id_t maxTableID = 0;
for (auto& entry : entries) {
Expand Down
3 changes: 1 addition & 2 deletions src/catalog/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ void Catalog::alterTableEntry(Transaction* transaction, const BoundAlterInfo& in
tables->alterEntry(transaction, info);
}

bool Catalog::containsSequence(const Transaction* transaction,
const std::string& name) const {
bool Catalog::containsSequence(const Transaction* transaction, const std::string& name) const {
return sequences->containsEntry(transaction, name);
}

Expand Down
4 changes: 3 additions & 1 deletion src/catalog/catalog_entry/hnsw_index_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ std::string HNSWIndexAuxInfo::toCypher(const IndexCatalogEntry& indexEntry,
main::ClientContext* context) {
std::string cypher;
auto catalog = context->getCatalog();
auto tableName = catalog->getTableCatalogEntry(context->getTransaction(), indexEntry.getTableID())->getName();
auto tableName =
catalog->getTableCatalogEntry(context->getTransaction(), indexEntry.getTableID())
->getName();
auto distFuncName = storage::HNSWIndexConfig::distFuncToString(config.distFunc);
cypher += common::stringFormat("CALL CREATE_HNSW_INDEX('{}', '{}', '{}', mu := {}, ml := {}, "
"pu := {}, distFunc := '{}', alpha := {}, efc := {});\n",
Expand Down
6 changes: 4 additions & 2 deletions src/catalog/catalog_entry/rel_group_catalog_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ static std::string getFromToStr(common::table_id_t tableID, ClientContext* conte
auto transaction = context->getTransaction();
auto& entry =
catalog->getTableCatalogEntry(transaction, tableID)->constCast<RelTableCatalogEntry>();
auto srcTableName = catalog->getTableCatalogEntry(transaction, entry.getSrcTableID())->getName();
auto dstTableName = catalog->getTableCatalogEntry(transaction, entry.getDstTableID())->getName();
auto srcTableName =
catalog->getTableCatalogEntry(transaction, entry.getSrcTableID())->getName();
auto dstTableName =
catalog->getTableCatalogEntry(transaction, entry.getDstTableID())->getName();
return stringFormat("FROM {} TO {}", srcTableName, dstTableName);
}

Expand Down
21 changes: 14 additions & 7 deletions src/function/table/call/hnsw/create_hnsw_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,23 @@ static void finalizeFunc(const processor::ExecutionContext* context,

const auto bindData = hnswSharedState->bindData->constPtrCast<CreateHNSWIndexBindData>();
const auto catalog = clientContext->getCatalog();
auto upperRelTableID = catalog->getTableCatalogEntry(transaction,
storage::HNSWIndexUtils::getUpperGraphTableName(bindData->indexName))->getTableID();
auto lowerRelTableID = catalog->getTableCatalogEntry(transaction,
storage::HNSWIndexUtils::getLowerGraphTableName(bindData->indexName))->getTableID();
auto upperRelTableID =
catalog
->getTableCatalogEntry(transaction,
storage::HNSWIndexUtils::getUpperGraphTableName(bindData->indexName))
->getTableID();
auto lowerRelTableID =
catalog
->getTableCatalogEntry(transaction,
storage::HNSWIndexUtils::getLowerGraphTableName(bindData->indexName))
->getTableID();
auto auxInfo = std::make_unique<catalog::HNSWIndexAuxInfo>(upperRelTableID, lowerRelTableID,
hnswSharedState->nodeTable.getColumn(bindData->columnID).getName(),
index->getUpperEntryPoint(), index->getLowerEntryPoint(), bindData->config.copy());
auto indexEntry = std::make_unique<catalog::IndexCatalogEntry>(catalog::HNSWIndexCatalogEntry::TYPE_NAME,
bindData->tableEntry->getTableID(), bindData->indexName, std::move(auxInfo));
catalog->createIndex(transaction,std::move(indexEntry));
auto indexEntry =
std::make_unique<catalog::IndexCatalogEntry>(catalog::HNSWIndexCatalogEntry::TYPE_NAME,
bindData->tableEntry->getTableID(), bindData->indexName, std::move(auxInfo));
catalog->createIndex(transaction, std::move(indexEntry));
}

static std::string createHNSWIndexTables(main::ClientContext& context,
Expand Down
4 changes: 3 additions & 1 deletion src/function/table/call/table_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ static std::unique_ptr<TableCatalogEntry> getTableCatalogEntry(const main::Clien
throw common::RuntimeException{
common::stringFormat("Database: {} doesn't exist.", catalogName)};
}
return attachedDatabase->getCatalog()->getTableCatalogEntry(transaction, attachedTableName)->copy();
return attachedDatabase->getCatalog()
->getTableCatalogEntry(transaction, attachedTableName)
->copy();
}
}

Expand Down
16 changes: 9 additions & 7 deletions src/storage/index/index_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
namespace kuzu {
namespace storage {

static void validateIndexExistence(const main::ClientContext& context, catalog::TableCatalogEntry* tableEntry,
const std::string& indexName, IndexOperation indexOperation) {
static void validateIndexExistence(const main::ClientContext& context,
catalog::TableCatalogEntry* tableEntry, const std::string& indexName,
IndexOperation indexOperation) {
switch (indexOperation) {
case IndexOperation::CREATE: {
if (context.getCatalog()->containsIndex(context.getTransaction(), tableEntry->getTableID(), indexName)) {
throw common::BinderException{
common::stringFormat("Index {} already exists in table {}.", indexName,
tableEntry->getName())};
if (context.getCatalog()->containsIndex(context.getTransaction(), tableEntry->getTableID(),
indexName)) {
throw common::BinderException{common::stringFormat(
"Index {} already exists in table {}.", indexName, tableEntry->getName())};
}
} break;
case IndexOperation::DROP:
case IndexOperation::QUERY: {
if (!context.getCatalog()->containsIndex(context.getTransaction(), tableEntry->getTableID(), indexName)) {
if (!context.getCatalog()->containsIndex(context.getTransaction(), tableEntry->getTableID(),
indexName)) {
throw common::BinderException{common::stringFormat(
"Table {} doesn't have an index with name {}.", tableEntry->getName(), indexName)};
}
Expand Down
4 changes: 2 additions & 2 deletions test/storage/rel_scan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#include <vector>

#include "catalog/catalog.h"
#include "catalog/catalog_entry/node_table_catalog_entry.h"
#include "catalog/catalog_entry/rel_table_catalog_entry.h"
#include "common/types/date_t.h"
#include "common/types/ku_string.h"
#include "common/types/types.h"
#include "graph/graph_entry.h"
#include "graph/on_disk_graph.h"
#include "main/client_context.h"
#include "main_test_helper/private_main_test_helper.h"
#include "catalog/catalog_entry/node_table_catalog_entry.h"
#include "catalog/catalog_entry/rel_table_catalog_entry.h"

namespace kuzu {

Expand Down

0 comments on commit 338462e

Please sign in to comment.