aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraneporada <aneporada@yandex-team.ru>2022-03-27 14:34:50 +0300
committeraneporada <aneporada@yandex-team.ru>2022-03-27 14:34:50 +0300
commiteba7afc473d087b21d8bfdfc1398f50fd8452aaf (patch)
tree1bb52c92c1eb4341a170603fd3cca63a2cc02881
parent24296a187653e35eea8e65547a030c785726b01e (diff)
downloadydb-eba7afc473d087b21d8bfdfc1398f50fd8452aaf.tar.gz
[YQL-14488] Add literal constructors (for example PgIn4('123')) for Pg types
ref:ebd5dea8dc0971d6b98789bf3dfb29bc7a122ee9
-rw-r--r--ydb/library/yql/sql/v1/builtin.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/ydb/library/yql/sql/v1/builtin.cpp b/ydb/library/yql/sql/v1/builtin.cpp
index 915a8301e1..1e05fe9bbc 100644
--- a/ydb/library/yql/sql/v1/builtin.cpp
+++ b/ydb/library/yql/sql/v1/builtin.cpp
@@ -3210,14 +3210,18 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec
auto scriptName = NKikimr::NMiniKQL::ScriptTypeAsStr(scriptType);
return new TScriptUdf(pos, TString(scriptName), name, args);
} else if (ns.empty()) {
- if (auto simpleType = LookupSimpleTypeBySqlAlias(normalizedName, ctx.FlexibleTypes)) {
- const auto type = ToString(*simpleType);
+ if (auto simpleType = LookupSimpleType(normalizedName, ctx.FlexibleTypes, /* isPgType = */ false)) {
+ const auto type = *simpleType;
if (NUdf::FindDataSlot(type)) {
YQL_ENSURE(type != "Decimal");
return new TYqlData(pos, type, args);
}
- if (type == "Void" || type == "EmptyList" || type == "EmptyDict") {
+ if (type.StartsWith("pg")) {
+ TVector<TNodePtr> pgConstArgs = args;
+ pgConstArgs.push_back(new TCallNodeImpl(pos, "PgType", { BuildQuotedAtom(pos, type.substr(2)) }));
+ return new TYqlPgConst(pos, pgConstArgs);
+ } else if (type == "Void" || type == "EmptyList" || type == "EmptyDict") {
return new TCallNodeImpl(pos, type, 0, 0, args);
} else {
return new TInvalidBuiltin(pos, TStringBuilder() << "Can not create objects of type " << type);