From 004455a02952d5cacf91d34a89e72c2dfde47948 Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Fri, 27 Sep 2019 00:14:52 +0300 Subject: [PATCH] fixes --- dbms/src/Core/Settings.h | 6 +++--- dbms/src/Formats/ParsedTemplateFormatString.cpp | 9 ++++----- .../queries/0_stateless/01014_format_custom_separated.sh | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dbms/src/Core/Settings.h b/dbms/src/Core/Settings.h index 84ce0f0469a..e2bc24059dd 100644 --- a/dbms/src/Core/Settings.h +++ b/dbms/src/Core/Settings.h @@ -225,11 +225,11 @@ struct Settings : public SettingsCollection M(SettingString, format_template_row, "", "Path to file which contains format string for rows (for Template format)") \ M(SettingString, format_template_rows_between_delimiter, "\n", "Delimiter between rows (for Template format)") \ \ - M(SettingString, format_custom_escaping_rule, "", "Field escaping rule (for CustomSeparated format)") \ + M(SettingString, format_custom_escaping_rule, "Escaped", "Field escaping rule (for CustomSeparated format)") \ M(SettingString, format_custom_field_delimiter, "\t", "Delimiter between fields (for CustomSeparated format)") \ M(SettingString, format_custom_row_before_delimiter, "", "Delimiter before field of the first column (for CustomSeparated format)") \ - M(SettingString, format_custom_row_after_delimiter, "", "Delimiter after field of the last column (for CustomSeparated format)") \ - M(SettingString, format_custom_row_between_delimiter, "\n", "Delimiter between rows (for CustomSeparated format)") \ + M(SettingString, format_custom_row_after_delimiter, "\n", "Delimiter after field of the last column (for CustomSeparated format)") \ + M(SettingString, format_custom_row_between_delimiter, "", "Delimiter between rows (for CustomSeparated format)") \ M(SettingString, format_custom_result_before_delimiter, "", "Prefix before result set (for CustomSeparated format)") \ M(SettingString, format_custom_result_after_delimiter, "", "Suffix after result set (for CustomSeparated format)") \ \ diff --git a/dbms/src/Formats/ParsedTemplateFormatString.cpp b/dbms/src/Formats/ParsedTemplateFormatString.cpp index e02b972345e..d6773970c0c 100644 --- a/dbms/src/Formats/ParsedTemplateFormatString.cpp +++ b/dbms/src/Formats/ParsedTemplateFormatString.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -19,10 +18,10 @@ ParsedTemplateFormatString::ParsedTemplateFormatString(const FormatSchemaInfo & { try { - ReadBufferFromFile schema_file(schema.absoluteSchemaPath()); - WriteBufferFromOwnString format_string; - copyData(schema_file, format_string); - parse(format_string.str(), idx_by_name); + ReadBufferFromFile schema_file(schema.absoluteSchemaPath(), 4096); + String format_string; + readStringUntilEOF(format_string, schema_file); + parse(format_string, idx_by_name); } catch (DB::Exception & e) { diff --git a/dbms/tests/queries/0_stateless/01014_format_custom_separated.sh b/dbms/tests/queries/0_stateless/01014_format_custom_separated.sh index 672e3686bc2..8880c9f86c0 100755 --- a/dbms/tests/queries/0_stateless/01014_format_custom_separated.sh +++ b/dbms/tests/queries/0_stateless/01014_format_custom_separated.sh @@ -12,6 +12,7 @@ format_custom_escaping_rule = 'CSV', \ format_custom_field_delimiter = '\t|\t', \ format_custom_row_before_delimiter = '||', \ format_custom_row_after_delimiter = '\t||', \ +format_custom_row_between_delimiter = '\n', \ format_custom_result_before_delimiter = '========== result ==========\n', \ format_custom_result_after_delimiter = '\n============================\n'"