aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2025-04-23 18:13:40 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2025-04-23 18:26:05 +0300
commit58e50fbe999692bfde1c6a175ccf0d59f55b9658 (patch)
tree2121d3e4413423e05c7204e099f1994d96e7be9e
parentac324b9ce470cd7bec4d18dbe5e77495e96f92b8 (diff)
downloadydb-58e50fbe999692bfde1c6a175ccf0d59f55b9658.tar.gz
Intermediate changes
commit_hash:9b9fa862d523687c3eb883e9b94c2ecef522cda8
-rw-r--r--contrib/restricted/boost/algorithm/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/algorithm/ya.make4
-rw-r--r--contrib/restricted/boost/date_time/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/date_time/ya.make4
-rw-r--r--contrib/restricted/boost/functional/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/functional/ya.make4
-rw-r--r--contrib/restricted/boost/icl/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/icl/ya.make4
-rw-r--r--contrib/restricted/boost/io/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/io/ya.make4
-rw-r--r--contrib/restricted/boost/numeric_conversion/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/numeric_conversion/ya.make4
-rw-r--r--contrib/restricted/boost/phoenix/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/phoenix/ya.make4
-rw-r--r--contrib/restricted/boost/property_tree/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/property_tree/ya.make4
-rw-r--r--contrib/restricted/boost/regex/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/regex/ya.make4
-rw-r--r--contrib/restricted/boost/serialization/.yandex_meta/default.nix2
-rw-r--r--contrib/restricted/boost/serialization/ya.make4
-rw-r--r--yql/essentials/docs/en/syntax/lexer.md25
-rw-r--r--yql/essentials/docs/ru/syntax/lexer.md81
22 files changed, 82 insertions, 84 deletions
diff --git a/contrib/restricted/boost/algorithm/.yandex_meta/default.nix b/contrib/restricted/boost/algorithm/.yandex_meta/default.nix
index 86f74f56fd9..cd87223920e 100644
--- a/contrib/restricted/boost/algorithm/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/algorithm/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_algorithm = stdenv.mkDerivation rec {
pname = "boost_algorithm";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/algorithm/ya.make b/contrib/restricted/boost/algorithm/ya.make
index 0ed2855a8e4..333c9cb9843 100644
--- a/contrib/restricted/boost/algorithm/ya.make
+++ b/contrib/restricted/boost/algorithm/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/algorithm/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/algorithm/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/array
diff --git a/contrib/restricted/boost/date_time/.yandex_meta/default.nix b/contrib/restricted/boost/date_time/.yandex_meta/default.nix
index 88b8b8b297f..37a386f79c1 100644
--- a/contrib/restricted/boost/date_time/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/date_time/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_date_time = stdenv.mkDerivation rec {
pname = "boost_date_time";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/date_time/ya.make b/contrib/restricted/boost/date_time/ya.make
index 37d7c502489..9a7f1fbfe43 100644
--- a/contrib/restricted/boost/date_time/ya.make
+++ b/contrib/restricted/boost/date_time/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/date_time/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/date_time/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/algorithm
diff --git a/contrib/restricted/boost/functional/.yandex_meta/default.nix b/contrib/restricted/boost/functional/.yandex_meta/default.nix
index 9b1acfdc083..60a4bf791ea 100644
--- a/contrib/restricted/boost/functional/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/functional/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_functional = stdenv.mkDerivation rec {
pname = "boost_functional";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/functional/ya.make b/contrib/restricted/boost/functional/ya.make
index 3eafe1d62a2..e9203468e01 100644
--- a/contrib/restricted/boost/functional/ya.make
+++ b/contrib/restricted/boost/functional/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/functional/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/functional/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/config
diff --git a/contrib/restricted/boost/icl/.yandex_meta/default.nix b/contrib/restricted/boost/icl/.yandex_meta/default.nix
index bbeceee4431..49006ec788b 100644
--- a/contrib/restricted/boost/icl/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/icl/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_icl = stdenv.mkDerivation rec {
pname = "boost_icl";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/icl/ya.make b/contrib/restricted/boost/icl/ya.make
index e3947c9cd9d..69ad9dbf64a 100644
--- a/contrib/restricted/boost/icl/ya.make
+++ b/contrib/restricted/boost/icl/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/icl/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/icl/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/assert
diff --git a/contrib/restricted/boost/io/.yandex_meta/default.nix b/contrib/restricted/boost/io/.yandex_meta/default.nix
index 22864dc36f6..d58f69c0465 100644
--- a/contrib/restricted/boost/io/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/io/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_io = stdenv.mkDerivation rec {
pname = "boost_io";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/io/ya.make b/contrib/restricted/boost/io/ya.make
index b3462f4776f..bf672a1c333 100644
--- a/contrib/restricted/boost/io/ya.make
+++ b/contrib/restricted/boost/io/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/io/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/io/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/config
diff --git a/contrib/restricted/boost/numeric_conversion/.yandex_meta/default.nix b/contrib/restricted/boost/numeric_conversion/.yandex_meta/default.nix
index 3ce931208ea..1603ed8a8c9 100644
--- a/contrib/restricted/boost/numeric_conversion/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/numeric_conversion/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_numeric_conversion = stdenv.mkDerivation rec {
pname = "boost_numeric_conversion";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/numeric_conversion/ya.make b/contrib/restricted/boost/numeric_conversion/ya.make
index 1e7fd5d076e..091177344a3 100644
--- a/contrib/restricted/boost/numeric_conversion/ya.make
+++ b/contrib/restricted/boost/numeric_conversion/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/numeric_conversion/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/numeric_conversion/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/config
diff --git a/contrib/restricted/boost/phoenix/.yandex_meta/default.nix b/contrib/restricted/boost/phoenix/.yandex_meta/default.nix
index 3fc6b2ed7e4..9de49745e82 100644
--- a/contrib/restricted/boost/phoenix/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/phoenix/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_phoenix = stdenv.mkDerivation rec {
pname = "boost_phoenix";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/phoenix/ya.make b/contrib/restricted/boost/phoenix/ya.make
index c612414a7cc..477f3be1a09 100644
--- a/contrib/restricted/boost/phoenix/ya.make
+++ b/contrib/restricted/boost/phoenix/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/phoenix/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/phoenix/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/assert
diff --git a/contrib/restricted/boost/property_tree/.yandex_meta/default.nix b/contrib/restricted/boost/property_tree/.yandex_meta/default.nix
index 73859ea8b81..4f2f6dd20ce 100644
--- a/contrib/restricted/boost/property_tree/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/property_tree/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_property_tree = stdenv.mkDerivation rec {
pname = "boost_property_tree";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/property_tree/ya.make b/contrib/restricted/boost/property_tree/ya.make
index 67823683685..587b04d2bec 100644
--- a/contrib/restricted/boost/property_tree/ya.make
+++ b/contrib/restricted/boost/property_tree/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/property_tree/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/property_tree/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/any
diff --git a/contrib/restricted/boost/regex/.yandex_meta/default.nix b/contrib/restricted/boost/regex/.yandex_meta/default.nix
index 6cdcb55519a..a5567f5159a 100644
--- a/contrib/restricted/boost/regex/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/regex/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_regex = stdenv.mkDerivation rec {
pname = "boost_regex";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/regex/ya.make b/contrib/restricted/boost/regex/ya.make
index 7d0c8cfa6c8..802944f50e6 100644
--- a/contrib/restricted/boost/regex/ya.make
+++ b/contrib/restricted/boost/regex/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSL-1.0)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/regex/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/regex/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/libs/icu
diff --git a/contrib/restricted/boost/serialization/.yandex_meta/default.nix b/contrib/restricted/boost/serialization/.yandex_meta/default.nix
index f2c4c965826..bcb26089073 100644
--- a/contrib/restricted/boost/serialization/.yandex_meta/default.nix
+++ b/contrib/restricted/boost/serialization/.yandex_meta/default.nix
@@ -1,7 +1,7 @@
self: super: with self; {
boost_serialization = stdenv.mkDerivation rec {
pname = "boost_serialization";
- version = "1.87.0";
+ version = "1.88.0";
src = fetchFromGitHub {
owner = "boostorg";
diff --git a/contrib/restricted/boost/serialization/ya.make b/contrib/restricted/boost/serialization/ya.make
index bd3bc43d3ff..5f1e1c12fc8 100644
--- a/contrib/restricted/boost/serialization/ya.make
+++ b/contrib/restricted/boost/serialization/ya.make
@@ -9,9 +9,9 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.87.0)
+VERSION(1.88.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/serialization/archive/boost-1.87.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/serialization/archive/boost-1.88.0.tar.gz)
PEERDIR(
contrib/restricted/boost/array
diff --git a/yql/essentials/docs/en/syntax/lexer.md b/yql/essentials/docs/en/syntax/lexer.md
index 9e57b15d646..c63ad8e745e 100644
--- a/yql/essentials/docs/en/syntax/lexer.md
+++ b/yql/essentials/docs/en/syntax/lexer.md
@@ -1,11 +1,11 @@
# Lexical structure
-The query in the YQL language is a valid UTF-8 text consisting of **statements** separated by semicolons (`;`).
-The last semicolon can be omitted.
-Each command is a sequence of **tokens** that are valid for this command.
-Tokens can be **keywords**, **identifiers**, **literals**, and so on.
-Tokens are separated by whitespace characters (space, tab, line feed) or **comments**. The comment is not a part of the command and is syntactically equivalent to a space character.
+The query in the YQL language is a valid UTF-8 text consisting of **statements** separated by semicolons (`;`). The last semicolon can be omitted.
+
+Each command is a sequence of **tokens** that are valid for this command. Tokens can be **keywords**, **identifiers**, **literals**, and so on. Tokens are separated by whitespace characters (space, tab, line feed) or **comments**.
+
+The comment is not a part of the command and is syntactically equivalent to a space character.
## Syntax compatibility modes {#lexer-modes}
@@ -33,6 +33,7 @@ SELECT 1; -- A single-line comment
```
In C++ syntax compatibility mode (default), a multiline comment ends with the **nearest** `*/`.
+
The ANSI SQL syntax compatibility mode accounts for nesting of multiline comments:
```yql
@@ -45,8 +46,7 @@ SELECT * FROM T; /* this is a comment /* this is a nested comment, without ansi_
**Keywords** are tokens that have a fixed value in the YQL language. Examples of keywords: `SELECT`, `INSERT`, `FROM`, `ACTION`, and so on. Keywords are case-insensitive, that is, `SELECT` and `SeLEcT` are equivalent to each other.
The list of keywords is not fixed and is going to expand as the language develops. A keyword can't contain numbers and begin or end with an underscore.
-**Identifiers** are tokens that identify the names of tables, columns, and other objects in YQL. Identifiers in YQL are always case-sensitive.
-An identifier can be written in the body of the program without any special formatting, if the identifier:
+**Identifiers** are tokens that identify the names of tables, columns, and other objects in YQL. Identifiers in YQL are always case-sensitive. An identifier can be written in the body of the program without any special formatting, if the identifier:
* Is not a keyword
* Begins with a Latin letter or underscore
@@ -84,12 +84,9 @@ SELECT 1 as "column with "" double quote"; -- column name will be: column with "
## SQL hints {#sql-hints}
-SQL hints are special settings with which a user can modify a query execution plan
-(for example, enable/disable specific optimizations or force the JOIN execution strategy).
-Unlike [PRAGMA](pragma.md), SQL hints act locally – they are linked to a specific point in the YQL query (normally, after the keyword)
-and affect only the corresponding statement or even a part of it.
-SQL hints are a set of settings "name-value list" and defined inside special comments —
-comments with SQL hints must have `+` as the first character:
+SQL hints are special settings with which a user can modify a query execution plan (for example, enable/disable specific optimizations or force the JOIN execution strategy). Unlike [PRAGMA](pragma.md), SQL hints act locally – they are linked to a specific point in the YQL query (normally, after the keyword) and affect only the corresponding statement or even a part of it.
+
+SQL hints are a set of settings "name-value list" and defined inside special comments — comments with SQL hints must have `+` as the first character:
```yql
--+ Name1(Value1 Value2 Value3) Name2(Value4) ...
@@ -158,7 +155,7 @@ In the C++ syntax compatibility mode (default), you can use double quotes instea
SELECT "string with\n newline, \x0a newline and \" backtick ";
```
-In ASNI SQL compatibility mode, double quotes are used for IDs, and the only escaping that can be used for string literals is a pair of single quotes:
+In ANSI SQL compatibility mode, double quotes are used for IDs, and the only escaping that can be used for string literals is a pair of single quotes:
```yql
--!ansi_lexer
diff --git a/yql/essentials/docs/ru/syntax/lexer.md b/yql/essentials/docs/ru/syntax/lexer.md
index e5c4d57dbb4..6c9eb9e2de4 100644
--- a/yql/essentials/docs/ru/syntax/lexer.md
+++ b/yql/essentials/docs/ru/syntax/lexer.md
@@ -4,11 +4,9 @@
<!-- markdownlint-disable blanks-around-fences -->
-Запрос на языке YQL представляет собой валидный UTF-8 текст, который состоит из *команд* (statement) разделенных символом точка с запятой (`;`).
-Последняя точка с запятой при этом может отсутствовать.
-Каждая команда, в свою очередь, состоит из последовательности *токенов* допустимых для данной команды.
-Токеном может быть *ключевое слово*, *идентификатор*, *литерал* и другие.
-Токены разделяются пробельными символами (пробел, табуляция, перевод строки) либо *комментариями*. Комментарий не является частью команды и синтаксически эквивалентен пробельному символу.
+Запрос на языке YQL представляет собой валидный UTF-8 текст, который состоит из *команд* (statement), разделенных символом точка с запятой (`;`). Последняя точка с запятой при этом может отсутствовать.
+
+Каждая команда, в свою очередь, состоит из последовательности *токенов*, допустимых для данной команды. Токеном может быть *ключевое слово*, *идентификатор*, *литерал* и другие. Токены разделяются пробельными символами (пробел, табуляция, перевод строки) либо *комментариями*. Комментарий не является частью команды и синтаксически эквивалентен пробельному символу.
## Режимы совместимости синтаксиса {#lexer-modes}
@@ -36,6 +34,7 @@ SELECT 1; -- A single-line comment
```
В режиме совместимости синтаксиса C++ (по умолчанию) многострочный комментарий заканчивается на *ближайшей* последовательности символов `*/`.
+
В режиме совместимости синтаксиса ANSI SQL учитывается вложенность многострочных комментариев:
```yql
@@ -45,15 +44,17 @@ SELECT * FROM T; /* комментарий /* вложенный коммент
## Ключевые слова и идентификаторы {#keywords-and-ids}
-**Ключевые слова** – это токены, имеющее фиксированное значение в языке YQL. Примеры ключевых слов – `SELECT`, `INSERT`, `FROM`, `ACTION` и т.д. Ключевые слова регистронезависимы, то есть `SELECT` и `SeLEcT` эквивалентны.
+**Ключевые слова** – это токены, имеющие фиксированное значение в языке YQL. Примеры ключевых слов – `SELECT`, `INSERT`, `FROM`, `ACTION` и т. д. Ключевые слова регистронезависимы, то есть `SELECT` и `SeLEcT` эквивалентны.
+
Список ключевых слов не фиксирован – по мере развития языка он будет расширяться. Ключевое слово не может содержать цифры и начинаться или заканчиваться символом подчеркивания.
**Идентификаторы** – это токены, которые идентифицируют имена таблиц, колонок и других объектов в YQL. Идентификаторы в YQL всегда регистрозависимы.
+
Идентификатор может быть записан в теле программы без специального оформления, если он:
-* Не является ключевым словом
-* Начинается с латинской буквы или подчеркивания
-* Последующими символами могут быть латинская буква, подчеркивание или цифра
+* не является ключевым словом;
+* начинается с латинской буквы или подчеркивания;
+* последующими символами могут быть латинская буква, подчеркивание или цифра.
```yql
SELECT my_column FROM my_table; -- my_column and my_table are identifiers
@@ -63,7 +64,7 @@ SELECT my_column FROM my_table; -- my_column and my_table are identifiers
```yql
SELECT `column with space` from T;
-SELECT * FROM `my_dir/my_table`
+SELECT * FROM `my_dir/my_table`;
```
Идентификатор в обратных кавычках никогда не интерпретируется как ключевое слово:
@@ -87,10 +88,8 @@ SELECT 1 as "column with "" double quoute"; -- имя колонки будет:
## SQL хинты {#sql-hints}
-SQL хинты – это специальные настройки, которые позволяют пользователю влиять на план выполнения запроса
-(например, включать/выключать определенные оптимизации, форсировать стратегию JOIN-а и т.п.).
-В отличие от [PRAGMA](pragma.md), SQL хинты обладают локальным действием – они привязаны к определенной точке YQL запроса (обычно следуют после ключевого слова)
-и влияют только на соответствующий statement или даже его часть.
+SQL хинты – это специальные настройки, которые позволяют пользователю влиять на план выполнения запроса (например, включать/выключать определенные оптимизации, форсировать стратегию JOIN-а и т. п.). В отличие от [PRAGMA](pragma.md), SQL хинты обладают локальным действием – они привязаны к определенной точке YQL запроса (обычно следуют после ключевого слова) и влияют только на соответствующий statement или даже его часть.
+
SQL хинты представляют собой набор настроек "имя-список значений" и задаются внутри комментариев специального вида –
первым символом комментария с SQL хинтами должен быть `+`:
@@ -98,12 +97,12 @@ SQL хинты представляют собой набор настроек "
--+ Name1(Value1 Value2 Value3) Name2(Value4) ...
```
-Имя SQL хинта должно состоять из алфавтно-цифровых ASCII символов и начинаться с буквы. Регистр букв в имени хинта игнорируется.
-После имени хинта в скобках задается произвольное количество значений, разделенных пробелами. В качестве значения может выступать произвольный набор символов.
+Имя SQL хинта должно состоять из алфавитно-цифровых ASCII символов и начинаться с буквы. Регистр букв в имени хинта игнорируется. После имени хинта в скобках задается произвольное количество значений, разделенных пробелами. В качестве значения может выступать произвольный набор символов.
+
Если в наборе символов значения имеется пробел или скобка, то необходимо использовать одинарные кавычки:
```yql
---+ foo('value with space and paren)')
+--+ foo('(value with space and paren)')
```
```yql
@@ -118,7 +117,14 @@ SQL хинты представляют собой набор настроек "
--+ foo('value with single quote '' inside')
```
-Неизвестные имена SQL хинтов (либо синтаксически некорректные хинты) никогда не вызывают ошибок – они просто игнорируется:
+Если в наборе задано два и более хинтов с одинаковыми именами, используется последний из них:
+```sql
+--+ foo(v1 v2) bar(v3) foo()
+-- эквивалетно
+--+ bar(v3) foo()
+```
+
+Неизвестные имена SQL хинтов (либо синтаксически некорректные хинты) никогда не вызывают ошибок – они просто игнорируются:
```yql
--+ foo(value1) bar(value2 baz(value3)
@@ -126,18 +132,21 @@ SQL хинты представляют собой набор настроек "
--+ foo(value1)
```
-Такое поведение связано с нежеланием ломать написанные ранее валидные YQL запросы с комментариями, которые похожи на хинты.
-При этом синтаксически корректные SQL хинты в неожиданном для YQL месте вызывают предупреждение:
+Такое поведение связано с нежеланием ломать написанные ранее валидные YQL запросы с комментариями, которые похожи на хинты. При этом синтаксически корректные SQL хинты в неожиданном для YQL месте вызывают предупреждение:
```yql
-- в данный момент хинты после SELECT не поддерживаются
SELECT /*+ foo(123) */ 1; -- предупреждение 'Hint foo will not be used'
```
-Хочется заметить, что SQL хинты – это именно подсказки оптимизатору, поэтому:
+{% note info %}
-* хинты никогда не влияют на результат запроса
-* по мере развития оптимизаторов в YQL вполне возможна ситуация, в которой хинт становится неактуальным и начнет игнорироваться (например, полностью поменялся алгоритм, который настраивался данным хинтом, либо оптимизатор настолько улучшился, что гарантированно выбирает оптимальное решение, поэтому какие-то ручные настройки будут скорее вредить)
+SQL хинты – это именно подсказки оптимизатору, поэтому:
+
+* Хинты никогда не влияют на результат запроса.
+* По мере развития оптимизаторов в YQL вполне возможна ситуация, в которой хинт становится неактуальным и начнет игнорироваться. Например, полностью поменялся алгоритм, который настраивался данным хинтом, либо оптимизатор настолько улучшился, что гарантированно выбирает оптимальное решение, поэтому какие-то ручные настройки будут скорее вредить.
+
+{% endnote %}
## Строковые литералы {#string-literals}
@@ -153,7 +162,7 @@ SELECT 'string with\n newline, \x0a newline and \' backtick ';
SELECT "string with\n newline, \x0a newline and \" backtick ";
```
-В режиме совместимости синтаксиса ASNI SQL двойные кавычки используются для идентификаторов, а единственный вид эскепинга который действует для строковых литералов – это дублирование символа одиночной кавычки:
+В режиме совместимости синтаксиса ANSI SQL двойные кавычки используются для идентификаторов, а единственный вид эскепинга который действует для строковых литералов – это дублирование символа одиночной кавычки:
```yql
--!ansi_lexer
@@ -261,8 +270,7 @@ SELECT
{% note warning "Внимание" %}
-Значения строковых/числовых литералов (т.е. то что идет перед суффиксом) должны быть валидной строкой/числом с точки зрения YQL.
-В частности, должны соблюдаться правила эскейпинга YQL, а не PostgreSQL.
+Значения строковых/числовых литералов (т. е. то, что идет перед суффиксом) должны быть валидной строкой/числом с точки зрения YQL. В частности, должны соблюдаться правила эскейпинга YQL, а не PostgreSQL.
{% endnote %}
@@ -270,9 +278,9 @@ SELECT
```yql
SELECT
- 1234p, -- pgint4
- 0x123pb, -- pgint8
- "тест"pt, -- pgtext
+ 1234p, -- pgint4
+ 0x123pb, -- pgint8
+ "тест"pt, -- pgtext
123e-1000pn; -- pgnumeric
;
```
@@ -289,10 +297,9 @@ SELECT
### Конструктор литералов произвольного типа {#literals_constructor}
-Литералы всех типов (в том числе и Pg типов) могут создаваться с помощью конструктора литералов со следующей сигнатурой:
-`Имя_типа(<строковая константа>)`.
+Литералы всех типов (в том числе и Pg типов) могут создаваться с помощью конструктора литералов со следующей сигнатурой: `Имя_типа(<строковая константа>)`.
-Напрмер:
+Например:
```yql
DECLARE $foo AS String;
@@ -306,10 +313,7 @@ SELECT
;
```
-Также поддерживается встроенная функция `PgConst` со следующей сигнатурой: `PgConst(<строковое значение>, <тип>)`.
-Такой способ более удобен для кодогенерации.
-
-Например:
+Также поддерживается встроенная функция `PgConst` со следующей сигнатурой: `PgConst(<строковое значение>, <тип>)`. Такой способ более удобен для кодогенерации. Например:
```yql
SELECT
@@ -322,10 +326,7 @@ SELECT
```yql
SELECT
- PgConst(90, pginterval, "day"), -- 90 days
+ PgConst(90, pginterval, "day"), -- 90 days
PgConst(13.45, pgnumeric, 10, 1); -- 13.5
;
```
-
-
-