MCPcopy Create free account
hub / github.com/apache/datafusion / parse_partitions

Method parse_partitions

datafusion/sql/src/parser.rs:859–886  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

857 }
858
859 fn parse_partitions(&mut self) -> Result<Vec<String>, DataFusionError> {
860 let mut partitions: Vec<String> = vec![];
861 if !self.parser.consume_token(&Token::LParen)
862 || self.parser.consume_token(&Token::RParen)
863 {
864 return Ok(partitions);
865 }
866
867 loop {
868 if let Token::Word(_) = self.parser.peek_token().token {
869 let identifier = self.parser.parse_identifier()?;
870 partitions.push(identifier.to_string());
871 } else {
872 return self.expected("partition name", &self.parser.peek_token());
873 }
874 let comma = self.parser.consume_token(&Token::Comma);
875 if self.parser.consume_token(&Token::RParen) {
876 // allow a trailing comma, even though it's not in standard
877 break;
878 } else if !comma {
879 return self.expected(
880 "',' or ')' after partition definition",
881 &self.parser.peek_token(),
882 );
883 }
884 }
885 Ok(partitions)
886 }
887
888 /// Parse the ordering clause of a `CREATE EXTERNAL TABLE` SQL statement
889 pub fn parse_order_by_exprs(&mut self) -> Result<Vec<OrderByExpr>, DataFusionError> {

Callers 2

parse_copyMethod · 0.80

Calls 3

expectedMethod · 0.80
pushMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected