You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
[BUG] JSQLParser 5.4-SNAPSHOT : ClickHouse : ORDER BY ... WITH FILL / INTERPOLATE not supported #2467
ClickHouse supports the WITH FILL modifier on ORDER BY expressions, which fills in missing rows in a sorted sequence (gap filling for time series). It accepts optional FROM, TO and STEP bounds, where STEP may be an INTERVAL literal, and an optional query-level INTERPOLATE clause that computes the values of non-sorted columns for the generated rows. JSQLParser fails to parse the WITH FILL modifier when used in ORDER BY.
CREATETABLEt (d Date, v UInt32) ENGINE = MergeTree ORDER BY d;
INSERT INTO t VALUES ('2024-01-03', 10), ('2024-01-06', 20), ('2024-01-10', 30);
SELECT d, v FROM t ORDER BY d WITH FILL FROM toDate('2024-01-01') TO toDate('2024-02-01') STEP INTERVAL 1 DAY INTERPOLATE (v AS v +1);
Parsing error
ParseException: Encountered: <K_WITH> / "WITH", at line 4, column 3, in lexical state DEFAULT.
Root cause: the grammar has no production for the WITH FILL modifier family (FROM/TO/STEP/STALENESS bounds on the order by element) nor for the query-level INTERPOLATE clause.
PR #2469 implements both following the ClickHouse reference parser: per element [WITH FILL] [FROM expr] [TO expr] [STEP expr] [STALENESS expr] (the step accepts INTERVAL literals) and INTERPOLATE [(col [AS expr], ...)] after the ORDER BY list, where the bare form fills all allowed columns. The keywords stay non-reserved, so fill, step, staleness and interpolate remain usable as column names.
Activity
fudianchn commentedon Aug 15, 2026
Root cause: the grammar has no production for the
WITH FILLmodifier family (FROM/TO/STEP/STALENESSbounds on the order by element) nor for the query-levelINTERPOLATEclause.PR #2469 implements both following the ClickHouse reference parser: per element
[WITH FILL] [FROM expr] [TO expr] [STEP expr] [STALENESS expr](the step acceptsINTERVALliterals) andINTERPOLATE [(col [AS expr], ...)]after the ORDER BY list, where the bare form fills all allowed columns. The keywords stay non-reserved, sofill,step,stalenessandinterpolateremain usable as column names.fix: support ClickHouse ORDER BY WITH FILL and INTERPOLATE (#2467) (#…