Skip to content

fix(pretty-print): print SET headers on their own line in multiline - #248

Merged
sddonne merged 2 commits into
elastic:mainfrom
awahab07:fix/pipe-multiline-set-own-line
Sep 16, 2026
Merged

sddonne merged 2 commits into
elastic:mainfrom
awahab07:fix/pipe-multiline-set-own-line

Conversation

@awahab07

@awahab07 awahab07 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Print each SET header on its own line in multiline / pipe-multiline.

Those formats previously glued SET onto the source command with a space.

Matches SET and Discover Prettify:

ES|QL SET docs

Discover Prettify SET

Details

  • print('basic') and toRequest() stay a single line (SET …; TS …).
  • pipe-multiline still does not wrap inside commands (STATS … BY stays on one line).
  • Wrapping and Discover Prettify already used this SET layout; this only changes BasicPrettyPrinter multiline.

Checklist

  • Unit tests have been added or updated.
  • The proper documentation has been added or updated.
  • A changeset has been added (yarn changeset) if this change should be released. See docs/RELEASE.md.
  • If this PR contains breaking changes, you have explained them using the BREAKING CHANGE: change syntax and selected a major bump in the changeset.
  • The PR is opened as a draft until CI is green.

Multiline and pipe-multiline glued SET onto the source command with a space, unlike wrapping and the documented ES|QL layout.
@awahab07
awahab07 marked this pull request as ready for review September 15, 2026 15:40
@awahab07
awahab07 requested a review from a team as a code owner September 15, 2026 15:40

@sddonne sddonne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think it makes sense for pipe-multiline to apply to header commands too (even if they don't use pipes).

@awahab07

Copy link
Copy Markdown
Contributor Author

@sddonne thank you for reviewing the PR. Could you merge it, as I don't have write permissions to the repo.

@sddonne
sddonne enabled auto-merge (squash) September 16, 2026 11:28
@sddonne
sddonne merged commit 960bf20 into elastic:main Sep 16, 2026
1 check passed
momovdg pushed a commit that referenced this pull request Sep 18, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @elastic/esql-grammar@4.26.0

### Minor Changes

- [#249](#249)
[`18334b7`](18334b7)
Thanks [@momovdg](https://github.com/momovdg)! - Add `DENSE_VECTOR`
output-naming support, following the latest Elasticsearch grammar.

  Two new forms now parse, and round-trip through the pretty-printer:

- `DENSE_VECTOR target = field` — an explicit output column name,
exposed as `targetField`
- `DENSE_VECTOR suffix = "_dv" ON a, b` — a shared output-name suffix,
exposed as `suffix`, with the input fields carried on an `on` option

The grammar also makes the field list optional, which previously caused
the CST to AST conversion to throw on queries such as `FROM logs |
DENSE_VECTOR` and discard the whole AST. Those queries now convert to an
incomplete command.

That same grammar accepts a string literal where a field name is
expected, as in `FROM books | DENSE_VECTOR "the quick brown fox"`.
Elasticsearch rejects these queries with a `parsing_exception`, so the
converter builds no command parts for them: the command is marked
`incomplete` with no arguments, fields, target field or named
parameters, and any trailing `WITH` clause is dropped.
## @elastic/esql-parser@4.26.0

### Minor Changes

- [#249](#249)
[`18334b7`](18334b7)
Thanks [@momovdg](https://github.com/momovdg)! - Add `DENSE_VECTOR`
output-naming support, following the latest Elasticsearch grammar.

  Two new forms now parse, and round-trip through the pretty-printer:

- `DENSE_VECTOR target = field` — an explicit output column name,
exposed as `targetField`
- `DENSE_VECTOR suffix = "_dv" ON a, b` — a shared output-name suffix,
exposed as `suffix`, with the input fields carried on an `on` option

The grammar also makes the field list optional, which previously caused
the CST to AST conversion to throw on queries such as `FROM logs |
DENSE_VECTOR` and discard the whole AST. Those queries now convert to an
incomplete command.

That same grammar accepts a string literal where a field name is
expected, as in `FROM books | DENSE_VECTOR "the quick brown fox"`.
Elasticsearch rejects these queries with a `parsing_exception`, so the
converter builds no command parts for them: the command is marked
`incomplete` with no arguments, fields, target field or named
parameters, and any trailing `WITH` clause is dropped.

### Patch Changes

- Updated dependencies
[[`0df48e7`](0df48e7),
[`18334b7`](18334b7)]:
  - @elastic/esql-definitions@4.26.0
  - @elastic/esql-types@4.26.0
  - @elastic/esql-promql-grammar@4.26.0
  - @elastic/esql-traversal@4.26.0
  - @elastic/esql-ast@4.26.0
## @elastic/esql-types@4.26.0

### Minor Changes

- [#249](#249)
[`18334b7`](18334b7)
Thanks [@momovdg](https://github.com/momovdg)! - Add `DENSE_VECTOR`
output-naming support, following the latest Elasticsearch grammar.

  Two new forms now parse, and round-trip through the pretty-printer:

- `DENSE_VECTOR target = field` — an explicit output column name,
exposed as `targetField`
- `DENSE_VECTOR suffix = "_dv" ON a, b` — a shared output-name suffix,
exposed as `suffix`, with the input fields carried on an `on` option

The grammar also makes the field list optional, which previously caused
the CST to AST conversion to throw on queries such as `FROM logs |
DENSE_VECTOR` and discard the whole AST. Those queries now convert to an
incomplete command.

That same grammar accepts a string literal where a field name is
expected, as in `FROM books | DENSE_VECTOR "the quick brown fox"`.
Elasticsearch rejects these queries with a `parsing_exception`, so the
converter builds no command parts for them: the command is marked
`incomplete` with no arguments, fields, target field or named
parameters, and any trailing `WITH` clause is dropped.
## @elastic/esql@4.26.0

### Patch Changes

- [#248](#248)
[`960bf20`](960bf20)
Thanks [@awahab07](https://github.com/awahab07)! - Print SET header
commands on their own line in multiline and pipe-multiline output

- Updated dependencies
[[`0df48e7`](0df48e7),
[`18334b7`](18334b7)]:
  - @elastic/esql-definitions@4.26.0
  - @elastic/esql-grammar@4.26.0
  - @elastic/esql-types@4.26.0
  - @elastic/esql-parser@4.26.0
  - @elastic/esql-promql-grammar@4.26.0
  - @elastic/pretty-printer@4.26.0
  - @elastic/esql-traversal@4.26.0
  - @elastic/esql-ast@4.26.0
## @elastic/esql-ast@4.26.0

### Patch Changes

- Updated dependencies
[[`0df48e7`](0df48e7),
[`18334b7`](18334b7)]:
  - @elastic/esql-definitions@4.26.0
  - @elastic/esql-grammar@4.26.0
  - @elastic/esql-types@4.26.0
  - @elastic/esql-promql-grammar@4.26.0
## @elastic/esql-definitions@4.26.0

### Patch Changes

- [#246](#246)
[`0df48e7`](0df48e7)
Thanks [@momovdg](https://github.com/momovdg)! - Add `DENSE_VECTOR` to
`processingCommandNames` so it is highlighted as a command keyword in
TextMate, Monaco, Prism.js, and Highlight.js grammars
## @elastic/elasticsearch-esql-dsl@4.26.0

### Patch Changes

- Updated dependencies []:
  - @elastic/elasticsearch-query-builder@4.26.0
## @elastic/esql-traversal@4.26.0

### Patch Changes

- Updated dependencies
[[`18334b7`](18334b7)]:
  - @elastic/esql-types@4.26.0
  - @elastic/esql-ast@4.26.0
## @elastic/highlightjs-esql@4.26.0

### Patch Changes

- Updated dependencies
[[`0df48e7`](0df48e7)]:
  - @elastic/esql-definitions@4.26.0
## @elastic/monaco-esql@4.26.0

### Patch Changes

- Updated dependencies
[[`0df48e7`](0df48e7)]:
  - @elastic/esql-definitions@4.26.0
## @elastic/prismjs-esql@4.26.0

### Patch Changes

- Updated dependencies
[[`0df48e7`](0df48e7)]:
  - @elastic/esql-definitions@4.26.0
## @elastic/textmate-esql@4.26.0

### Patch Changes

- [#246](#246)
[`0df48e7`](0df48e7)
Thanks [@momovdg](https://github.com/momovdg)! - Add `DENSE_VECTOR` to
`processingCommandNames` so it is highlighted as a command keyword in
TextMate, Monaco, Prism.js, and Highlight.js grammars

- Updated dependencies
[[`0df48e7`](0df48e7)]:
  - @elastic/esql-definitions@4.26.0
## @elastic/esql-promql-grammar@4.26.0


## @elastic/pretty-printer@4.26.0


## @elastic/elasticsearch-query-builder@4.26.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants