Parse an `EXPLAIN [KEY|VALUE] SCHEMA` statement assuming that the `EXPLAIN` token have already been consumed
(&mut self)
| 9269 | /// Parse an `EXPLAIN [KEY|VALUE] SCHEMA` statement assuming that the `EXPLAIN` token |
| 9270 | /// have already been consumed |
| 9271 | fn parse_explain_schema(&mut self) -> Result<Statement<Raw>, ParserError> { |
| 9272 | let schema_for = match self.expect_one_of_keywords(&[KEY, VALUE])? { |
| 9273 | KEY => ExplainSinkSchemaFor::Key, |
| 9274 | VALUE => ExplainSinkSchemaFor::Value, |
| 9275 | _ => unreachable!(), |
| 9276 | }; |
| 9277 | |
| 9278 | self.expect_keyword(SCHEMA)?; |
| 9279 | |
| 9280 | let format = if self.parse_keyword(AS) { |
| 9281 | // only json format is supported |
| 9282 | self.expect_keyword(JSON)?; |
| 9283 | Some(ExplainFormat::Json) |
| 9284 | } else { |
| 9285 | None |
| 9286 | }; |
| 9287 | |
| 9288 | self.expect_keywords(&[FOR, CREATE])?; |
| 9289 | |
| 9290 | if let Statement::CreateSink(statement) = self.parse_create_sink()? { |
| 9291 | Ok(Statement::ExplainSinkSchema(ExplainSinkSchemaStatement { |
| 9292 | schema_for, |
| 9293 | format, |
| 9294 | statement, |
| 9295 | })) |
| 9296 | } else { |
| 9297 | unreachable!("only create sink can be returned here"); |
| 9298 | } |
| 9299 | } |
| 9300 | |
| 9301 | /// Parse a `DECLARE` statement, assuming that the `DECLARE` token |
| 9302 | /// has already been consumed. |
no test coverage detected