@@ -226,11 +226,11 @@ class Tokenizer(tokens.Tokenizer):
226
226
"ENUM8" : TokenType .ENUM8 ,
227
227
"ENUM16" : TokenType .ENUM16 ,
228
228
"FINAL" : TokenType .FINAL ,
229
- "FIXEDSTRING " : TokenType .FIXEDSTRING ,
229
+ "FIXED_STRING " : TokenType .FIXEDSTRING ,
230
230
"FLOAT32" : TokenType .FLOAT ,
231
231
"FLOAT64" : TokenType .DOUBLE ,
232
232
"GLOBAL" : TokenType .GLOBAL ,
233
- "LOWCARDINALITY " : TokenType .LOWCARDINALITY ,
233
+ "LOW_CARDINALITY " : TokenType .LOWCARDINALITY ,
234
234
"MAP" : TokenType .MAP ,
235
235
"NESTED" : TokenType .NESTED ,
236
236
"SAMPLE" : TokenType .TABLE_SAMPLE ,
@@ -393,7 +393,7 @@ class Parser(parser.Parser):
393
393
394
394
AGG_FUNCTIONS_SUFFIXES = [
395
395
"if" ,
396
- "aary " ,
396
+ "array " ,
397
397
"array_if" ,
398
398
"map" ,
399
399
"simple_state" ,
@@ -524,9 +524,9 @@ def _parse_types(
524
524
if isinstance (dtype , exp .DataType ) and dtype .args .get ("nullable" ) is not True :
525
525
# Mark every type as non-nullable which is Timeplus's default, unless it's
526
526
# already marked as nullable. This marker helps us transpile types from other
527
- # dialects to Timeplus, so that we can e.g. produce `CAST(x AS nullabe (String))`
527
+ # dialects to Timeplus, so that we can e.g. produce `CAST(x AS nullable (String))`
528
528
# from `CAST(x AS TEXT)`. If there is a `NULL` value in `x`, the former would
529
- # fail in Timeplus without the `nullabe ` type constructor.
529
+ # fail in Timeplus without the `nullable ` type constructor.
530
530
dtype .set ("nullable" , False )
531
531
532
532
return dtype
@@ -563,7 +563,7 @@ def _parse_assignment(self) -> t.Optional[exp.Expression]:
563
563
564
564
def _parse_query_parameter (self ) -> t .Optional [exp .Expression ]:
565
565
"""
566
- Parse a placeholder expression like SELECT {abc: UInt32 } or FROM {table: Identifier}
566
+ Parse a placeholder expression like SELECT {abc: uint32 } or FROM {table: Identifier}
567
567
"""
568
568
index = self ._index
569
569
@@ -958,7 +958,7 @@ class Generator(generator.Generator):
958
958
exp .ArgMax : arg_max_or_min_no_count ("arg_max" ),
959
959
exp .ArgMin : arg_max_or_min_no_count ("arg_min" ),
960
960
exp .Array : inline_array_sql ,
961
- exp .CastToStrType : rename_func ("cast " ),
961
+ exp .CastToStrType : rename_func ("CAST " ),
962
962
exp .CountIf : rename_func ("count_if" ),
963
963
exp .CompressColumnConstraint : lambda self ,
964
964
e : f"CODEC({ self .expressions (e , key = 'this' , flat = True )} )" ,
@@ -1062,7 +1062,7 @@ def cast_sql(self, expression: exp.Cast, safe_prefix: t.Optional[str] = None) ->
1062
1062
def trycast_sql (self , expression : exp .TryCast ) -> str :
1063
1063
dtype = expression .to
1064
1064
if not dtype .is_type (* self .NON_NULLABLE_TYPES , check_nullable = True ):
1065
- # Casting x into nullabe (T) appears to behave similarly to TRY_CAST(x AS T)
1065
+ # Casting x into nullable (T) appears to behave similarly to TRY_CAST(x AS T)
1066
1066
dtype .set ("nullable" , True )
1067
1067
1068
1068
return super ().cast_sql (expression )
@@ -1110,13 +1110,13 @@ def datatype_sql(self, expression: exp.DataType) -> str:
1110
1110
else :
1111
1111
dtype = super ().datatype_sql (expression )
1112
1112
1113
- # This section changes the type to `nullabe (...)` if the following conditions hold:
1114
- # - It's marked as nullable - this ensures we won't wrap Timeplus types with `nullabe `
1113
+ # This section changes the type to `nullable (...)` if the following conditions hold:
1114
+ # - It's marked as nullable - this ensures we won't wrap Timeplus types with `nullable `
1115
1115
# and change their semantics
1116
1116
# - It's not the key type of a `Map`. This is because Timeplus enforces the following
1117
1117
# constraint: "Type of Map key must be a type, that can be represented by integer or
1118
1118
# String or FixedString (possibly LowCardinality) or UUID or IPv6"
1119
- # - It's not a composite type, e.g. `nullabe (array(...))` is not a valid type
1119
+ # - It's not a composite type, e.g. `nullable (array(...))` is not a valid type
1120
1120
parent = expression .parent
1121
1121
nullable = expression .args .get ("nullable" )
1122
1122
if nullable is True or (
@@ -1128,7 +1128,7 @@ def datatype_sql(self, expression: exp.DataType) -> str:
1128
1128
)
1129
1129
and not expression .is_type (* self .NON_NULLABLE_TYPES , check_nullable = True )
1130
1130
):
1131
- dtype = f"nullabe ({ dtype } )"
1131
+ dtype = f"nullable ({ dtype } )"
1132
1132
1133
1133
return dtype
1134
1134
@@ -1247,3 +1247,7 @@ def is_sql(self, expression: exp.Is) -> str:
1247
1247
is_sql = self .wrap (is_sql )
1248
1248
1249
1249
return is_sql
1250
+
1251
+ tokenizer_class = Tokenizer
1252
+ parser_class = Parser
1253
+ generator_class = Generator
0 commit comments