MCPcopy Create free account
hub / github.com/AfterShip/clickhouse-sql-parser / parsePartitionClause

Method parsePartitionClause

parser/parser_alter.go:361–385  ·  view source on GitHub ↗
(pos Pos)

Source from the content-addressed store, hash-verified

359}
360
361func (p *Parser) parsePartitionClause(pos Pos) (*PartitionClause, error) {
362 if err := p.expectKeyword(KeywordPartition); err != nil {
363 return nil, err
364 }
365
366 partition := &PartitionClause{
367 PartitionPos: pos,
368 }
369 if p.tryConsumeKeywords(KeywordId) {
370 id, err := p.parseString(p.Pos())
371 if err != nil {
372 return nil, err
373 }
374 partition.ID = id
375 } else if p.tryConsumeKeywords(KeywordAll) {
376 partition.All = true
377 } else {
378 expr, err := p.parseExpr(p.Pos())
379 if err != nil {
380 return nil, err
381 }
382 partition.Expr = expr
383 }
384 return partition, nil
385}
386
387// Syntax: ALTER TABLE ATTACH partitionClause (FROM tableIdentifier)?
388func (p *Parser) parseAlterTableAttachPartition(pos Pos) (AlterTableClause, error) {

Calls 5

expectKeywordMethod · 0.95
tryConsumeKeywordsMethod · 0.95
parseStringMethod · 0.95
PosMethod · 0.95
parseExprMethod · 0.95

Tested by

no test coverage detected