Initialize POD members of ASTs to make it less error-prone

The cost of initializing members is insignificant in compare to parsing,
while the cost of the error is high.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-05-25 10:16:54 +02:00
parent b30cfe5503
commit b680697cce
3 changed files with 9 additions and 9 deletions

View File

@ -16,7 +16,7 @@ public:
std::optional<bool> null_modifier;
String default_specifier;
ASTPtr default_expression;
bool ephemeral_default;
bool ephemeral_default = false;
ASTPtr comment;
ASTPtr codec;
ASTPtr ttl;

View File

@ -19,13 +19,13 @@ public:
/// Attribute expression
ASTPtr expression;
/// Is attribute mirrored to the parent identifier
bool hierarchical;
bool hierarchical = false;
/// Is hierarchical attribute bidirectional
bool bidirectional;
bool bidirectional = false;
/// Flag that shows whether the id->attribute image is injective
bool injective;
bool injective = false;
/// MongoDB object ID
bool is_object_id;
bool is_object_id = false;
String getID(char delim) const override { return "DictionaryAttributeDeclaration" + (delim + name); }

View File

@ -11,14 +11,14 @@ namespace DB
class ASTOrderByElement : public IAST
{
public:
int direction; /// 1 for ASC, -1 for DESC
int nulls_direction; /// Same as direction for NULLS LAST, opposite for NULLS FIRST.
bool nulls_direction_was_explicitly_specified;
int direction = 0; /// 1 for ASC, -1 for DESC
int nulls_direction = 0; /// Same as direction for NULLS LAST, opposite for NULLS FIRST.
bool nulls_direction_was_explicitly_specified = false;
/** Collation for locale-specific string comparison. If empty, then sorting done by bytes. */
ASTPtr collation;
bool with_fill;
bool with_fill = false;
ASTPtr fill_from;
ASTPtr fill_to;
ASTPtr fill_step;