Parse a SQL `RESET`
(&mut self)
| 775 | |
| 776 | /// Parse a SQL `RESET` |
| 777 | pub fn parse_reset(&mut self) -> Result<Statement, DataFusionError> { |
| 778 | let mut parts: Vec<String> = Vec::new(); |
| 779 | let mut expecting_segment = true; |
| 780 | |
| 781 | loop { |
| 782 | let next_token = self.parser.peek_token(); |
| 783 | match &next_token.token { |
| 784 | Token::Word(word) => { |
| 785 | self.parser.next_token(); |
| 786 | parts.push(word.value.clone()); |
| 787 | expecting_segment = false; |
| 788 | } |
| 789 | Token::SingleQuotedString(s) |
| 790 | | Token::DoubleQuotedString(s) |
| 791 | | Token::EscapedStringLiteral(s) => { |
| 792 | self.parser.next_token(); |
| 793 | parts.push(s.clone()); |
| 794 | expecting_segment = false; |
| 795 | } |
| 796 | Token::Period => { |
| 797 | self.parser.next_token(); |
| 798 | if expecting_segment || parts.is_empty() { |
| 799 | return self.expected("configuration parameter", &next_token); |
| 800 | } |
| 801 | expecting_segment = true; |
| 802 | } |
| 803 | Token::EOF | Token::SemiColon => break, |
| 804 | _ => return self.expected("configuration parameter", &next_token), |
| 805 | } |
| 806 | } |
| 807 | |
| 808 | if parts.is_empty() || expecting_segment { |
| 809 | return self.expected("configuration parameter", &self.parser.peek_token()); |
| 810 | } |
| 811 | |
| 812 | let idents: Vec<Ident> = parts.into_iter().map(Ident::new).collect(); |
| 813 | let variable = ObjectName::from(idents); |
| 814 | Ok(Statement::Reset(ResetStatement::Variable(variable))) |
| 815 | } |
| 816 | |
| 817 | pub fn parse_explain_format(&mut self) -> Result<Option<String>, DataFusionError> { |
| 818 | if !self.parser.parse_keyword(Keyword::FORMAT) { |