Skip to content

Revert "external table content has been decoded for viewer (#1055)" #1190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ydb/core/base/appdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "event_filter.h"

#include <ydb/core/control/immediate_control_board_impl.h>
#include <ydb/core/external_sources/external_source_factory.h>
#include <ydb/core/grpc_services/grpc_helper.h>
#include <ydb/core/protos/auth.pb.h>
#include <ydb/core/protos/cms.pb.h>
Expand Down
6 changes: 0 additions & 6 deletions ydb/core/base/appdata_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ namespace NYdb {

namespace NKikimr {

namespace NExternalSource {
struct IExternalSourceFactory;
}

namespace NScheme {
class TTypeRegistry;
}
Expand Down Expand Up @@ -152,8 +148,6 @@ struct TAppData {
const NDataShard::IExportFactory *DataShardExportFactory = nullptr;
const TFormatFactory* FormatFactory = nullptr;
const NSQS::IEventsWriterFactory* SqsEventsWriterFactory = nullptr;
TIntrusivePtr<NExternalSource::IExternalSourceFactory> ExternalSourceFactory = nullptr;


NSQS::IAuthFactory* SqsAuthFactory = nullptr;

Expand Down
7 changes: 0 additions & 7 deletions ydb/core/driver_lib/run/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,6 @@ void TKikimrRunner::InitializeAppData(const TKikimrRunConfig& runConfig)
AppData->PersQueueGetReadSessionsInfoWorkerFactory = ModuleFactories ? ModuleFactories->PQReadSessionsInfoWorkerFactory.get() : nullptr;
AppData->IoContextFactory = ModuleFactories ? ModuleFactories->IoContextFactory.get() : nullptr;

std::vector<TString> hostnamePatterns;
if (runConfig.AppConfig.HasQueryServiceConfig()) {
const auto& patterns = runConfig.AppConfig.GetQueryServiceConfig().GetHostnamePatterns();
hostnamePatterns = {patterns.begin(), patterns.end()};
}
AppData->ExternalSourceFactory = NExternalSource::CreateExternalSourceFactory(hostnamePatterns);

AppData->SqsAuthFactory = ModuleFactories
? ModuleFactories->SqsAuthFactory.get()
: nullptr;
Expand Down
5 changes: 3 additions & 2 deletions ydb/core/kqp/host/kqp_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,8 +1517,8 @@ class TKqpHost : public IKqpHost {

auto queryExecutor = MakeIntrusive<TKqpQueryExecutor>(Gateway, Cluster, SessionCtx, KqpRunner);
auto kikimrDataSource = CreateKikimrDataSource(*FuncRegistry, *TypesCtx, gatewayProxy, SessionCtx,
AppData()->ExternalSourceFactory, IsInternalCall);
auto kikimrDataSink = CreateKikimrDataSink(*FuncRegistry, *TypesCtx, gatewayProxy, SessionCtx, AppData()->ExternalSourceFactory, queryExecutor);
ExternalSourceFactory, IsInternalCall);
auto kikimrDataSink = CreateKikimrDataSink(*FuncRegistry, *TypesCtx, gatewayProxy, SessionCtx, ExternalSourceFactory, queryExecutor);

FillSettings.AllResultsBytesLimit = Nothing();
FillSettings.RowsLimitPerWrite = SessionCtx->Config()._ResultRowsLimit.Get();
Expand Down Expand Up @@ -1649,6 +1649,7 @@ class TKqpHost : public IKqpHost {

TIntrusivePtr<TExecuteContext> ExecuteCtx;
TIntrusivePtr<IKqpRunner> KqpRunner;
NExternalSource::IExternalSourceFactory::TPtr ExternalSourceFactory{NExternalSource::CreateExternalSourceFactory({})};

TKqpTempTablesState::TConstPtr TempTablesState;
NActors::TActorSystem* ActorSystem = nullptr;
Expand Down
7 changes: 0 additions & 7 deletions ydb/core/testlib/actors/test_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/blobstorage.h>
#include <ydb/core/base/counters.h>
#include <ydb/core/external_sources/external_source_factory.h>
#include <ydb/core/mon/sync_http_mon.h>
#include <ydb/core/mon_alloc/profiler.h>
#include <ydb/core/tablet/tablet_impl.h>
Expand Down Expand Up @@ -154,12 +153,6 @@ namespace NActors {
nodeAppData->S3ProxyResolverConfig = app0->S3ProxyResolverConfig;
nodeAppData->EnableMvccSnapshotWithLegacyDomainRoot = app0->EnableMvccSnapshotWithLegacyDomainRoot;
nodeAppData->IoContextFactory = app0->IoContextFactory;
if (app0->ExternalSourceFactory) {
nodeAppData->ExternalSourceFactory = app0->ExternalSourceFactory;
} else {
nodeAppData->ExternalSourceFactory = NKikimr::NExternalSource::CreateExternalSourceFactory({});
}

if (KeyConfigGenerator) {
nodeAppData->KeyConfig = KeyConfigGenerator(nodeIndex);
} else {
Expand Down
2 changes: 0 additions & 2 deletions ydb/core/testlib/test_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ namespace Tests {
appData.DataStreamsAuthFactory = Settings->DataStreamsAuthFactory.get();
appData.PersQueueMirrorReaderFactory = Settings->PersQueueMirrorReaderFactory.get();
appData.HiveConfig.MergeFrom(Settings->AppConfig->GetHiveConfig());
const auto& hostnamePatterns = Settings->AppConfig->GetQueryServiceConfig().GetHostnamePatterns();
appData.ExternalSourceFactory = NExternalSource::CreateExternalSourceFactory(std::vector<TString>(hostnamePatterns.begin(), hostnamePatterns.end()));

appData.DynamicNameserviceConfig = new TDynamicNameserviceConfig;
auto dnConfig = appData.DynamicNameserviceConfig;
Expand Down
6 changes: 5 additions & 1 deletion ydb/core/tx/schemeshard/schemeshard_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4271,7 +4271,6 @@ void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
EnableStatistics = appData->FeatureFlags.GetEnableStatistics();
EnableTablePgTypes = appData->FeatureFlags.GetEnableTablePgTypes();
EnableServerlessExclusiveDynamicNodes = appData->FeatureFlags.GetEnableServerlessExclusiveDynamicNodes();
ExternalSourceFactory = appData->ExternalSourceFactory;

ConfigureCompactionQueues(appData->CompactionConfig, ctx);
ConfigureStatsBatching(appData->SchemeShardConfig, ctx);
Expand Down Expand Up @@ -6720,6 +6719,11 @@ void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfi
LoadTableProfiles(nullptr, ctx);
}

if (appConfig.HasQueryServiceConfig()) {
const auto& hostnamePatterns = appConfig.GetQueryServiceConfig().GetHostnamePatterns();
ExternalSourceFactory = NExternalSource::CreateExternalSourceFactory(std::vector<TString>(hostnamePatterns.begin(), hostnamePatterns.end()));
}

if (IsSchemeShardConfigured()) {
StartStopCompactionQueues();
}
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/schemeshard_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class TSchemeShard
TActorId DelayedInitTenantDestination;
TAutoPtr<TEvSchemeShard::TEvInitTenantSchemeShardResult> DelayedInitTenantReply;

NExternalSource::IExternalSourceFactory::TPtr ExternalSourceFactory;
NExternalSource::IExternalSourceFactory::TPtr ExternalSourceFactory{NExternalSource::CreateExternalSourceFactory({})};

THolder<TProposeResponse> IgniteOperation(TProposeRequest& request, TOperationContext& context);
THolder<TEvDataShard::TEvProposeTransaction> MakeDataShardProposal(const TPathId& pathId, const TOperationId& opId,
Expand Down
36 changes: 0 additions & 36 deletions ydb/core/viewer/json_describe.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {
headers = HTTPFORBIDDENJSON;
}
TProtoToJson::ProtoToJson(json, *DescribeResult, JsonSettings);
DecodeExternalTableContent(json);
} else {
json << "null";
}
Expand All @@ -277,41 +276,6 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {
PassAway();
}

void DecodeExternalTableContent(TStringStream& json) const {
if (!DescribeResult) {
return;
}

if (!DescribeResult->GetPathDescription().HasExternalTableDescription()) {
return;
}

const auto& content = DescribeResult->GetPathDescription().GetExternalTableDescription().GetContent();
if (!content) {
return;
}

NJson::TJsonValue root;
const auto& sourceType = DescribeResult->GetPathDescription().GetExternalTableDescription().GetSourceType();
try {
NJson::ReadJsonTree(json.Str(), &root);
root["PathDescription"]["ExternalTableDescription"].EraseValue("Content");
auto source = AppData()->ExternalSourceFactory->GetOrCreate(sourceType);
auto parameters = source->GetParameters(content);
for (const auto& [key, items]: parameters) {
NJson::TJsonValue array{NJson::EJsonValueType::JSON_ARRAY};
for (const auto& item: items) {
array.AppendValue(item);
}
root["PathDescription"]["ExternalTableDescription"]["Content"][key] = array;
}
} catch (...) {
BLOG_CRIT("Сan't unpack content for external table: " << sourceType << ", error: " << CurrentExceptionMessage());
}
json.Clear();
json << root;
}

void HandleTimeout() {
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPGATEWAYTIMEOUT(Event->Get()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
Expand Down