Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/scripts/esql_grammar_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ main () {
git config --global user.name "$MACHINE_USERNAME"
git config --global user.email 'elasticmachine@users.noreply.github.com'

PR_TITLE='[ES|QL] Update grammars'
PR_TITLE='chore: [ES|QL] Update grammars'
PR_BODY='This PR updates the ES|QL grammars (lexer and parser) and PromQL grammars to match the latest version in Elasticsearch.'

# Check if a PR already exists
Expand Down
56 changes: 2 additions & 54 deletions src/parser/__tests__/change_point.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,63 +220,11 @@ describe('CHANGE_POINT command', () => {
});

describe('configuration order', () => {
it('parses AS before ON (reversed order)', () => {
it('Throws error if AS is before ON (reversed order)', () => {
const text = `FROM index | CHANGE_POINT value AS type, pvalue ON key`;
const query = EsqlQuery.fromSrc(text);

expect(query.errors.length).toBe(0);
expect(query.ast.commands[1]).toMatchObject({
type: 'command',
name: 'change_point',
value: {
type: 'column',
name: 'value',
},
key: {
type: 'column',
name: 'key',
},
target: {
type: {
type: 'column',
name: 'type',
},
pvalue: {
type: 'column',
name: 'pvalue',
},
},
args: [
{
type: 'column',
name: 'value',
},
{
type: 'option',
name: 'as',
args: [
{
type: 'column',
name: 'type',
},
{
type: 'column',
name: 'pvalue',
},
],
},
{
type: 'option',
name: 'on',
args: [
{
type: 'column',
name: 'key',
},
],
},
],
});
expect(query.errors.length).toBe(1);
});
});

Expand Down
7 changes: 1 addition & 6 deletions src/parser/antlr/esql_parser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,7 @@ sampleCommand
;

changePointCommand
: CHANGE_POINT value=qualifiedName (changePointConfiguration)*
;

changePointConfiguration
: ON key=qualifiedName
| AS targetType=qualifiedName COMMA targetPvalue=qualifiedName
: CHANGE_POINT value=qualifiedName (ON key=qualifiedName)? (AS targetType=qualifiedName COMMA targetPvalue=qualifiedName)?
;

forkCommand
Expand Down
3 changes: 1 addition & 2 deletions src/parser/antlr/esql_parser.interp

Large diffs are not rendered by default.

Loading