diff options
author | aneporada <aneporada@yandex-team.ru> | 2022-03-18 16:37:33 +0300 |
---|---|---|
committer | aneporada <aneporada@yandex-team.ru> | 2022-03-18 16:37:33 +0300 |
commit | 08175bcf3740a32777cc5d96808cfebd8964015f (patch) | |
tree | d56852308562c84ce7253dca730b1a512a25c44f | |
parent | fa10836d4d541d41db03f351ec1afcd1a15b1cd7 (diff) | |
download | ydb-08175bcf3740a32777cc5d96808cfebd8964015f.tar.gz |
[YQL-14487] Turn on PgTypes by default
ref:36ab727a6d389bf4099033b742b83dc85b69839e
-rw-r--r-- | ydb/library/yql/core/yql_type_annotation.h | 2 | ||||
-rw-r--r-- | ydb/library/yql/sql/pg/pg_sql.cpp | 4 | ||||
-rw-r--r-- | ydb/library/yql/sql/settings/translation_settings.cpp | 4 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/context.cpp | 1 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/context.h | 1 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/query.cpp | 5 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql.cpp | 6 |
7 files changed, 5 insertions, 18 deletions
diff --git a/ydb/library/yql/core/yql_type_annotation.h b/ydb/library/yql/core/yql_type_annotation.h index 3f960f0613..452652bbff 100644 --- a/ydb/library/yql/core/yql_type_annotation.h +++ b/ydb/library/yql/core/yql_type_annotation.h @@ -226,7 +226,7 @@ struct TTypeAnnotationContext: public TThrRefBase { bool OrderedColumns = false; TColumnOrderStorage::TPtr ColumnOrderStorage = new TColumnOrderStorage; - bool PgTypes = false; + bool PgTypes = true; TMaybe<TColumnOrder> LookupColumnOrder(const TExprNode& node) const; IGraphTransformer::TStatus SetColumnOrder(const TExprNode& node, const TColumnOrder& columnOrder, TExprContext& ctx); diff --git a/ydb/library/yql/sql/pg/pg_sql.cpp b/ydb/library/yql/sql/pg/pg_sql.cpp index aabf04f8fc..d4e3dc0c4a 100644 --- a/ydb/library/yql/sql/pg/pg_sql.cpp +++ b/ydb/library/yql/sql/pg/pg_sql.cpp @@ -149,9 +149,9 @@ public: auto configSource = L(A("DataSource"), QA(TString(NYql::ConfigProviderName))); Statements.push_back(L(A("let"), A("world"), L(A(TString(NYql::ConfigureName)), A("world"), configSource, QA("OrderedColumns")))); - if (Settings.PgTypes) { + if (!Settings.PgTypes) { Statements.push_back(L(A("let"), A("world"), L(A(TString(NYql::ConfigureName)), A("world"), configSource, - QA("PgTypes")))); + QA("DisablePgTypes")))); } if (DqEngineEnabled) { diff --git a/ydb/library/yql/sql/settings/translation_settings.cpp b/ydb/library/yql/sql/settings/translation_settings.cpp index a472588cf3..c03821f3c0 100644 --- a/ydb/library/yql/sql/settings/translation_settings.cpp +++ b/ydb/library/yql/sql/settings/translation_settings.cpp @@ -37,7 +37,7 @@ namespace NSQLTranslation { , SyntaxVersion(0) , AnsiLexer(false) , PgParser(false) - , PgTypes(false) + , PgTypes(true) , InferSyntaxVersion(false) , V0Behavior(EV0Behavior::Silent) , V0ForceDisable(InTestEnvironment()) @@ -106,9 +106,9 @@ namespace NSQLTranslation { settings.AnsiLexer = true; } else if (value == "syntax_pg") { settings.PgParser = true; + settings.PgTypes = false; } else if (value == "syntax_pg_types") { settings.PgParser = true; - settings.PgTypes = true; } else { issues.AddIssue(NYql::YqlIssue(NYql::TPosition(0, lineNumber), NYql::TIssuesIds::DEFAULT_ERROR, TStringBuilder() << "Unknown SQL translation setting: " << value)); diff --git a/ydb/library/yql/sql/v1/context.cpp b/ydb/library/yql/sql/v1/context.cpp index 34baf933b4..85c5001638 100644 --- a/ydb/library/yql/sql/v1/context.cpp +++ b/ydb/library/yql/sql/v1/context.cpp @@ -54,7 +54,6 @@ THashMap<TStringBuf, TPragmaField> CTX_PRAGMA_FIELDS = { {"UnorderedSubqueries", &TContext::UnorderedSubqueries}, {"FlexibleTypes", &TContext::FlexibleTypes}, {"AnsiCurrentRow", &TContext::AnsiCurrentRow}, - {"PgTypes", &TContext::PgTypes}, }; typedef TMaybe<bool> TContext::*TPragmaMaybeField; diff --git a/ydb/library/yql/sql/v1/context.h b/ydb/library/yql/sql/v1/context.h index 0faea0b002..8c09bef194 100644 --- a/ydb/library/yql/sql/v1/context.h +++ b/ydb/library/yql/sql/v1/context.h @@ -259,7 +259,6 @@ namespace NSQLTranslationV1 { bool FlexibleTypes = false; // see YQL-10265 bool AnsiCurrentRow = false; - bool PgTypes = false; THashMap<TString, TMaybe<TString>> Libraries; // alias -> optional file THashMap<TString, ui32> PackageVersions; NYql::TWarningPolicy WarningPolicy; diff --git a/ydb/library/yql/sql/v1/query.cpp b/ydb/library/yql/sql/v1/query.cpp index a4269dbcf4..df41d79a87 100644 --- a/ydb/library/yql/sql/v1/query.cpp +++ b/ydb/library/yql/sql/v1/query.cpp @@ -1775,11 +1775,6 @@ public: BuildQuotedAtom(Pos, "Attr"), BuildQuotedAtom(Pos, "Dummy_"), BuildQuotedAtom(Pos, "1")))); } } - - if (ctx.PgTypes) { - Add(Y("let", "world", Y(TString(ConfigureName), "world", configSource, - BuildQuotedAtom(Pos, "PgTypes")))); - } } } diff --git a/ydb/library/yql/sql/v1/sql.cpp b/ydb/library/yql/sql/v1/sql.cpp index 12188a0260..876ed51587 100644 --- a/ydb/library/yql/sql/v1/sql.cpp +++ b/ydb/library/yql/sql/v1/sql.cpp @@ -9651,12 +9651,6 @@ TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success } else if (normalizedPragma == "disableansicurrentrow") { Ctx.AnsiCurrentRow = false; Ctx.IncrementMonCounter("sql_pragma", "DisableAnsiCurrentRow"); - } else if (normalizedPragma == "pgtypes") { - Ctx.PgTypes = true; - Ctx.IncrementMonCounter("sql_pragma", "PgTypes"); - } else if (normalizedPragma == "disablepgtypes") { - Ctx.PgTypes = false; - Ctx.IncrementMonCounter("sql_pragma", "DisablePgTypes"); } else { Error() << "Unknown pragma: " << pragma; Ctx.IncrementMonCounter("sql_errors", "UnknownPragma"); |