diff options
author | Александр Новожилов <mrlolthe1st@ydb.tech> | 2024-06-18 11:33:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 11:33:09 +0300 |
commit | a766899373a0e218173412a542943371f36435f2 (patch) | |
tree | 3a9b03e9fbd2255acfe9e491283d2661100b7252 | |
parent | 05cc35d98bf2bd929c00b02fcd98fd65a1b676ad (diff) | |
download | ydb-a766899373a0e218173412a542943371f36435f2.tar.gz |
Implement new QPlayer: gh side (#5643)
-rw-r--r-- | ydb/library/yql/providers/config/yql_config_provider.cpp | 3 | ||||
-rw-r--r-- | ydb/library/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp | 76 |
2 files changed, 43 insertions, 36 deletions
diff --git a/ydb/library/yql/providers/config/yql_config_provider.cpp b/ydb/library/yql/providers/config/yql_config_provider.cpp index b8a1bbbf82..a235dfd3f4 100644 --- a/ydb/library/yql/providers/config/yql_config_provider.cpp +++ b/ydb/library/yql/providers/config/yql_config_provider.cpp @@ -932,8 +932,7 @@ namespace { return false; } Types.StreamLookupJoin = name == "_EnableStreamLookupJoin"; - } - else { + } else { ctx.AddError(TIssue(pos, TStringBuilder() << "Unsupported command: " << name)); return false; } diff --git a/ydb/library/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp b/ydb/library/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp index 55a6fded63..bf87878f72 100644 --- a/ydb/library/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp +++ b/ydb/library/yql/providers/yt/gateway/qplayer/yql_yt_qplayer_gateway.cpp @@ -208,30 +208,32 @@ public: } auto valueNode = NYT::NodeFromYsonString(item->Value); - data.Meta = MakeIntrusive<TYtTableMetaInfo>(); - auto metaNode = valueNode["Meta"]; - - data.Meta->CanWrite = metaNode["CanWrite"].AsBool(); - data.Meta->DoesExist = metaNode["DoesExist"].AsBool(); - data.Meta->YqlCompatibleScheme = metaNode["YqlCompatibleScheme"].AsBool(); - data.Meta->InferredScheme = metaNode["InferredScheme"].AsBool(); - data.Meta->IsDynamic = metaNode["IsDynamic"].AsBool(); - data.Meta->SqlView = metaNode["SqlView"].AsString(); - data.Meta->SqlViewSyntaxVersion = metaNode["SqlViewSyntaxVersion"].AsUint64(); - for (const auto& x : metaNode["Attrs"].AsMap()) { - data.Meta->Attrs[x.first] = x.second.AsString(); + if (valueNode.HasKey("Meta")) { + data.Meta = MakeIntrusive<TYtTableMetaInfo>(); + auto metaNode = valueNode["Meta"]; + + data.Meta->CanWrite = metaNode["CanWrite"].AsBool(); + data.Meta->DoesExist = metaNode["DoesExist"].AsBool(); + data.Meta->YqlCompatibleScheme = metaNode["YqlCompatibleScheme"].AsBool(); + data.Meta->InferredScheme = metaNode["InferredScheme"].AsBool(); + data.Meta->IsDynamic = metaNode["IsDynamic"].AsBool(); + data.Meta->SqlView = metaNode["SqlView"].AsString(); + data.Meta->SqlViewSyntaxVersion = metaNode["SqlViewSyntaxVersion"].AsUint64(); + for (const auto& x : metaNode["Attrs"].AsMap()) { + data.Meta->Attrs[x.first] = x.second.AsString(); + } + } + if (valueNode.HasKey("Stat")) { + data.Stat = MakeIntrusive<TYtTableStatInfo>(); + auto statNode = valueNode["Stat"]; + data.Stat->Id = statNode["Id"].AsString(); + data.Stat->RecordsCount = statNode["RecordsCount"].AsUint64(); + data.Stat->DataSize = statNode["DataSize"].AsUint64(); + data.Stat->ChunkCount = statNode["ChunkCount"].AsUint64(); + data.Stat->ModifyTime = statNode["ModifyTime"].AsUint64(); + data.Stat->Revision = statNode["Revision"].AsUint64(); + data.Stat->TableRevision = statNode["TableRevision"].AsUint64(); } - - data.Stat = MakeIntrusive<TYtTableStatInfo>(); - auto statNode = valueNode["Stat"]; - data.Stat->Id = statNode["Id"].AsString(); - data.Stat->RecordsCount = statNode["RecordsCount"].AsUint64(); - data.Stat->DataSize = statNode["DataSize"].AsUint64(); - data.Stat->ChunkCount = statNode["ChunkCount"].AsUint64(); - data.Stat->ModifyTime = statNode["ModifyTime"].AsUint64(); - data.Stat->Revision = statNode["Revision"].AsUint64(); - data.Stat->TableRevision = statNode["TableRevision"].AsUint64(); - data.WriteLock = options.ReadOnly() ? false : valueNode["WriteLock"].AsBool(); res.Data.push_back(data); } @@ -257,12 +259,14 @@ public: const auto& data = res.Data[i]; auto key = MakeGetTableInfoKey(req, optionsDup.Epoch()); - auto attrsNode = NYT::TNode(); - for (const auto& a : data.Meta->Attrs) { - attrsNode(a.first, a.second); + auto attrsNode = NYT::TNode::CreateMap(); + if (data.Meta) { + for (const auto& a : data.Meta->Attrs) { + attrsNode(a.first, a.second); + } } - auto metaNode = NYT::TNode() + auto metaNode = data.Meta ? NYT::TNode() ("CanWrite",data.Meta->CanWrite) ("DoesExist",data.Meta->DoesExist) ("YqlCompatibleScheme",data.Meta->YqlCompatibleScheme) @@ -270,21 +274,25 @@ public: ("IsDynamic",data.Meta->IsDynamic) ("SqlView",data.Meta->SqlView) ("SqlViewSyntaxVersion",ui64(data.Meta->SqlViewSyntaxVersion)) - ("Attrs",attrsNode); + ("Attrs",attrsNode) : NYT::TNode(); - auto statNode = NYT::TNode() + auto statNode = data.Stat ? NYT::TNode() ("Id",data.Stat->Id) ("RecordsCount",data.Stat->RecordsCount) ("DataSize",data.Stat->DataSize) ("ChunkCount",data.Stat->ChunkCount) ("ModifyTime",data.Stat->ModifyTime) ("Revision",data.Stat->Revision) - ("TableRevision",data.Stat->TableRevision); + ("TableRevision",data.Stat->TableRevision) : NYT::TNode(); - auto valueNode = NYT::TNode() - ("Meta", metaNode) - ("Stat", statNode) - ("WriteLock", data.WriteLock); + auto valueNode = NYT::TNode::CreateMap(); + if (data.Meta) { + valueNode("Meta", metaNode); + } + if (data.Stat) { + valueNode("Stat", statNode); + } + valueNode("WriteLock", data.WriteLock); auto value = NYT::NodeToYsonString(valueNode, NYT::NYson::EYsonFormat::Binary); qContext.GetWriter()->Put({YtGateway_GetTableInfo, key},value).GetValueSync(); |