1 | #pragma once |
2 | |
3 | #include <Core/Types.h> |
4 | |
5 | |
6 | namespace DB |
7 | { |
8 | |
9 | /** Various tweaks for input/output formats. |
10 | * Text serialization/deserialization of data types also depend on some of these settings. |
11 | * NOTE Parameters for unrelated formats and unrelated data types |
12 | * are collected in this struct - it prevents modularity, but they are difficult to separate. |
13 | */ |
14 | struct FormatSettings |
15 | { |
16 | struct JSON |
17 | { |
18 | bool quote_64bit_integers = true; |
19 | bool quote_denormals = true; |
20 | bool escape_forward_slashes = true; |
21 | }; |
22 | |
23 | JSON json; |
24 | |
25 | struct CSV |
26 | { |
27 | char delimiter = ','; |
28 | bool allow_single_quotes = true; |
29 | bool allow_double_quotes = true; |
30 | bool unquoted_null_literal_as_null = false; |
31 | bool empty_as_default = false; |
32 | }; |
33 | |
34 | CSV csv; |
35 | |
36 | struct Pretty |
37 | { |
38 | UInt64 max_rows = 10000; |
39 | UInt64 max_column_pad_width = 250; |
40 | bool color = true; |
41 | }; |
42 | |
43 | Pretty pretty; |
44 | |
45 | struct Values |
46 | { |
47 | bool interpret_expressions = true; |
48 | bool deduce_templates_of_expressions = true; |
49 | bool accurate_types_of_literals = true; |
50 | }; |
51 | |
52 | Values values; |
53 | |
54 | struct Template |
55 | { |
56 | String resultset_format; |
57 | String row_format; |
58 | String row_between_delimiter; |
59 | }; |
60 | |
61 | Template template_settings; |
62 | |
63 | struct TSV |
64 | { |
65 | bool empty_as_default = false; |
66 | }; |
67 | |
68 | TSV tsv; |
69 | |
70 | bool skip_unknown_fields = false; |
71 | bool = false; |
72 | bool write_statistics = true; |
73 | bool import_nested_json = false; |
74 | bool null_as_default = false; |
75 | |
76 | enum class DateTimeInputFormat |
77 | { |
78 | Basic, /// Default format for fast parsing: YYYY-MM-DD hh:mm:ss (ISO-8601 without fractional part and timezone) or NNNNNNNNNN unix timestamp. |
79 | BestEffort /// Use sophisticated rules to parse whatever possible. |
80 | }; |
81 | |
82 | DateTimeInputFormat date_time_input_format = DateTimeInputFormat::Basic; |
83 | |
84 | UInt64 input_allow_errors_num = 0; |
85 | Float32 input_allow_errors_ratio = 0; |
86 | |
87 | struct Parquet |
88 | { |
89 | UInt64 row_group_size = 1000000; |
90 | } parquet; |
91 | |
92 | struct Schema |
93 | { |
94 | std::string format_schema; |
95 | std::string format_schema_path; |
96 | bool is_server = false; |
97 | }; |
98 | |
99 | Schema schema; |
100 | |
101 | struct Custom |
102 | { |
103 | std::string result_before_delimiter; |
104 | std::string result_after_delimiter; |
105 | std::string row_before_delimiter; |
106 | std::string row_after_delimiter; |
107 | std::string row_between_delimiter; |
108 | std::string field_delimiter; |
109 | std::string escaping_rule; |
110 | }; |
111 | |
112 | Custom custom; |
113 | }; |
114 | |
115 | } |
116 | |
117 | |