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

Method tryParseClusterClause

parser/parser_table.go:842–867  ·  view source on GitHub ↗
(pos Pos)

Source from the content-addressed store, hash-verified

840}
841
842func (p *Parser) tryParseClusterClause(pos Pos) (*ClusterClause, error) {
843 if !p.tryConsumeKeywords(KeywordOn) {
844 return nil, nil // nolint
845 }
846 if err := p.expectKeyword(KeywordCluster); err != nil {
847 return nil, err
848 }
849
850 var expr Expr
851 var err error
852 switch {
853 case p.matchTokenKind(TokenKindIdent):
854 expr, err = p.parseIdent()
855 case p.matchTokenKind(TokenKindString):
856 expr, err = p.parseString(p.Pos())
857 default:
858 return nil, fmt.Errorf("unexpected token: %q, expected <IDENT> or <STRING>", p.last().String)
859 }
860 if err != nil {
861 return nil, err
862 }
863 return &ClusterClause{
864 OnPos: pos,
865 Expr: expr,
866 }, nil
867}
868
869func (p *Parser) tryParsePartitionByClause(pos Pos) (*PartitionByClause, error) {
870 if !p.tryConsumeKeywords(KeywordPartition) {

Callers 15

parseDropDatabaseMethod · 0.95
parseDropStmtMethod · 0.95
parseCreateViewMethod · 0.95
parseCreateLiveViewMethod · 0.95
parseAlterTableMethod · 0.95
parseOptimizeStmtMethod · 0.95
parseRoleNameMethod · 0.95
parserDropUserOrRoleMethod · 0.95
parseCreateDatabaseMethod · 0.95
parseCreateDictionaryMethod · 0.95

Calls 7

tryConsumeKeywordsMethod · 0.95
expectKeywordMethod · 0.95
matchTokenKindMethod · 0.95
parseIdentMethod · 0.95
parseStringMethod · 0.95
PosMethod · 0.95
lastMethod · 0.95

Tested by

no test coverage detected