Skip to content

docs(core): date, comparison and scalar rules as the engine answers them; examples that run - #469

Merged
fupelaqu merged 3 commits into
mainfrom
docs/468-core-alignment
Nov 19, 2026
Merged

fupelaqu merged 3 commits into
mainfrom
docs/468-core-alignment

Conversation

@fupelaqu

Copy link
Copy Markdown
Contributor

Summary

The reference pages now say what the engine answers for the date, comparison and scalar rules of
0.24.0, as the next release runs them, and their examples parse and run. Documentation only.

Refs #468 (the site pages follow in a separate change).

Corrections measured on Elasticsearch 8.18.3 and 6.8.23

  • A date result over aggregates (MAX(d) + 1, per group or over the whole table) answers its date or
    timestamp; the page said epoch milliseconds.
  • HAVING MAX(created) > '2019-01-01' keeps the right groups since 0.24.0; the page said it was
    refused.
  • On Elasticsearch 6.8 a date column compared with another date column (or with a date function or
    date arithmetic of one) runs; the page warned of a 400.
  • A boolean literal cast to a number (CAST(TRUE AS INT)) fails to compile on Elasticsearch 6.8; a
    boolean column cast runs. New Known Limitations entry and a Version Compatibility note.
  • A CASE used as an operand is one value; a simple CASE keeps its values' type; NULLIF compares
    a DATE with a quoted date in either shape; an undeclared date field is reported TIMESTAMP
    since 0.24.0.

Reference statements the code no longer supported (two commits from an earlier alignment branch,
rebased on main)

  • Failed shards answer an error (search, scroll, UNION ALL), search_after and the _id order on
    Elasticsearch 6, failOnWindowError and its default.
  • Function references stop documenting what the parser rejects: LN, SGN, CURRENT_DATETIME and
    VERSION() are not functions; PI takes no parentheses; the accepted aliases (CEILING, POWER,
    LCASE, UCASE, LEN, CURDATE, CURTIME) and ISNULL / ISNOTNULL are listed.

Mathematical function examples

Every example the parser refuses (an arithmetic expression as a function argument) or that
Elasticsearch fails (a POWER or ROUND result under an arithmetic operator, some functions nested
over a column) is rewritten or removed, and the page says so once. Trigonometric results give the
values returned (COS(RADIANS(60)) is 0.5000000000000001).

Testing

  • Every SQL statement the diff adds, and every statement of the mathematical functions page, parsed
    against the parser of main: all parse, except the ones shown as refused.
  • Each behaviour claim run on Elasticsearch 8.18.3 and 6.8.23 (about 140 statements, both majors).
  • Two independent reviews: 13 findings, one fix round, then a delta review: all resolved.

Recorded, not fixed

  • BETWEEN with a column as a bound fails before running (Unsupported out type for range query),
    and a literal plus a column bound fails in Elasticsearch.
  • STRPOS(col, 'a') fails to compile in Elasticsearch (POSITION('a' IN col) runs); the string
    function page still lists STRPOS.
  • A POWER / ROUND result under an arithmetic operator and some functions nested over a column
    fail in Elasticsearch; Known Limitations has no entry for them yet.
  • ROUND(AVG(price), 2) with GROUP BY and POWER(16, 0.5) are refused at parse.
  • Operator precedence page: the unary + and WHERE price > 50 = true examples do not parse.
  • A keyword beside a long in an index pattern is described as VARCHAR; DESCRIBE reports
    KEYWORD.
  • A testkit spec still cancels DATE_FORMAT on Elasticsearch 6.8, where it now runs.

🤖 Generated with Claude Code

fupelaqu and others added 3 commits November 18, 2026 22:00
…w default since 0.24.0

Documents three 0.24.0 behaviours the reference did not carry. A search on which some shards fail
answers an error, not the other shards' rows (search: the message and status; scroll: every paging
path; the SQL ORDER BY note links both). search_after needs no ORDER BY: it pages on _id, which
since 0.24.0 tolerates an Elasticsearch 6 index created without any mapping. ScrollConfig gains
failOnWindowError, whose default now fails a statement whose window values cannot be computed.

Also carries what the public site states and this reference lacked: the JOIN UNNEST key notes and
the 0.24.0 stamp of the GROUP BY key conditions, POINT's argument rules, the Transact-SQL CONVERT
order and three cast notes, the watcher refusal of table-qualified columns over several indices,
and the GROUP BY refusal of a key formatting a bare date column on Elasticsearch 6. The DDL bullet
on a narrowing cast now agrees with the / operator: a division is always a DOUBLE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Known limitations no longer says INSERT, UPDATE, CREATE, DROP and ALTER names cannot be quoted:
every statement takes them since the DQL, DML and DDL name rules were unified.

The function references stop documenting what the parser rejects. LN, SGN, CURRENT_DATETIME and
VERSION() are not functions of this engine, and PI is a constant written without parentheses. An
alias that is a reserved word (distance, now, today, current_time, min, as, at, pi) does not parse
and is renamed. POINT has no standalone form and is shown inside ST_DISTANCE; a FROM-less SELECT
takes no WHERE; a JOIN on a distance, which an ON clause refuses, becomes a filtered count; and
GREATEST / LEAST, the trigonometry and the Euclidean-distance examples no longer pass an
arithmetic expression as a function argument. The DQL function tables gain the aliases the parser
accepts (CEILING, POWER, LCASE, UCASE, LEN, STRPOS, CURDATE, CURTIME) and ISNULL / ISNOTNULL, and
the precedence examples print a division as the DOUBLE it is. Every rewritten statement was parsed
against the parser of this tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hem; examples that run

Measured on Elasticsearch 8.18.3 and 6.8.23 with the engine at main:

- A date result over aggregates (MAX(d) + 1, per group or over the whole table) answers its date or
  timestamp, no longer epoch milliseconds.
- A date aggregate compared with a date literal in HAVING keeps the right groups since 0.24.0.
- On Elasticsearch 6.8 a date column compared with another date column runs; a boolean literal cast
  to a number (CAST(TRUE AS INT)) fails to compile there, which Known Limitations and Version
  Compatibility now say.
- A CASE used as an operand is one value; a simple CASE keeps its values' type; NULLIF compares a
  DATE with a quoted date in either shape.
- An undeclared date field reported as TIMESTAMP since 0.24.0.
- The HAVING key paragraph states what 0.24.0 changed (refused combinations), and the date
  aggregate note what 0.23 did (Elasticsearch failed the search).
- Mathematical functions: examples the parser refuses (an arithmetic expression as a function
  argument) and examples Elasticsearch fails (a function result under an arithmetic operator, some
  functions nested over a column) are rewritten or removed; trigonometric results give the values
  returned; VERSION() no longer lists inputs and an output type.
- Cherry-pick leftovers: a doubled sentence in the quoted identifiers limits, a watcher paragraph
  that repeated the block below it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fupelaqu
fupelaqu marked this pull request as ready for review November 19, 2026 10:59
@fupelaqu
fupelaqu merged commit c167e07 into main Nov 19, 2026
4 checks passed
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.

1 participant