Skip to content

Commit 214ec96

Browse files
committed
Fixes
1 parent 23faac5 commit 214ec96

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

ydb/core/kqp/provider/yql_kikimr_provider.cpp

+24-16
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@ struct TKikimrData {
121121
const TKikimrTableDescription* TKikimrTablesData::EnsureTableExists(const TString& cluster,
122122
const TString& table, TPositionHandle pos, TExprContext& ctx) const
123123
{
124-
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
125-
126124
auto tablePath = table;
127-
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
128-
tablePath = tempTableInfoIt->first;
125+
if (TempTablesState) {
126+
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
127+
128+
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
129+
tablePath = tempTableInfoIt->first;
130+
}
129131
}
130132

131133
auto desc = Tables.FindPtr(std::make_pair(cluster, tablePath));
@@ -141,11 +143,13 @@ const TKikimrTableDescription* TKikimrTablesData::EnsureTableExists(const TStrin
141143
}
142144

143145
TKikimrTableDescription& TKikimrTablesData::GetOrAddTable(const TString& cluster, const TString& database, const TString& table, ETableType tableType) {
144-
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
145-
146146
auto tablePath = table;
147-
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
148-
tablePath = tempTableInfoIt->first;
147+
if (TempTablesState) {
148+
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
149+
150+
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
151+
tablePath = tempTableInfoIt->first;
152+
}
149153
}
150154

151155
if (!Tables.FindPtr(std::make_pair(cluster, tablePath))) {
@@ -165,11 +169,13 @@ TKikimrTableDescription& TKikimrTablesData::GetOrAddTable(const TString& cluster
165169
}
166170

167171
TKikimrTableDescription& TKikimrTablesData::GetTable(const TString& cluster, const TString& table) {
168-
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
169-
170172
auto tablePath = table;
171-
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
172-
tablePath = tempTableInfoIt->first;
173+
if (TempTablesState) {
174+
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
175+
176+
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
177+
tablePath = tempTableInfoIt->first;
178+
}
173179
}
174180

175181
auto desc = Tables.FindPtr(std::make_pair(cluster, tablePath));
@@ -181,11 +187,13 @@ TKikimrTableDescription& TKikimrTablesData::GetTable(const TString& cluster, con
181187
const TKikimrTableDescription& TKikimrTablesData::ExistingTable(const TStringBuf& cluster,
182188
const TStringBuf& table) const
183189
{
184-
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
185-
186190
auto tablePath = table;
187-
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
188-
tablePath = tempTableInfoIt->first;
191+
if (TempTablesState) {
192+
auto tempTableInfoIt = TempTablesState->FindInfo(table, true);
193+
194+
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
195+
tablePath = tempTableInfoIt->first;
196+
}
189197
}
190198

191199
auto desc = Tables.FindPtr(std::make_pair(TString(cluster), TString(tablePath)));

ydb/core/kqp/provider/yql_kikimr_provider.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,12 @@ class TKikimrTransactionContextBase : public TThrRefBase {
336336
auto newOp = TYdbOperation(op.GetOperation());
337337
TPosition pos(op.GetPosition().GetColumn(), op.GetPosition().GetRow());
338338

339-
auto tempTableInfoIt = TempTablesState->FindInfo(table, false);
339+
if (TempTablesState) {
340+
auto tempTableInfoIt = TempTablesState->FindInfo(table, false);
340341

341-
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
342-
table = tempTableInfoIt->first + TempTablesState->SessionId;
342+
if (tempTableInfoIt != TempTablesState->TempTables.end()) {
343+
table = tempTableInfoIt->first + TempTablesState->SessionId;
344+
}
343345
}
344346

345347
const auto info = tableInfoMap.FindPtr(table);

ydb/core/kqp/session_actor/kqp_session_actor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
11781178
return {{true, {JoinPath({path.first, path.second}), {path.second, path.first, userToken}}}};
11791179
}
11801180

1181-
auto it = TempTablesState.FindInfo(JoinPath({path.first, path.second}));
1181+
auto it = TempTablesState.FindInfo(JoinPath({path.first, path.second}), true);
11821182
if (it == TempTablesState.TempTables.end()) {
11831183
return std::nullopt;
11841184
}

0 commit comments

Comments
 (0)