From f1166681d8b491c8e0a9b70bfaeb092b9ae8c9a5 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Mon, 12 Aug 2024 06:01:08 +0000 Subject: [PATCH] Run clang-format --- src/binder/bind/bind_graph_pattern.cpp | 42 +++++++++++-------- src/binder/bind/bind_updating_clause.cpp | 4 +- .../bind_function_expression.cpp | 6 ++- src/binder/expression/node_rel_expression.cpp | 2 +- src/catalog/catalog.cpp | 3 +- src/function/gds/gds.cpp | 3 +- src/include/binder/binder.h | 32 ++++++++------ src/include/binder/binder_scope.h | 6 ++- .../binder/expression/node_rel_expression.h | 4 +- .../catalog_entry/table_catalog_entry.h | 3 +- src/include/processor/plan_mapper.h | 3 +- src/optimizer/acc_hash_join_optimizer.cpp | 2 +- src/processor/map/map_delete.cpp | 3 +- src/processor/map/map_insert.cpp | 3 +- src/processor/map/map_recursive_extend.cpp | 4 +- src/processor/map/map_set.cpp | 6 ++- 16 files changed, 75 insertions(+), 51 deletions(-) diff --git a/src/binder/bind/bind_graph_pattern.cpp b/src/binder/bind/bind_graph_pattern.cpp index 112dfb6c3a4..a31946deb80 100644 --- a/src/binder/bind/bind_graph_pattern.cpp +++ b/src/binder/bind/bind_graph_pattern.cpp @@ -241,8 +241,9 @@ std::shared_ptr Binder::bindQueryRel(const RelPattern& relPattern } std::shared_ptr Binder::createNonRecursiveQueryRel(const std::string& parsedName, - const std::vector& entries, std::shared_ptr srcNode, - std::shared_ptr dstNode, RelDirectionType directionType) { + const std::vector& entries, + std::shared_ptr srcNode, std::shared_ptr dstNode, + RelDirectionType directionType) { auto relTableEntries = getRelTableEntries(entries); auto queryRel = make_shared(LogicalType(LogicalTypeID::REL), getUniqueExpressionName(parsedName), parsedName, relTableEntries, std::move(srcNode), @@ -277,11 +278,9 @@ std::shared_ptr Binder::createNonRecursiveQueryRel(const std::str if (!rdfGraphTableIDSet.empty()) { if (!nonRdfRelTableIDSet.empty()) { auto relTableName = - catalog->getTableCatalogEntry(transaction, *nonRdfRelTableIDSet.begin()) - ->getName(); + catalog->getTableCatalogEntry(transaction, *nonRdfRelTableIDSet.begin())->getName(); auto rdfGraphName = - catalog->getTableCatalogEntry(transaction, *rdfGraphTableIDSet.begin()) - ->getName(); + catalog->getTableCatalogEntry(transaction, *rdfGraphTableIDSet.begin())->getName(); throw BinderException(stringFormat( "Relationship pattern {} contains both PropertyGraph relationship " "label {} and RDFGraph label {}. Mixing relationships tables from an RDFGraph and " @@ -300,8 +299,7 @@ std::shared_ptr Binder::createNonRecursiveQueryRel(const std::str queryRel->setRdfPredicateInfo(std::move(rdfInfo)); std::vector resourceTableSchemas; for (auto tableID : resourceTableIDs) { - resourceTableSchemas.push_back( - catalog->getTableCatalogEntry(transaction, tableID)); + resourceTableSchemas.push_back(catalog->getTableCatalogEntry(transaction, tableID)); } // Mock existence of pIRI property. auto pIRI = @@ -338,8 +336,9 @@ static void bindRecursiveRelProjectionList(const expression_vector& projectionLi } std::shared_ptr Binder::createRecursiveQueryRel(const parser::RelPattern& relPattern, - const std::vector& entries, std::shared_ptr srcNode, - std::shared_ptr dstNode, RelDirectionType directionType) { + const std::vector& entries, + std::shared_ptr srcNode, std::shared_ptr dstNode, + RelDirectionType directionType) { auto catalog = clientContext->getCatalog(); auto transaction = clientContext->getTx(); auto relTableEntries = getRelTableEntries(entries); @@ -630,7 +629,9 @@ std::vector Binder::bindTableEntries(const std::vectorgetTableID() < b->getTableID(); }); + std::sort(entries.begin(), entries.end(), [](TableCatalogEntry* a, TableCatalogEntry* b) { + return a->getTableID() < b->getTableID(); + }); return entries; } @@ -647,15 +648,18 @@ common::table_id_t Binder::bindTableID(const std::string& tableName) const { return bindTableEntry(tableName)->getTableID(); } -std::vector Binder::getNodeTableEntries(const std::vector& entries) const { +std::vector Binder::getNodeTableEntries( + const std::vector& entries) const { return getTableEntries(entries, TableType::NODE); } -std::vector Binder::getRelTableEntries(const std::vector& entries) const { +std::vector Binder::getRelTableEntries( + const std::vector& entries) const { return getTableEntries(entries, TableType::REL); } -std::vector Binder::getTableEntries(const std::vector& entries, TableType tableType) const { +std::vector Binder::getTableEntries( + const std::vector& entries, TableType tableType) const { std::vector result; table_id_set_t set; for (auto& entry : entries) { @@ -663,10 +667,10 @@ std::vector Binder::getTableEntries(const std::vector Binder::getRelTableEntries(TableCatalogEntry* en switch (entry->getTableType()) { case TableType::RDF: { auto& rdfEntry = entry->constCast(); - auto rtEntry = catalog->getTableCatalogEntry(transaction, rdfEntry.getResourceTripleTableID()); - auto ltEntry = catalog->getTableCatalogEntry(transaction, rdfEntry.getLiteralTripleTableID()); + auto rtEntry = + catalog->getTableCatalogEntry(transaction, rdfEntry.getResourceTripleTableID()); + auto ltEntry = + catalog->getTableCatalogEntry(transaction, rdfEntry.getLiteralTripleTableID()); return {rtEntry, ltEntry}; } case TableType::REL_GROUP: { diff --git a/src/binder/bind/bind_updating_clause.cpp b/src/binder/bind/bind_updating_clause.cpp index 3d0f2da31b3..cd491147219 100644 --- a/src/binder/bind/bind_updating_clause.cpp +++ b/src/binder/bind/bind_updating_clause.cpp @@ -239,8 +239,8 @@ void Binder::bindInsertRel(std::shared_ptr rel, } else { auto insertInfo = BoundInsertInfo(TableType::REL, rel); insertInfo.columnExprs = rel->getPropertyExprs(); - insertInfo.columnDataExprs = bindInsertColumnDataExprs(rel->getPropertyDataExprRef(), - entry->getPropertiesRef()); + insertInfo.columnDataExprs = + bindInsertColumnDataExprs(rel->getPropertyDataExprRef(), entry->getPropertiesRef()); infos.push_back(std::move(insertInfo)); } } diff --git a/src/binder/bind_expression/bind_function_expression.cpp b/src/binder/bind_expression/bind_function_expression.cpp index d104727b379..422e573e76a 100644 --- a/src/binder/bind_expression/bind_function_expression.cpp +++ b/src/binder/bind_expression/bind_function_expression.cpp @@ -261,7 +261,8 @@ std::shared_ptr ExpressionBinder::bindLabelFunction(const Expression return createLiteralExpression(""); } if (!node.isMultiLabeled()) { - auto labelName = catalog->getTableName(context->getTx(), node.getSingleEntry()->getTableID()); + auto labelName = + catalog->getTableName(context->getTx(), node.getSingleEntry()->getTableID()); return createLiteralExpression(Value(LogicalType::STRING(), labelName)); } auto nodeTableIDs = catalog->getNodeTableIDs(context->getTx()); @@ -276,7 +277,8 @@ std::shared_ptr ExpressionBinder::bindLabelFunction(const Expression return createLiteralExpression(""); } if (!rel.isMultiLabeled()) { - auto labelName = catalog->getTableName(context->getTx(), rel.getSingleEntry()->getTableID()); + auto labelName = + catalog->getTableName(context->getTx(), rel.getSingleEntry()->getTableID()); return createLiteralExpression(Value(LogicalType::STRING(), labelName)); } auto relTableIDs = catalog->getRelTableIDs(context->getTx()); diff --git a/src/binder/expression/node_rel_expression.cpp b/src/binder/expression/node_rel_expression.cpp index ce87e2c863b..8f1f089b4e1 100644 --- a/src/binder/expression/node_rel_expression.cpp +++ b/src/binder/expression/node_rel_expression.cpp @@ -1,7 +1,7 @@ #include "binder/expression/node_rel_expression.h" -#include "common/exception/runtime.h" #include "catalog/catalog_entry/table_catalog_entry.h" +#include "common/exception/runtime.h" using namespace kuzu::catalog; using namespace kuzu::common; diff --git a/src/catalog/catalog.cpp b/src/catalog/catalog.cpp index dee48ec15e7..2a37d929655 100644 --- a/src/catalog/catalog.cpp +++ b/src/catalog/catalog.cpp @@ -113,7 +113,8 @@ TableCatalogEntry* Catalog::getTableCatalogEntry(Transaction* transaction, return result; } -TableCatalogEntry* Catalog::getTableCatalogEntry(Transaction* transaction, const std::string& tableName) const { +TableCatalogEntry* Catalog::getTableCatalogEntry(Transaction* transaction, + const std::string& tableName) const { auto entry = tables->getEntry(transaction, tableName); // LCOV_EXCL_START if (entry == nullptr) { diff --git a/src/function/gds/gds.cpp b/src/function/gds/gds.cpp index 13c4276f37f..e0cfe267560 100644 --- a/src/function/gds/gds.cpp +++ b/src/function/gds/gds.cpp @@ -17,7 +17,8 @@ void GDSAlgorithm::init(GDSCallSharedState* sharedState_, ClientContext* context } std::shared_ptr GDSAlgorithm::bindNodeOutput(Binder* binder, GraphEntry& graphEntry) { - auto node = binder->createQueryNode(NODE_COLUMN_NAME, binder->getTableEntries(graphEntry.nodeTableIDs)); + auto node = + binder->createQueryNode(NODE_COLUMN_NAME, binder->getTableEntries(graphEntry.nodeTableIDs)); binder->addToScope(NODE_COLUMN_NAME, node); return node; } diff --git a/src/include/binder/binder.h b/src/include/binder/binder.h index e01aea4c3d9..9ecaa044683 100644 --- a/src/include/binder/binder.h +++ b/src/include/binder/binder.h @@ -252,11 +252,13 @@ class Binder { const std::shared_ptr& leftNode, const std::shared_ptr& rightNode, QueryGraph& queryGraph); std::shared_ptr createNonRecursiveQueryRel(const std::string& parsedName, - const std::vector& entries, std::shared_ptr srcNode, - std::shared_ptr dstNode, RelDirectionType directionType); + const std::vector& entries, + std::shared_ptr srcNode, std::shared_ptr dstNode, + RelDirectionType directionType); std::shared_ptr createRecursiveQueryRel(const parser::RelPattern& relPattern, - const std::vector& entries, std::shared_ptr srcNode, - std::shared_ptr dstNode, RelDirectionType directionType); + const std::vector& entries, + std::shared_ptr srcNode, std::shared_ptr dstNode, + RelDirectionType directionType); std::pair bindVariableLengthRelBound(const parser::RelPattern& relPattern); void bindQueryRelProperties(RelExpression& rel); @@ -268,17 +270,23 @@ class Binder { void bindQueryNodeProperties(NodeExpression& node); /*** bind table entries ***/ - std::vector bindTableEntries(const std::vector& tableNames, - bool nodePattern) const; + std::vector bindTableEntries( + const std::vector& tableNames, bool nodePattern) const; catalog::TableCatalogEntry* bindTableEntry(const std::string& tableName) const; common::table_id_t bindTableID(const std::string& tableName) const; - std::vector getNodeTableEntries(const std::vector& entries) const; - std::vector getRelTableEntries(const std::vector& entries) const; - std::vector getTableEntries(const std::vector& entries, common::TableType tableType) const; - std::vector getNodeTableEntries(catalog::TableCatalogEntry* entry) const; - std::vector getRelTableEntries(catalog::TableCatalogEntry* entry) const; + std::vector getNodeTableEntries( + const std::vector& entries) const; + std::vector getRelTableEntries( + const std::vector& entries) const; + std::vector getTableEntries( + const std::vector& entries, common::TableType tableType) const; + std::vector getNodeTableEntries( + catalog::TableCatalogEntry* entry) const; + std::vector getRelTableEntries( + catalog::TableCatalogEntry* entry) const; // TODO(Xiyang): remove id based table binding logic. - std::vector getTableEntries(const common::table_id_vector_t& tableIDs); + std::vector getTableEntries( + const common::table_id_vector_t& tableIDs); /*** validations ***/ // E.g. ... RETURN a, b AS a diff --git a/src/include/binder/binder_scope.h b/src/include/binder/binder_scope.h index c3474ec7ae4..2dd8c8db00a 100644 --- a/src/include/binder/binder_scope.h +++ b/src/include/binder/binder_scope.h @@ -20,7 +20,8 @@ class BinderScope { expression_vector getExpressions() const { return expressions; } void addExpression(const std::string& varName, std::shared_ptr expression); - void memorizeTableEntries(const std::string& name, std::vector entries) { + void memorizeTableEntries(const std::string& name, + std::vector entries) { memorizedNodeNameToEntries.insert({name, entries}); } bool hasMemorizedTableIDs(const std::string& name) const { @@ -56,7 +57,8 @@ class BinderScope { // A node might be popped out of scope. But we may need to retain its table ID information. // E.g. MATCH (a:person) WITH collect(a) AS list_a UNWIND list_a AS new_a MATCH (new_a)-[]->() // It will be more performant if we can retain the information that new_a has label person. - std::unordered_map> memorizedNodeNameToEntries; + std::unordered_map> + memorizedNodeNameToEntries; // A node pattern may not always be bound as a node expression, e.g. in the above query, // (new_a) is bound as a variable rather than node expression. std::unordered_map> nodeReplacement; diff --git a/src/include/binder/expression/node_rel_expression.h b/src/include/binder/expression/node_rel_expression.h index ed0d78766d8..7ebb5022266 100644 --- a/src/include/binder/expression/node_rel_expression.h +++ b/src/include/binder/expression/node_rel_expression.h @@ -32,9 +32,7 @@ class NodeOrRelExpression : public Expression { common::idx_t getNumEntries() const { return entries.size(); } common::table_id_vector_t getTableIDsX() const; common::table_id_set_t getTableIDsSet() const; - const std::vector& getEntries() const { - return entries; - } + const std::vector& getEntries() const { return entries; } void setEntries(std::vector entries_) { entries = std::move(entries_); } diff --git a/src/include/catalog/catalog_entry/table_catalog_entry.h b/src/include/catalog/catalog_entry/table_catalog_entry.h index 2caa23b478a..87dc8809118 100644 --- a/src/include/catalog/catalog_entry/table_catalog_entry.h +++ b/src/include/catalog/catalog_entry/table_catalog_entry.h @@ -105,7 +105,8 @@ struct TableCatalogEntryEquality { } }; -using table_catalog_entry_set_t = std::unordered_set; +using table_catalog_entry_set_t = + std::unordered_set; } // namespace catalog } // namespace kuzu diff --git a/src/include/processor/plan_mapper.h b/src/include/processor/plan_mapper.h index c68a6c5993f..1082cddc581 100644 --- a/src/include/processor/plan_mapper.h +++ b/src/include/processor/plan_mapper.h @@ -186,7 +186,8 @@ class PlanMapper { const planner::Schema& schema) const; std::unique_ptr getRelDeleteExecutor(const binder::BoundDeleteInfo& info, const planner::Schema& schema) const; - NodeTableDeleteInfo getNodeTableDeleteInfo(const catalog::TableCatalogEntry& entry, DataPos pkPos) const; + NodeTableDeleteInfo getNodeTableDeleteInfo(const catalog::TableCatalogEntry& entry, + DataPos pkPos) const; NodeTableSetInfo getNodeTableSetInfo(const catalog::TableCatalogEntry& entry, const binder::Expression& expr) const; RelTableSetInfo getRelTableSetInfo(const catalog::TableCatalogEntry& entry, diff --git a/src/optimizer/acc_hash_join_optimizer.cpp b/src/optimizer/acc_hash_join_optimizer.cpp index 11f0ae88751..c875c623cbd 100644 --- a/src/optimizer/acc_hash_join_optimizer.cpp +++ b/src/optimizer/acc_hash_join_optimizer.cpp @@ -1,5 +1,6 @@ #include "optimizer/acc_hash_join_optimizer.h" +#include "catalog/catalog_entry/table_catalog_entry.h" #include "function/gds/gds.h" #include "optimizer/logical_operator_collector.h" #include "planner/operator/extend/logical_recursive_extend.h" @@ -9,7 +10,6 @@ #include "planner/operator/logical_intersect.h" #include "planner/operator/scan/logical_scan_node_table.h" #include "planner/operator/sip/logical_semi_masker.h" -#include "catalog/catalog_entry/table_catalog_entry.h" using namespace kuzu::common; using namespace kuzu::binder; diff --git a/src/processor/map/map_delete.cpp b/src/processor/map/map_delete.cpp index e2bc53f53a7..04400b5685a 100644 --- a/src/processor/map/map_delete.cpp +++ b/src/processor/map/map_delete.cpp @@ -14,7 +14,8 @@ using namespace kuzu::storage; namespace kuzu { namespace processor { -NodeTableDeleteInfo PlanMapper::getNodeTableDeleteInfo(const TableCatalogEntry& entry, DataPos pkPos) const { +NodeTableDeleteInfo PlanMapper::getNodeTableDeleteInfo(const TableCatalogEntry& entry, + DataPos pkPos) const { auto storageManager = clientContext->getStorageManager(); auto catalog = clientContext->getCatalog(); auto transaction = clientContext->getTx(); diff --git a/src/processor/map/map_insert.cpp b/src/processor/map/map_insert.cpp index 35eccff8b2e..bb4f8680644 100644 --- a/src/processor/map/map_insert.cpp +++ b/src/processor/map/map_insert.cpp @@ -34,7 +34,8 @@ NodeInsertExecutor PlanMapper::getNodeInsertExecutor(const LogicalInsertInfo* bo auto columnsPos = populateReturnColumnsPos(*boundInfo, outSchema); auto info = NodeInsertInfo(nodeIDPos, columnsPos, boundInfo->conflictAction); auto storageManager = clientContext->getStorageManager(); - auto table = storageManager->getTable(node.getSingleEntry()->getTableID())->ptrCast(); + auto table = + storageManager->getTable(node.getSingleEntry()->getTableID())->ptrCast(); evaluator_vector_t evaluators; auto exprMapper = ExpressionMapper(&inSchema); for (auto& expr : boundInfo->columnDataExprs) { diff --git a/src/processor/map/map_recursive_extend.cpp b/src/processor/map/map_recursive_extend.cpp index be321cae3d3..8a544fb5654 100644 --- a/src/processor/map/map_recursive_extend.cpp +++ b/src/processor/map/map_recursive_extend.cpp @@ -10,8 +10,8 @@ using namespace kuzu::planner; namespace kuzu { namespace processor { -static std::shared_ptr createSharedState( - const NodeExpression& nbrNode, const main::ClientContext& context) { +static std::shared_ptr createSharedState(const NodeExpression& nbrNode, + const main::ClientContext& context) { std::vector> semiMasks; for (auto entry : nbrNode.getEntries()) { auto tableID = entry->getTableID(); diff --git a/src/processor/map/map_set.cpp b/src/processor/map/map_set.cpp index 06464f5a47d..92c225dea82 100644 --- a/src/processor/map/map_set.cpp +++ b/src/processor/map/map_set.cpp @@ -28,14 +28,16 @@ static column_id_t getColumnID(const catalog::TableCatalogEntry& entry, return columnID; } -NodeTableSetInfo PlanMapper::getNodeTableSetInfo(const TableCatalogEntry& entry, const Expression& expr) const { +NodeTableSetInfo PlanMapper::getNodeTableSetInfo(const TableCatalogEntry& entry, + const Expression& expr) const { auto storageManager = clientContext->getStorageManager(); auto table = storageManager->getTable(entry.getTableID())->ptrCast(); auto columnID = getColumnID(entry, expr.constCast()); return NodeTableSetInfo(table, columnID); } -RelTableSetInfo PlanMapper::getRelTableSetInfo(const TableCatalogEntry& entry, const Expression& expr) const { +RelTableSetInfo PlanMapper::getRelTableSetInfo(const TableCatalogEntry& entry, + const Expression& expr) const { auto storageManager = clientContext->getStorageManager(); auto table = storageManager->getTable(entry.getTableID())->ptrCast(); auto columnID = getColumnID(entry, expr.constCast());