@@ -372,15 +372,20 @@ pub struct StructField {
372
372
pub field_name : Option < WithSpan < Ident > > ,
373
373
pub field_type : DataType ,
374
374
pub options : Vec < SqlOption > ,
375
+ pub colon : bool ,
375
376
}
376
377
377
378
impl fmt:: Display for StructField {
378
379
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
379
380
if let Some ( name) = & self . field_name {
380
- write ! ( f, "{name} {}" , self . field_type) ?;
381
- } else {
382
- write ! ( f, "{}" , self . field_type) ?;
383
- } ;
381
+ if self . colon {
382
+ write ! ( f, "{name}: " ) ?;
383
+ } else {
384
+ write ! ( f, "{name} " ) ?;
385
+ }
386
+ }
387
+ write ! ( f, "{}" , self . field_type) ?;
388
+
384
389
if !self . options . is_empty ( ) {
385
390
write ! ( f, " OPTIONS({})" , display_comma_separated( & self . options) ) ?;
386
391
}
@@ -2040,6 +2045,7 @@ pub enum Statement {
2040
2045
name : ObjectName ,
2041
2046
args : Option < Vec < OperateFunctionArg > > ,
2042
2047
return_type : Option < DataType > ,
2048
+ comment : Option < String > ,
2043
2049
/// Optional parameters.
2044
2050
params : CreateFunctionBody ,
2045
2051
} ,
@@ -2590,6 +2596,7 @@ impl fmt::Display for Statement {
2590
2596
name,
2591
2597
args,
2592
2598
return_type,
2599
+ comment,
2593
2600
params,
2594
2601
} => {
2595
2602
write ! (
@@ -2604,6 +2611,9 @@ impl fmt::Display for Statement {
2604
2611
if let Some ( return_type) = return_type {
2605
2612
write ! ( f, " RETURNS {return_type}" ) ?;
2606
2613
}
2614
+ if let Some ( comment) = comment {
2615
+ write ! ( f, " COMMENT '{comment}'" ) ?;
2616
+ }
2607
2617
write ! ( f, "{params}" ) ?;
2608
2618
Ok ( ( ) )
2609
2619
}
@@ -5027,6 +5037,8 @@ pub struct CreateFunctionBody {
5027
5037
pub as_ : Option < FunctionDefinition > ,
5028
5038
/// RETURN expression
5029
5039
pub return_ : Option < Expr > ,
5040
+ /// RETURN SELECT
5041
+ pub return_select_ : Option < Query > ,
5030
5042
/// USING ... (Hive only)
5031
5043
pub using : Option < CreateFunctionUsing > ,
5032
5044
}
@@ -5045,6 +5057,9 @@ impl fmt::Display for CreateFunctionBody {
5045
5057
if let Some ( expr) = & self . return_ {
5046
5058
write ! ( f, " RETURN {expr}" ) ?;
5047
5059
}
5060
+ if let Some ( expr) = & self . return_select_ {
5061
+ write ! ( f, " RETURN {expr}" ) ?;
5062
+ }
5048
5063
if let Some ( using) = & self . using {
5049
5064
write ! ( f, " {using}" ) ?;
5050
5065
}
0 commit comments