diff options
author | zhvv117 <zhvv117@yandex-team.com> | 2024-12-10 22:42:11 +0300 |
---|---|---|
committer | Vitaly Isaev <vitalyisaev@ydb.tech> | 2024-12-12 10:12:03 +0000 |
commit | 8234b082f2230b2f562dc1a474c9bacd6f50e808 (patch) | |
tree | e0b3f0f69bad6cafc1adf9bb30601e83f6f96eae /yql/essentials | |
parent | 4d758beeece453d92aca80c46f503d27271e07f2 (diff) | |
download | ydb-8234b082f2230b2f562dc1a474c9bacd6f50e808.tar.gz |
fix additional newline after comment
commit_hash:63dc64fc9bf73bb1dd98c368466227fe72c5391c
Diffstat (limited to 'yql/essentials')
-rw-r--r-- | yql/essentials/sql/v1/format/sql_format.cpp | 4 | ||||
-rw-r--r-- | yql/essentials/sql/v1/format/sql_format_ut.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/yql/essentials/sql/v1/format/sql_format.cpp b/yql/essentials/sql/v1/format/sql_format.cpp index c029f6e3ad..f8e20849fd 100644 --- a/yql/essentials/sql/v1/format/sql_format.cpp +++ b/yql/essentials/sql/v1/format/sql_format.cpp @@ -562,6 +562,10 @@ private: WriteComments(true); } + if (AfterComment && Comments[LastComment - 1].Content.StartsWith("--")) { + return; + } + if (OutColumn) { Out('\n'); } diff --git a/yql/essentials/sql/v1/format/sql_format_ut.h b/yql/essentials/sql/v1/format/sql_format_ut.h index 691cc8f8b7..7fe74f2d62 100644 --- a/yql/essentials/sql/v1/format/sql_format_ut.h +++ b/yql/essentials/sql/v1/format/sql_format_ut.h @@ -867,8 +867,10 @@ Y_UNIT_TEST(Select) { "SELECT\n\t1\nLIMIT 10;\n"}, {"select 1 limit 10 offset 5", "SELECT\n\t1\nLIMIT 10 OFFSET 5;\n"}, - { "select 1 union all select 2", + {"select 1 union all select 2", "SELECT\n\t1\nUNION ALL\nSELECT\n\t2\n;\n" }, + {"select * from $user where key == 1 -- comment", + "SELECT\n\t*\nFROM\n\t$user\nWHERE\n\tkey == 1 -- comment\n;\n"}, }; TSetup setup; |