Skip to content

Commit

Permalink
Merge e684b85 into 6e1d0a0
Browse files Browse the repository at this point in the history
  • Loading branch information
azevaykin authored Sep 11, 2024
2 parents 6e1d0a0 + e684b85 commit 2a9e720
Show file tree
Hide file tree
Showing 66 changed files with 282 additions and 238 deletions.
2 changes: 1 addition & 1 deletion ydb/core/engine/minikql/minikql_engine_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ NUdf::TUnboxedValue GetCellValue(const TCell& cell, NScheme::TTypeInfo type) {
}

if (type.GetTypeId() == NScheme::NTypeIds::Pg) {
return NYql::NCommon::PgValueFromNativeBinary(cell.AsBuf(), NPg::PgTypeIdFromTypeDesc(type.GetTypeDesc()));
return NYql::NCommon::PgValueFromNativeBinary(cell.AsBuf(), NPg::PgTypeIdFromTypeDesc(type.GetPgTypeDesc()));
}

Y_DEBUG_ABORT("Unsupported type: %" PRIu16, type.GetTypeId());
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/engine/mkql_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ TCell MakeCell(NScheme::TTypeInfo type, const NUdf::TUnboxedValuePod& value,
NYql::NUdf::TStringRef ref;
bool isPg = (type.GetTypeId() == NScheme::NTypeIds::Pg);
if (isPg) {
auto typeDesc = type.GetTypeDesc();
auto typeDesc = type.GetPgTypeDesc();
if (typmod != -1 && NPg::TypeDescNeedsCoercion(typeDesc)) {
TMaybe<TString> err;
binary = NYql::NCommon::PgValueCoerce(value, NPg::PgTypeIdFromTypeDesc(typeDesc), typmod, &err);
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/engine/mkql_proto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool CellsFromTuple(const NKikimrMiniKQL::TType* tupleType,
if (v.HasBytes()) {
c = TCell(v.GetBytes().data(), v.GetBytes().size());
} else if (v.HasText()) {
auto typeDesc = types[i].GetTypeDesc();
auto typeDesc = types[i].GetPgTypeDesc();
auto convert = NPg::PgNativeBinaryFromNativeText(v.GetText(), NPg::PgTypeIdFromTypeDesc(typeDesc));
if (convert.Error) {
CHECK_OR_RETURN_ERROR(false, Sprintf("Cannot parse value of type Pg: %s in tuple at position %" PRIu32, convert.Error->data(), i));
Expand Down Expand Up @@ -329,7 +329,7 @@ bool CellToValue(NScheme::TTypeInfo type, const TCell& c, NKikimrMiniKQL::TValue
break;

case NScheme::NTypeIds::Pg: {
auto convert = NPg::PgNativeTextFromNativeBinary(c.AsBuf(), type.GetTypeDesc());
auto convert = NPg::PgNativeTextFromNativeBinary(c.AsBuf(), type.GetPgTypeDesc());
if (convert.Error) {
errStr = *convert.Error;
return false;
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/formats/arrow/switch/switch_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ template <typename TFunc>
break; // Deprecated types

case NScheme::NTypeIds::Pg:
switch (NPg::PgTypeIdFromTypeDesc(typeInfo.GetTypeDesc())) {
switch (NPg::PgTypeIdFromTypeDesc(typeInfo.GetPgTypeDesc())) {
case INT2OID:
return callback(TTypeWrapper<arrow::Int16Type>());
case INT4OID:
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/grpc_services/rpc_kh_describe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class TKikhouseDescribeTableRPC : public TActorBootstrapped<TKikhouseDescribeTab
auto& typeInfo = col.second.PType;
auto* item = colMeta->mutable_type();
if (typeInfo.GetTypeId() == NScheme::NTypeIds::Pg) {
auto* typeDesc = typeInfo.GetTypeDesc();
auto typeDesc = typeInfo.GetPgTypeDesc();
auto* pg = item->mutable_pg_type();
pg->set_type_name(NPg::PgTypeNameFromTypeDesc(typeDesc));
pg->set_oid(NPg::PgTypeIdFromTypeDesc(typeDesc));
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/grpc_services/rpc_object_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ bool CellFromTuple(NScheme::TTypeInfo type,
if (tupleValue.Hasbytes_value()) {
c = TCell(tupleValue.Getbytes_value().data(), tupleValue.Getbytes_value().size());
} else if (tupleValue.Hastext_value()) {
auto typeDesc = type.GetTypeDesc();
auto typeDesc = type.GetPgTypeDesc();
auto convert = NPg::PgNativeBinaryFromNativeText(tupleValue.Gettext_value(), NPg::PgTypeIdFromTypeDesc(typeDesc));
if (convert.Error) {
CHECK_OR_RETURN_ERROR(false, Sprintf("Cannot parse value of type Pg: %s in tuple at position %" PRIu32, convert.Error->data(), position));
Expand Down Expand Up @@ -815,7 +815,7 @@ class TObjectStorageListingRequestGrpc : public TActorBootstrapped<TObjectStorag

void FillResultRows(Ydb::ResultSet &resultSet, TVector<TSysTables::TTableColumnInfo> &columns, TVector<TSerializedCellVec> resultRows) {
const auto getPgTypeFromColMeta = [](const auto &colMeta) {
return NYdb::TPgType(NPg::PgTypeNameFromTypeDesc(colMeta.PType.GetTypeDesc()),
return NYdb::TPgType(NPg::PgTypeNameFromTypeDesc(colMeta.PType.GetPgTypeDesc()),
colMeta.PTypeMod);
};

Expand Down Expand Up @@ -846,7 +846,7 @@ class TObjectStorageListingRequestGrpc : public TActorBootstrapped<TObjectStorag
const auto& cell = row.GetCells()[i];
vb.AddMember(colMeta.Name);
if (colMeta.PType.GetTypeId() == NScheme::NTypeIds::Pg) {
const NPg::TConvertResult& pgResult = NPg::PgNativeTextFromNativeBinary(cell.AsBuf(), colMeta.PType.GetTypeDesc());
const NPg::TConvertResult& pgResult = NPg::PgNativeTextFromNativeBinary(cell.AsBuf(), colMeta.PType.GetPgTypeDesc());
if (pgResult.Error) {
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::RPC_REQUEST, "PgNativeTextFromNativeBinary error " << *pgResult.Error);
}
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/grpc_services/rpc_read_rows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class TReadRowsRPC : public TActorBootstrapped<TReadRowsRPC> {
}
} else if (typeInProto.has_pg_type()) {
const auto& typeName = typeInProto.pg_type().type_name();
auto* typeDesc = NPg::TypeDescFromPgTypeName(typeName);
auto typeDesc = NPg::TypeDescFromPgTypeName(typeName);
if (!typeDesc) {
errorMessage = Sprintf("Unknown pg type for column %s: %s",
name.c_str(), typeName.c_str());
Expand Down Expand Up @@ -567,7 +567,7 @@ class TReadRowsRPC : public TActorBootstrapped<TReadRowsRPC> {
auto& ioStats = stats.ReadIOStat;

const auto getPgTypeFromColMeta = [](const auto &colMeta) {
return NYdb::TPgType(NPg::PgTypeNameFromTypeDesc(colMeta.Type.GetTypeDesc()),
return NYdb::TPgType(NPg::PgTypeNameFromTypeDesc(colMeta.Type.GetPgTypeDesc()),
colMeta.PTypeMod);
};

Expand Down Expand Up @@ -604,7 +604,7 @@ class TReadRowsRPC : public TActorBootstrapped<TReadRowsRPC> {
vb.AddMember(colMeta.Name);
if (colMeta.Type.GetTypeId() == NScheme::NTypeIds::Pg)
{
const NPg::TConvertResult& pgResult = NPg::PgNativeTextFromNativeBinary(cell.AsBuf(), colMeta.Type.GetTypeDesc());
const NPg::TConvertResult& pgResult = NPg::PgNativeTextFromNativeBinary(cell.AsBuf(), colMeta.Type.GetPgTypeDesc());
if (pgResult.Error) {
LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::RPC_REQUEST, "PgNativeTextFromNativeBinary error " << *pgResult.Error);
}
Expand Down
30 changes: 15 additions & 15 deletions ydb/core/io_formats/cell_maker/cell_maker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@ namespace {
}

template <typename T>
bool TryParse(TStringBuf value, T& result, TString& err, void* parseParam) {
bool TryParse(TStringBuf value, T& result, TString& err, const NScheme::TTypeInfo& typeInfo) {
Y_UNUSED(value);
Y_UNUSED(result);
Y_UNUSED(err);
Y_UNUSED(parseParam);
Y_ABORT("TryParse with parseParam is unimplemented");
Y_UNUSED(typeInfo);
Y_ABORT("TryParse with typeInfo is unimplemented");
}

template <>
bool TryParse(TStringBuf value, NPg::TConvertResult& result, TString& err, void* typeDesc) {
template<>
bool TryParse<NPg::TConvertResult>(TStringBuf value, NPg::TConvertResult& result, TString& err, const NScheme::TTypeInfo& typeInfo) {
TString unescaped;
if (!CheckedUnescape(value, unescaped)) {
err = MakeError<NPg::TConvertResult>();
return false;
}

result = NPg::PgNativeBinaryFromNativeText(unescaped, typeDesc);
result = NPg::PgNativeBinaryFromNativeText(unescaped, typeInfo.GetPgTypeDesc());
if (result.Error) {
err = *result.Error;
return false;
Expand Down Expand Up @@ -233,9 +233,9 @@ namespace {
return Conv(c, v, pool, conv);
}

static bool Make(TCell& c, TStringBuf v, TMemoryPool& pool, TString& err, TConverter<T, TStringBuf> conv, void* parseParam) {
static bool Make(TCell& c, TStringBuf v, TMemoryPool& pool, TString& err, TConverter<T, TStringBuf> conv, const NScheme::TTypeInfo& typeInfo) {
T t;
if (!TryParse<T>(v, t, err, parseParam)) {
if (!TryParse(v, t, err, typeInfo)) {
return false;
}

Expand Down Expand Up @@ -266,12 +266,12 @@ namespace {

} // anonymous

bool MakeCell(TCell& cell, TStringBuf value, NScheme::TTypeInfo type, TMemoryPool& pool, TString& err) {
bool MakeCell(TCell& cell, TStringBuf value, const NScheme::TTypeInfo& typeInfo, TMemoryPool& pool, TString& err) {
if (value == "null") {
return true;
}

switch (type.GetTypeId()) {
switch (typeInfo.GetTypeId()) {
case NScheme::NTypeIds::Bool:
return TCellMaker<bool>::Make(cell, value, pool, err);
case NScheme::NTypeIds::Int8:
Expand Down Expand Up @@ -322,21 +322,21 @@ bool MakeCell(TCell& cell, TStringBuf value, NScheme::TTypeInfo type, TMemoryPoo
case NScheme::NTypeIds::Decimal:
return TCellMaker<NYql::NDecimal::TInt128, std::pair<ui64, ui64>>::Make(cell, value, pool, err, &Int128ToPair);
case NScheme::NTypeIds::Pg:
return TCellMaker<NPg::TConvertResult, TStringBuf>::Make(cell, value, pool, err, &PgToStringBuf, type.GetTypeDesc());
return TCellMaker<NPg::TConvertResult, TStringBuf>::Make(cell, value, pool, err, &PgToStringBuf, typeInfo);
case NScheme::NTypeIds::Uuid:
return TCellMaker<TUuidHolder, TStringBuf>::Make(cell, value, pool, err, &UuidToStringBuf);
default:
return false;
}
}

bool MakeCell(TCell& cell, const NJson::TJsonValue& value, NScheme::TTypeInfo type, TMemoryPool& pool, TString& err) {
bool MakeCell(TCell& cell, const NJson::TJsonValue& value, const NScheme::TTypeInfo& typeInfo, TMemoryPool& pool, TString& err) {
if (value.IsNull()) {
return true;
}

try {
switch (type.GetTypeId()) {
switch (typeInfo.GetTypeId()) {
case NScheme::NTypeIds::Bool:
return TCellMaker<bool>::MakeDirect(cell, value.GetBooleanSafe(), pool, err);
case NScheme::NTypeIds::Int8:
Expand Down Expand Up @@ -403,12 +403,12 @@ bool MakeCell(TCell& cell, const NJson::TJsonValue& value, NScheme::TTypeInfo ty
}
}

bool CheckCellValue(const TCell& cell, NScheme::TTypeInfo type) {
bool CheckCellValue(const TCell& cell, const NScheme::TTypeInfo& typeInfo) {
if (cell.IsNull()) {
return true;
}

switch (type.GetTypeId()) {
switch (typeInfo.GetTypeId()) {
case NScheme::NTypeIds::Bool:
case NScheme::NTypeIds::Int8:
case NScheme::NTypeIds::Uint8:
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/io_formats/cell_maker/cell_maker.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace NKikimr::NFormats {

bool MakeCell(TCell& cell, TStringBuf value, NScheme::TTypeInfo type, TMemoryPool& pool, TString& err);
bool MakeCell(TCell& cell, const NJson::TJsonValue& value, NScheme::TTypeInfo type, TMemoryPool& pool, TString& err);
bool CheckCellValue(const TCell& cell, NScheme::TTypeInfo type);
bool MakeCell(TCell& cell, TStringBuf value, const NScheme::TTypeInfo& typeInfo, TMemoryPool& pool, TString& err);
bool MakeCell(TCell& cell, const NJson::TJsonValue& value, const NScheme::TTypeInfo& typeInfo, TMemoryPool& pool, TString& err);
bool CheckCellValue(const TCell& cell, const NScheme::TTypeInfo& typeInfo);

}
4 changes: 2 additions & 2 deletions ydb/core/kqp/common/kqp_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NKikimr::NScheme {
void ProtoMiniKQLTypeFromTypeInfo(NKikimrMiniKQL::TType* type, const TTypeInfo typeInfo) {
if (typeInfo.GetTypeId() == NTypeIds::Pg) {
type->SetKind(NKikimrMiniKQL::Pg);
type->MutablePg()->Setoid(NPg::PgTypeIdFromTypeDesc(typeInfo.GetTypeDesc()));
type->MutablePg()->Setoid(NPg::PgTypeIdFromTypeDesc(typeInfo.GetPgTypeDesc()));
} else {
type->SetKind(NKikimrMiniKQL::Data);
type->MutableData()->SetScheme(typeInfo.GetTypeId());
Expand All @@ -28,7 +28,7 @@ TTypeInfo TypeInfoFromProtoMiniKQLType(const NKikimrMiniKQL::TType& type) {

const NMiniKQL::TType* MiniKQLTypeFromTypeInfo(const TTypeInfo typeInfo, const NMiniKQL::TTypeEnvironment& env) {
if (typeInfo.GetTypeId() == NTypeIds::Pg) {
return NMiniKQL::TPgType::Create(NPg::PgTypeIdFromTypeDesc(typeInfo.GetTypeDesc()), env);
return NMiniKQL::TPgType::Create(NPg::PgTypeIdFromTypeDesc(typeInfo.GetPgTypeDesc()), env);
} else {
return NMiniKQL::TDataType::Create((NUdf::TDataTypeId)typeInfo.GetTypeId(), env);
}
Expand Down
13 changes: 5 additions & 8 deletions ydb/core/kqp/compute_actor/kqp_scan_fetcher_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ TKqpScanFetcherActor::TKqpScanFetcherActor(const NKikimrKqp::TKqpSnapshot& snaps
ALS_DEBUG(NKikimrServices::KQP_COMPUTE) << "META:" << meta.DebugString();
KeyColumnTypes.reserve(Meta.GetKeyColumnTypes().size());
for (size_t i = 0; i < Meta.KeyColumnTypesSize(); i++) {
auto typeId = Meta.GetKeyColumnTypes().at(i);
KeyColumnTypes.push_back(NScheme::TTypeInfo(
(NScheme::TTypeId)typeId,
(typeId == NScheme::NTypeIds::Pg) ?
NPg::TypeDescFromPgTypeId(
Meta.GetKeyColumnTypeInfos().at(i).GetPgTypeId()
) : nullptr
));
NScheme::TTypeId typeId = Meta.GetKeyColumnTypes().at(i);
NScheme::TTypeInfo typeInfo = typeId == NScheme::NTypeIds::Pg ?
NScheme::TTypeInfo(typeId, NPg::TypeDescFromPgTypeId(Meta.GetKeyColumnTypeInfos().at(i).GetPgTypeId())) :
NScheme::TTypeInfo(typeId);
KeyColumnTypes.push_back(typeInfo);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ydb/core/kqp/executer_actor/kqp_tasks_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void BuildStreamLookupChannels(TKqpTasksGraph& graph, const TStageInfo& stageInf

if (columnIt->second.Type.GetTypeId() == NScheme::NTypeIds::Pg) {
auto& typeInfo = *keyColumnProto->MutableTypeInfo();
typeInfo.SetPgTypeId(NPg::PgTypeIdFromTypeDesc(columnIt->second.Type.GetTypeDesc()));
typeInfo.SetPgTypeId(NPg::PgTypeIdFromTypeDesc(columnIt->second.Type.GetPgTypeDesc()));
typeInfo.SetPgTypeMod(columnIt->second.TypeMod);
}
}
Expand All @@ -409,7 +409,7 @@ void BuildStreamLookupChannels(TKqpTasksGraph& graph, const TStageInfo& stageInf

if (columnIt->second.Type.GetTypeId() == NScheme::NTypeIds::Pg) {
auto& typeInfo = *columnProto->MutableTypeInfo();
typeInfo.SetPgTypeId(NPg::PgTypeIdFromTypeDesc(columnIt->second.Type.GetTypeDesc()));
typeInfo.SetPgTypeId(NPg::PgTypeIdFromTypeDesc(columnIt->second.Type.GetPgTypeDesc()));
typeInfo.SetPgTypeMod(columnIt->second.TypeMod);
}
}
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/kqp/gateway/kqp_metadata_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ TString GetTypeName(const NScheme::TTypeInfoMod& typeInfoMod) {
if (typeInfoMod.TypeInfo.GetTypeId() != NScheme::NTypeIds::Pg) {
YQL_ENSURE(NScheme::TryGetTypeName(typeInfoMod.TypeInfo.GetTypeId(), typeName));
} else {
YQL_ENSURE(typeInfoMod.TypeInfo.GetTypeDesc(), "no pg type descriptor");
typeName = NPg::PgTypeNameFromTypeDesc(typeInfoMod.TypeInfo.GetTypeDesc(), typeInfoMod.TypeMod);
YQL_ENSURE(typeInfoMod.TypeInfo.GetPgTypeDesc(), "no pg type descriptor");
typeName = NPg::PgTypeNameFromTypeDesc(typeInfoMod.TypeInfo.GetPgTypeDesc(), typeInfoMod.TypeMod);
}
return typeName;
}
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/kqp/provider/read_attributes_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void ReplaceReadAttributes(TExprNode& node,
static Ydb::Type CreateYdbType(const NKikimr::NScheme::TTypeInfo& typeInfo, bool notNull) {
Ydb::Type ydbType;
if (typeInfo.GetTypeId() == NKikimr::NScheme::NTypeIds::Pg) {
auto* typeDesc = typeInfo.GetTypeDesc();
auto typeDesc = typeInfo.GetPgTypeDesc();
auto* pg = ydbType.mutable_pg_type();
pg->set_type_name(NKikimr::NPg::PgTypeNameFromTypeDesc(typeDesc));
pg->set_oid(NKikimr::NPg::PgTypeIdFromTypeDesc(typeDesc));
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/kqp/provider/yql_kikimr_gateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ EYqlIssueCode YqlStatusFromYdbStatus(ui32 ydbStatus) {
}

void SetColumnType(Ydb::Type& protoType, const TString& typeName, bool notNull) {
auto* typeDesc = NKikimr::NPg::TypeDescFromPgTypeName(typeName);
auto typeDesc = NKikimr::NPg::TypeDescFromPgTypeName(typeName);
if (typeDesc) {
Y_ABORT_UNLESS(!notNull, "It is not allowed to create NOT NULL pg columns");
auto* pg = protoType.mutable_pg_type();
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/kqp/provider/yql_kikimr_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ bool TKikimrTableDescription::Load(TExprContext& ctx, bool withSystemColumns) {
if (column.TypeInfo.GetTypeId() != NKikimr::NScheme::NTypeIds::Pg) {
type = ctx.MakeType<TDataExprType>(NKikimr::NUdf::GetDataSlot(column.Type));
} else {
type = ctx.MakeType<TPgExprType>(NKikimr::NPg::PgTypeIdFromTypeDesc(column.TypeInfo.GetTypeDesc()));
type = ctx.MakeType<TPgExprType>(NKikimr::NPg::PgTypeIdFromTypeDesc(column.TypeInfo.GetPgTypeDesc()));
}
}

Expand Down Expand Up @@ -668,7 +668,7 @@ std::optional<TString> FillLiteralProto(NNodes::TExprBase maybeLiteral, const TT
auto actualPgType = valueType->Cast<TPgExprType>();
YQL_ENSURE(actualPgType);

auto* typeDesc = NKikimr::NPg::TypeDescFromPgTypeId(actualPgType->GetId());
auto typeDesc = NKikimr::NPg::TypeDescFromPgTypeId(actualPgType->GetId());
if (!typeDesc) {
return TStringBuilder() << "Failed to parse default expr typename " << actualPgType->GetName();
}
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/kqp/provider/yql_kikimr_results.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ const TTypeAnnotationNode* ParseTypeFromYdbType(const Ydb::Type& type, TExprCont
case Ydb::Type::kPgType: {
if (!type.pg_type().type_name().empty()) {
const auto& typeName = type.pg_type().type_name();
auto* typeDesc = NKikimr::NPg::TypeDescFromPgTypeName(typeName);
auto typeDesc = NKikimr::NPg::TypeDescFromPgTypeName(typeName);
return ctx.MakeType<TPgExprType>(NKikimr::NPg::PgTypeIdFromTypeDesc(typeDesc));
}
return ctx.MakeType<TPgExprType>(type.pg_type().Getoid());
Expand Down
8 changes: 4 additions & 4 deletions ydb/core/kqp/query_compiler/kqp_mkql_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ TVector<TKqpTableColumn> GetKqpColumns(const TKikimrTableMetadata& table, const
ui32 columnId = 0;
ui32 columnType = 0;
bool notNull = false;
void* columnTypeDesc = nullptr;
NScheme::TTypeInfo columnTypeInfo;

auto columnData = table.Columns.FindPtr(name);
if (columnData) {
columnId = columnData->Id;
columnType = columnData->TypeInfo.GetTypeId();
if (columnType == NScheme::NTypeIds::Pg) {
columnTypeDesc = columnData->TypeInfo.GetTypeDesc();
columnTypeInfo = columnData->TypeInfo;
}
notNull = columnData->NotNull;
} else if (allowSystemColumns) {
Expand All @@ -43,7 +43,7 @@ TVector<TKqpTableColumn> GetKqpColumns(const TKikimrTableMetadata& table, const
}

YQL_ENSURE(columnId, "Unknown column: " << name);
pgmColumns.emplace_back(columnId, name, columnType, notNull, columnTypeDesc);
pgmColumns.emplace_back(columnId, name, columnType, notNull, columnTypeInfo);
}

return pgmColumns;
Expand Down Expand Up @@ -77,7 +77,7 @@ NMiniKQL::TType* CreateColumnType(const NKikimr::NScheme::TTypeInfo& typeInfo, c
if (typeId == NUdf::TDataType<NUdf::TDecimal>::Id) {
return ctx.PgmBuilder().NewDecimalType(22, 9);
} else if (typeId == NKikimr::NScheme::NTypeIds::Pg) {
return ctx.PgmBuilder().NewPgType(NPg::PgTypeIdFromTypeDesc(typeInfo.GetTypeDesc()));
return ctx.PgmBuilder().NewPgType(NPg::PgTypeIdFromTypeDesc(typeInfo.GetPgTypeDesc()));
} else {
return ctx.PgmBuilder().NewDataType(typeId);
}
Expand Down
Loading

0 comments on commit 2a9e720

Please sign in to comment.