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

Method tryParseJoinConstraints

parser/parser_query.go:141–169  ·  view source on GitHub ↗
(pos Pos)

Source from the content-addressed store, hash-verified

139}
140
141func (p *Parser) tryParseJoinConstraints(pos Pos) (Expr, error) {
142 switch {
143 case p.tryConsumeKeywords(KeywordOn):
144 columnExprList, err := p.parseColumnExprList(p.Pos())
145 if err != nil {
146 return nil, err
147 }
148 return &OnClause{
149 OnPos: pos,
150 On: columnExprList,
151 }, nil
152 case p.tryConsumeKeywords(KeywordUsing):
153 hasParen := p.tryConsumeTokenKind(TokenKindLParen) != nil
154 columnExprList, err := p.parseColumnExprListWithLParen(p.Pos())
155 if err != nil {
156 return nil, err
157 }
158 if hasParen {
159 if err := p.expectTokenKind(TokenKindRParen); err != nil {
160 return nil, err
161 }
162 }
163 return &UsingClause{
164 UsingPos: pos,
165 Using: columnExprList,
166 }, nil
167 }
168 return nil, nil
169}
170
171func (p *Parser) parseJoinOp(_ Pos) []string {
172 var modifiers []string

Callers 1

parseJoinRightExprMethod · 0.95

Calls 6

tryConsumeKeywordsMethod · 0.95
parseColumnExprListMethod · 0.95
PosMethod · 0.95
tryConsumeTokenKindMethod · 0.95
expectTokenKindMethod · 0.95

Tested by

no test coverage detected