LucaCappelletti94 commented on code in PR #2316:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2316#discussion_r4016227637
##########
src/ast/spans.rs:
##########
@@ -2518,6 +2519,12 @@ impl Spanned for AlterTable {
}
}
+impl Spanned for CreateAggregate {
+ fn span(&self) -> Span {
+ Span::empty()
+ }
+}
+
Review Comment:
I believe this object contains spanned objects, therefore you can return a
span for it.
##########
src/ast/mod.rs:
##########
@@ -10253,16 +10260,23 @@ pub enum FunctionParallel {
Safe,
}
-impl fmt::Display for FunctionParallel {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+impl FunctionParallel {
+ /// Returns the bare keyword for this parallel mode, without the
`PARALLEL` prefix.
+ pub fn as_str(&self) -> &'static str {
match self {
- FunctionParallel::Unsafe => write!(f, "PARALLEL UNSAFE"),
- FunctionParallel::Restricted => write!(f, "PARALLEL RESTRICTED"),
- FunctionParallel::Safe => write!(f, "PARALLEL SAFE"),
+ FunctionParallel::Unsafe => "UNSAFE",
+ FunctionParallel::Restricted => "RESTRICTED",
+ FunctionParallel::Safe => "SAFE",
}
}
}
+impl fmt::Display for FunctionParallel {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "PARALLEL {}", self.as_str())
+ }
+}
+
Review Comment:
What is the reason for this edit?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]