diff --git a/ydb/core/kqp/provider/yql_kikimr_datasource.cpp b/ydb/core/kqp/provider/yql_kikimr_datasource.cpp index bfe1679f07c6..ed94cdcb2680 100644 --- a/ydb/core/kqp/provider/yql_kikimr_datasource.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_datasource.cpp @@ -710,6 +710,7 @@ class TKikimrDataSource : public TDataProviderBase { const TString tablePath = key.GetTablePath(); auto& tableDesc = SessionCtx->Tables().GetTable(cluster, tablePath); if (key.GetKeyType() == TKikimrKey::Type::Table) { + YQL_ENSURE(tableDesc.Metadata); if (tableDesc.Metadata->Kind == EKikimrTableKind::External) { if (tableDesc.Metadata->ExternalSource.SourceType == ESourceType::ExternalDataSource && tableDesc.Metadata->TableType == NYql::ETableType::Unknown) { ctx.AddError(TIssue(node->Pos(ctx),