Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YQL-17725 docs for unicode literals #1547

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
# Unignore all dirs
!*/
# Unignore all files inside canondata dir
!*/canondata/*
!**/canondata/**

/canonization_show_res.log

# C libraries
*.so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ SELECT $text;

### Типизированные строковые литералы {#typed-string-literals}

* Для строкового литерала, включая [многострочный](#multiline-string-literals), по умолчанию используется тип `String`.
* Для строкового литерала, включая [многострочный](#multiline-string-literals), по умолчанию используется тип `String` (см. также [PRAGMA UnicodeLiterals](../pragma.md#UnicodeLiterals)).
* С помощью следующих суффиксов можно явно управлять типом литерала:
* `u` — `Utf8`;
* `s` или `b` - `String`;
* `u` или `t` — `Utf8`;
* `y` — `Yson`;
* `j` — `Json`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,28 @@ ClassicDivision является [scoped](#pragmascope) настройкой.
Не влияет на операции с числами с плавающей точкой или `Decimal`.
CheckedOps является [scoped](#pragmascope) настройкой.

### UnicodeLiterals

`UnicodeLiterals`/`DisableUnicodeLiterals`

| Тип значения | По умолчанию |
| --- | --- |
| Флаг | false |

При включенном режиме строковые литералы без суффиксов вида "foo"/'bar'/@@multiline@@ будут иметь тип `Utf8`, при выключенном - `String`.
UnicodeLiterals является [scoped](#pragmascope) настройкой.

### WarnUntypedStringLiterals

`WarnUntypedStringLiterals`/`DisableWarnUntypedStringLiterals`

| Тип значения | По умолчанию |
| --- | --- |
| Флаг | false |

При включенном режиме для строковых литералов без суффиксов вида "foo"/'bar'/@@multiline@@ будет генерироваться предупреждение. Его можно подавить, если явно выбрать суффикс `s` или `b` для типа `String`, либо `u` или `t` для типа `Utf8`.
WarnUntypedStringLiterals является [scoped](#pragmascope) настройкой.

### AllowDotInAlias

| Тип значения | По умолчанию |
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/yql/sql/v1/sql_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success
"unicodeliterals",
"disableunicodeliterals",
"warnuntypedstringliterals",
"disableuntypedstringliterals",
"disablewarnuntypedstringliterals",
};
const bool hasLexicalScope = withConfigure || lexicalScopePragmas.contains(normalizedPragma);
const bool withFileAlias = normalizedPragma == "file" || normalizedPragma == "folder" || normalizedPragma == "library" || normalizedPragma == "udf";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<tmp_path>/program.sql:<main>: Warning: Parse Sql

<tmp_path>/program.sql:<main>:9:6: Warning: Please add suffix u or t for Utf8 strings or s or b for arbitrary binary strings
"e");
^
Loading