MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_create_subsource_option

Method parse_create_subsource_option

src/sql-parser/src/parser.rs:3109–3161  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

3107 }
3108
3109 fn parse_create_subsource_option(&mut self) -> Result<CreateSubsourceOption<Raw>, ParserError> {
3110 let option = match self
3111 .expect_one_of_keywords(&[EXTERNAL, PROGRESS, TEXT, EXCLUDE, IGNORE, DETAILS, RETAIN])?
3112 {
3113 EXTERNAL => {
3114 self.expect_keyword(REFERENCE)?;
3115 CreateSubsourceOption {
3116 name: CreateSubsourceOptionName::ExternalReference,
3117 value: self.parse_optional_option_value()?,
3118 }
3119 }
3120 PROGRESS => CreateSubsourceOption {
3121 name: CreateSubsourceOptionName::Progress,
3122 value: self.parse_optional_option_value()?,
3123 },
3124 ref keyword @ (TEXT | EXCLUDE | IGNORE) => {
3125 self.expect_keyword(COLUMNS)?;
3126
3127 let _ = self.consume_token(&Token::Eq);
3128
3129 let value = self
3130 .parse_option_sequence(Parser::parse_identifier)?
3131 .map(|inner| {
3132 WithOptionValue::Sequence(
3133 inner.into_iter().map(WithOptionValue::Ident).collect_vec(),
3134 )
3135 });
3136
3137 CreateSubsourceOption {
3138 name: match *keyword {
3139 TEXT => CreateSubsourceOptionName::TextColumns,
3140 // IGNORE is historical syntax for this option.
3141 EXCLUDE | IGNORE => CreateSubsourceOptionName::ExcludeColumns,
3142 _ => unreachable!(),
3143 },
3144 value,
3145 }
3146 }
3147 DETAILS => CreateSubsourceOption {
3148 name: CreateSubsourceOptionName::Details,
3149 value: self.parse_optional_option_value()?,
3150 },
3151 RETAIN => {
3152 self.expect_keyword(HISTORY)?;
3153 CreateSubsourceOption {
3154 name: CreateSubsourceOptionName::RetainHistory,
3155 value: self.parse_option_retain_history()?,
3156 }
3157 }
3158 _ => unreachable!(),
3159 };
3160 Ok(option)
3161 }
3162
3163 fn parse_create_source(&mut self) -> Result<Statement<Raw>, ParserError> {
3164 self.expect_keyword(SOURCE)?;

Callers

nothing calls this directly

Calls 8

expect_keywordMethod · 0.80
consume_tokenMethod · 0.80
parse_option_sequenceMethod · 0.80
mapMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected