Skip to content

Commit f9b2162

Browse files
authored
Forward declare warning context (#5997)
1 parent 14a8407 commit f9b2162

31 files changed

+92
-99
lines changed

extension/json/src/functions/table_functions/json_scan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,8 +952,8 @@ static void finalizeFunc(const processor::ExecutionContext* ctx,
952952
auto* jsonSharedState = sharedState->ptrCast<JSONScanSharedState>();
953953

954954
jsonSharedState->sharedErrorHandler.throwCachedErrorsIfNeeded();
955-
ctx->clientContext->getWarningContextUnsafe().populateWarnings(ctx->queryID,
956-
jsonSharedState->populateErrorFunc);
955+
processor::WarningContext::Get(*ctx->clientContext)
956+
->populateWarnings(ctx->queryID, jsonSharedState->populateErrorFunc);
957957
}
958958

959959
function_set JsonScan::getFunctionSet() {

extension/vector/src/function/query_hnsw_index.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ static std::unique_ptr<TableFuncBindData> bindFunc(main::ClientContext* context,
8181
std::unique_ptr<BoundStatement> boundStatement;
8282
if (catalog->containsTable(transaction, tableOrGraphName)) {
8383
tableName = tableOrGraphName;
84-
} else if (context->getGraphEntrySetUnsafe().hasGraph(tableOrGraphName)) {
85-
auto graphEntry = context->getGraphEntrySetUnsafe().getEntry(tableOrGraphName);
84+
} else if (graph::GraphEntrySet::Get(*context)->hasGraph(tableOrGraphName)) {
85+
auto graphEntry = graph::GraphEntrySet::Get(*context)->getEntry(tableOrGraphName);
8686
std::string cypherQuery;
8787
if (graphEntry->type == graph::GraphEntryType::NATIVE) {
8888
auto& nativeEntry = graphEntry->cast<graph::ParsedNativeGraphEntry>();

scripts/headers.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ src/include/common/data_chunk/data_chunk_state.h
1717
src/include/common/data_chunk/sel_vector.h
1818
src/include/common/enums/expression_type.h
1919
src/include/common/enums/path_semantic.h
20-
src/include/common/enums/statement_type.h
2120
src/include/common/exception/binder.h
2221
src/include/common/exception/catalog.h
2322
src/include/common/exception/exception.h
@@ -70,14 +69,11 @@ src/include/main/query_result.h
7069
src/include/main/query_summary.h
7170
src/include/main/storage_driver.h
7271
src/include/main/version.h
73-
src/include/parser/statement.h
7472
src/include/parser/query/reading_clause/yield_variable.h
7573
src/include/planner/operator/operator_print_info.h
7674
src/include/processor/data_pos.h
7775
src/include/processor/operator/physical_operator.h
78-
src/include/processor/operator/persistent/reader/copy_from_error.h
7976
src/include/processor/result/result_set.h
8077
src/include/processor/result/result_set_descriptor.h
8178
src/include/processor/result/flat_tuple.h
82-
src/include/processor/warning_context.h
8379
src/include/storage/storage_version_info.h

src/function/gds/gds.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "function/table/bind_input.h"
1010
#include "graph/graph_entry_set.h"
1111
#include "graph/on_disk_graph.h"
12-
#include "main/client_context.h"
1312
#include "parser/parser.h"
1413
#include "planner/operator/logical_table_function_call.h"
1514
#include "planner/operator/sip/logical_semi_masker.h"
@@ -65,9 +64,9 @@ static void validateRelSrcDstNodeAreProjected(const TableCatalogEntry& entry,
6564
}
6665

6766
NativeGraphEntry GDSFunction::bindGraphEntry(ClientContext& context, const std::string& name) {
68-
auto& set = context.getGraphEntrySetUnsafe();
69-
set.validateGraphExist(name);
70-
auto entry = set.getEntry(name);
67+
auto set = GraphEntrySet::Get(context);
68+
set->validateGraphExist(name);
69+
auto entry = set->getEntry(name);
7170
if (entry->type != GraphEntryType::NATIVE) {
7271
throw BinderException("AA");
7372
}

src/function/table/clear_warnings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "function/table/bind_data.h"
22
#include "function/table/standalone_call_function.h"
33
#include "function/table/table_function.h"
4-
#include "main/client_context.h"
54
#include "processor/execution_context.h"
65
#include "processor/warning_context.h"
76

@@ -11,7 +10,8 @@ namespace kuzu {
1110
namespace function {
1211

1312
static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) {
14-
input.context->clientContext->getWarningContextUnsafe().clearPopulatedWarnings();
13+
auto warningContext = processor::WarningContext::Get(*input.context->clientContext);
14+
warningContext->clearPopulatedWarnings();
1515
return 0;
1616
}
1717

src/function/table/drop_project_graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "function/table/bind_data.h"
2+
#include "function/table/bind_input.h"
23
#include "function/table/standalone_call_function.h"
34
#include "function/table/table_function.h"
45
#include "graph/graph_entry_set.h"
5-
#include "main/client_context.h"
66
#include "processor/execution_context.h"
77

88
using namespace kuzu::common;
@@ -23,9 +23,9 @@ struct DropProjectedGraphBindData final : TableFuncBindData {
2323

2424
static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) {
2525
const auto bindData = ku_dynamic_cast<DropProjectedGraphBindData*>(input.bindData);
26-
auto& graphEntrySet = input.context->clientContext->getGraphEntrySetUnsafe();
27-
graphEntrySet.validateGraphExist(bindData->graphName);
28-
graphEntrySet.dropGraph(bindData->graphName);
26+
auto graphEntrySet = graph::GraphEntrySet::Get(*input.context->clientContext);
27+
graphEntrySet->validateGraphExist(bindData->graphName);
28+
graphEntrySet->dropGraph(bindData->graphName);
2929
return 0;
3030
}
3131

src/function/table/project_cypher_graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include "binder/binder.h"
22
#include "function/table/bind_data.h"
3+
#include "function/table/bind_input.h"
34
#include "function/table/standalone_call_function.h"
45
#include "function/table/table_function.h"
56
#include "graph/graph_entry_set.h"
6-
#include "main/client_context.h"
77
#include "parser/parser.h"
88
#include "processor/execution_context.h"
99

@@ -27,15 +27,15 @@ struct ProjectGraphCypherBindData final : TableFuncBindData {
2727

2828
static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) {
2929
const auto bindData = ku_dynamic_cast<ProjectGraphCypherBindData*>(input.bindData);
30-
auto& graphEntrySet = input.context->clientContext->getGraphEntrySetUnsafe();
31-
graphEntrySet.validateGraphNotExist(bindData->graphName);
30+
auto graphEntrySet = GraphEntrySet::Get(*input.context->clientContext);
31+
graphEntrySet->validateGraphNotExist(bindData->graphName);
3232
// bind graph entry to check if input is valid or not. Ignore bind result.
3333
auto parsedStatements = parser::Parser::parseQuery(bindData->cypherQuery);
3434
KU_ASSERT(parsedStatements.size() == 1);
3535
auto binder = binder::Binder(input.context->clientContext);
3636
binder.bind(*parsedStatements[0]);
3737
auto entry = std::make_unique<ParsedCypherGraphEntry>(bindData->cypherQuery);
38-
graphEntrySet.addGraph(bindData->graphName, std::move(entry));
38+
graphEntrySet->addGraph(bindData->graphName, std::move(entry));
3939
return 0;
4040
}
4141

src/function/table/project_native_graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#include "common/types/value/nested.h"
33
#include "function/gds/gds.h"
44
#include "function/table/bind_data.h"
5+
#include "function/table/bind_input.h"
56
#include "function/table/standalone_call_function.h"
67
#include "graph/graph_entry_set.h"
7-
#include "main/client_context.h"
88
#include "parser/parser.h"
99
#include "processor/execution_context.h"
1010

@@ -34,12 +34,12 @@ struct ProjectGraphNativeBindData final : TableFuncBindData {
3434

3535
static offset_t tableFunc(const TableFuncInput& input, TableFuncOutput&) {
3636
const auto bindData = ku_dynamic_cast<ProjectGraphNativeBindData*>(input.bindData);
37-
auto& graphEntrySet = input.context->clientContext->getGraphEntrySetUnsafe();
38-
graphEntrySet.validateGraphNotExist(bindData->graphName);
37+
auto graphEntrySet = GraphEntrySet::Get(*input.context->clientContext);
38+
graphEntrySet->validateGraphNotExist(bindData->graphName);
3939
auto entry = std::make_unique<ParsedNativeGraphEntry>(bindData->nodeInfos, bindData->relInfos);
4040
// bind graph entry to check if input is valid or not. Ignore bind result.
4141
GDSFunction::bindGraphEntry(*input.context->clientContext, *entry);
42-
graphEntrySet.addGraph(bindData->graphName, std::move(entry));
42+
graphEntrySet->addGraph(bindData->graphName, std::move(entry));
4343
return 0;
4444
}
4545

src/function/table/projected_graph_info.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "function/table/bind_input.h"
55
#include "function/table/simple_table_function.h"
66
#include "graph/graph_entry_set.h"
7-
#include "main/client_context.h"
87

98
using namespace kuzu::common;
109
using namespace kuzu::main;
@@ -103,11 +102,11 @@ static std::unique_ptr<TableFuncBindData> bindFunc(const ClientContext* context,
103102
std::vector<std::string> returnColumnNames;
104103
std::vector<LogicalType> returnTypes;
105104
auto graphName = input->getValue(0).toString();
106-
auto& graphEntrySet = context->getGraphEntrySet();
107-
if (!graphEntrySet.hasGraph(graphName)) {
105+
auto graphEntrySet = graph::GraphEntrySet::Get(*context);
106+
if (!graphEntrySet->hasGraph(graphName)) {
108107
throw BinderException(stringFormat("Graph {} does not exist.", graphName));
109108
}
110-
auto graphEntry = graphEntrySet.getEntry(graphName);
109+
auto graphEntry = graphEntrySet->getEntry(graphName);
111110
switch (graphEntry->type) {
112111
case graph::GraphEntryType::CYPHER: {
113112
returnColumnNames.emplace_back("cypher statement");

src/function/table/show_projected_graphs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "function/table/bind_input.h"
44
#include "function/table/simple_table_function.h"
55
#include "graph/graph_entry_set.h"
6-
#include "main/client_context.h"
76

87
using namespace kuzu::common;
98
using namespace kuzu::main;
@@ -57,7 +56,7 @@ static std::unique_ptr<TableFuncBindData> bindFunc(const ClientContext* context,
5756
TableFunction::extractYieldVariables(returnColumnNames, input->yieldVariables);
5857
auto columns = input->binder->createVariables(returnColumnNames, returnTypes);
5958
std::vector<ProjectedGraphData> projectedGraphData;
60-
for (auto& [name, entry] : context->getGraphEntrySet().getNameToEntryMap()) {
59+
for (auto& [name, entry] : graph::GraphEntrySet::Get(*context)->getNameToEntryMap()) {
6160
projectedGraphData.emplace_back(name, graph::GraphEntryTypeUtils::toString(entry->type));
6261
}
6362
return std::make_unique<ShowProjectedGraphBindData>(std::move(projectedGraphData),

0 commit comments

Comments
 (0)