(pos Pos)
| 777 | } |
| 778 | |
| 779 | func (p *Parser) parseAlterTableMaterialize(pos Pos) (AlterTableClause, error) { |
| 780 | if err := p.expectKeyword(KeywordMaterialize); err != nil { |
| 781 | return nil, err |
| 782 | } |
| 783 | var kind string |
| 784 | switch { |
| 785 | case p.matchKeyword(KeywordIndex): |
| 786 | kind = KeywordIndex |
| 787 | case p.matchKeyword(KeywordProjection): |
| 788 | kind = KeywordProjection |
| 789 | default: |
| 790 | return nil, fmt.Errorf("expected keyword: INDEX|PROJECTION, but got %q", p.lastTokenKind()) |
| 791 | } |
| 792 | _ = p.lexer.consumeToken() |
| 793 | |
| 794 | ifExists, err := p.tryParseIfExists() |
| 795 | if err != nil { |
| 796 | return nil, err |
| 797 | } |
| 798 | name, err := p.ParseNestedIdentifier(p.Pos()) |
| 799 | if err != nil { |
| 800 | return nil, err |
| 801 | } |
| 802 | statementEnd := name.End() |
| 803 | var partition *PartitionClause |
| 804 | if p.tryConsumeKeywords(KeywordIn) { |
| 805 | partition, err = p.tryParsePartitionClause(p.Pos()) |
| 806 | if err != nil { |
| 807 | return nil, err |
| 808 | } |
| 809 | statementEnd = partition.End() |
| 810 | } |
| 811 | if kind == KeywordIndex { |
| 812 | return &AlterTableMaterializeIndex{ |
| 813 | MaterializedPos: pos, |
| 814 | StatementEnd: statementEnd, |
| 815 | IfExists: ifExists, |
| 816 | IndexName: name, |
| 817 | Partition: partition, |
| 818 | }, nil |
| 819 | } |
| 820 | return &AlterTableMaterializeProjection{ |
| 821 | MaterializedPos: pos, |
| 822 | StatementEnd: statementEnd, |
| 823 | IfExists: ifExists, |
| 824 | ProjectionName: name, |
| 825 | Partition: partition, |
| 826 | }, nil |
| 827 | } |
| 828 | |
| 829 | func (p *Parser) parseAlterTableReset(pos Pos) (AlterTableClause, error) { |
| 830 | if err := p.expectKeyword(KeywordReset); err != nil { |
no test coverage detected