Skip to content

Commit 5beec12

Browse files
committed
Fix review comments
1 parent 2a50af5 commit 5beec12

File tree

8 files changed

+566
-581
lines changed

8 files changed

+566
-581
lines changed

src/ast/data_type.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ use serde::{Deserialize, Serialize};
2525
#[cfg(feature = "visitor")]
2626
use sqlparser_derive::{Visit, VisitMut};
2727

28-
use crate::ast::{display_comma_separated, ObjectName, StructField, UnionField, Value};
28+
use crate::ast::{display_comma_separated, Expr, ObjectName, StructField, UnionField};
2929

3030
use super::{value::escape_single_quote_string, ColumnDef};
3131

3232
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
3333
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
3434
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
35-
pub enum EnumValue {
36-
String(String),
35+
pub enum EnumMember {
36+
Name(String),
3737
/// ClickHouse allows to specify an integer value for each enum value.
3838
///
3939
/// [clickhouse](https://clickhouse.com/docs/en/sql-reference/data-types/enum)
40-
Pair(String, Value),
40+
NameValue(String, Expr),
4141
}
4242

4343
/// SQL data types
@@ -311,7 +311,7 @@ pub enum DataType {
311311
/// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/nested-data-structures/nested
312312
Nested(Vec<ColumnDef>),
313313
/// Enums
314-
Enum(Vec<EnumValue>, Option<i64>),
314+
Enum(Vec<EnumMember>, Option<u32>),
315315
/// Set
316316
Set(Vec<String>),
317317
/// Struct
@@ -524,8 +524,8 @@ impl fmt::Display for DataType {
524524
write!(f, ", ")?;
525525
}
526526
match v {
527-
EnumValue::String(v) => write!(f, "'{}'", escape_single_quote_string(v))?,
528-
EnumValue::Pair(v, i) => {
527+
EnumMember::Name(v) => write!(f, "'{}'", escape_single_quote_string(v))?,
528+
EnumMember::NameValue(v, i) => {
529529
write!(f, "'{}' = {}", escape_single_quote_string(v), i)?
530530
}
531531
}

src/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use sqlparser_derive::{Visit, VisitMut};
4040
use crate::tokenizer::Span;
4141

4242
pub use self::data_type::{
43-
ArrayElemTypeDef, CharLengthUnits, CharacterLength, DataType, EnumValue, ExactNumberInfo,
43+
ArrayElemTypeDef, CharLengthUnits, CharacterLength, DataType, EnumMember, ExactNumberInfo,
4444
StructBracketKind, TimezoneInfo,
4545
};
4646
pub use self::dcl::{AlterRoleOperation, ResetConfig, RoleOption, SetConfigValue, Use};

src/dialect/clickhouse.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,4 @@ impl Dialect for ClickHouseDialect {
5050
fn supports_limit_comma(&self) -> bool {
5151
true
5252
}
53-
54-
/// ClickHouse supports `Enum8` and `Enum16` types.
55-
/// See [ClickHouse](https://clickhouse.com/docs/en/sql-reference/data-types/enum)
56-
fn supports_enum_type_with_bits(&self) -> bool {
57-
true
58-
}
5953
}

src/dialect/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,6 @@ pub trait Dialect: Debug + Any {
687687
fn is_reserved_for_identifier(&self, kw: Keyword) -> bool {
688688
keywords::RESERVED_FOR_IDENTIFIER.contains(&kw)
689689
}
690-
691-
/// Return true if the dialect supports the Enum type with bits like Enum8, Enum16
692-
fn supports_enum_type_with_bits(&self) -> bool {
693-
false
694-
}
695690
}
696691

697692
/// This represents the operators for which precedence must be defined

0 commit comments

Comments
 (0)