Minor changes
- c320820
Aggregate result types now match what ClickHouse returns, instead of
stringfor every aggregate:sum():numberforFloat*andDecimalcolumns,stringfor integer columns (they widen to a quotedInt64), plus| nullforNullablecolumns. Over a subquery or CTE column known only asnumber, it isnumber | string.avg(),stddev(),variance():number | null. NaN over too few rows arrives asnull.min(),max(),argMin(),argMax(): the column's own type.quantile():number | nullfor numeric columns, the column's type for dates.count(),countDistinct(),approxCountDistinct(): unchanged (string).
Code that converted results with
Number(...)keeps compiling. Code that called string methods on, for example, aFloat64sum now gets a type error where it used to fail at runtime.Schemas can now declare
AggregateFunction(...)andSimpleAggregateFunction(fn, T)columns, so a generated schema containing an AggregatingMergeTree table type-checks withcreateQueryBuilder<IntrospectedSchema>(). ASimpleAggregateFunction(fn, T)column hasT's type; anAggregateFunctioncolumn is an opaque state that you read withmergeState().GROUP BY inference no longer adds a selected expression that wraps an aggregate (
round(avg(x), 2)) or a window function (rank() OVER (ORDER BY sum(x))), which ClickHouse rejected with "Aggregate function ... is found in GROUP BY".The readonly error for the precision-safe 64-bit setting now names the fixes that keep precision: setting
output_format_json_quote_64bit_integers = 1in the user's profile, orreadonly = 2.integerJsonEncoding: 'server-default'is still offered as the fallback.The legacy
hypequery-generate-typesgenerator types parameterized views, and typesSimpleAggregateFunctioncolumns by their value type, as@hypequery/clinow does. - 3bb485c
Stream results as Arrow.
builder.streamArrow()anddb.rawArrowStream(sql, params)return the result as Arrow IPC stream bytes (ClickHouseArrowStream) with native column types, for any Arrow reader to decode or for passing on unchanged. Batches are uncompressed by default, because JavaScript Arrow readers don't include the LZ4 codec; a connection-level or per-calloutput_format_arrow_compression_methodoverrides that.db.rawStream(sql, params)streams a raw statement's rows, asbuilder.stream()does for built queries. If ClickHouse fails after sending part of an Arrow result, the stream errors rather than handing the exception text to the decoder: with ClickHouse's own error on ClickHouse 25.11 or later, which marks the failure, and on older servers because the bytes end without Arrow's end-of-stream marker. Custom adapters can implement the new optionalDatabaseAdapter.streamArrow. - c320820
Fix JavaScript
Datefilter values againstDateTimesorting-key columns. ADateused to render as a quoted ISO string ('2026-03-01T00:00:00.000Z'), which ClickHouse rejects withTYPE_MISMATCHwhen it compares the string with aDateTimecolumn in the sorting key. The same happened for aDatecolumn, and for any value with milliseconds. ADatenow renders astoDateTime('2026-03-01 00:00:00', 'UTC'), or astoDateTime64(..., 3, 'UTC')when it has milliseconds or falls outside theDateTimerange. This keeps the exact UTC instant, still lets the primary index prune, and works inINlists. It applies towhere,between,in,rawQueryplaceholders andCrossFilter.CrossFilterno longer convertsDatevalues to ISO strings itself. Dates inside array, tuple and map parameters are still sent as ISO text, whichCASTparses correctly.
Patch changes
- 0ba4596
Arrow streams work for
readonly = 1users and catch mid-stream failures on servers before ClickHouse 25.11.streamArrow()andrawArrowStream()request the format with aFORMAT ArrowStreamclause instead of thedefault_formatsetting, whichreadonly = 1users may not change. A trailing;or comment is dropped first.- The uncompressed-batches default (
output_format_arrow_compression_method = 'none') is still sent, and areadonly = 1user accepts it when its profile already sets that value. When ClickHouse rejects it, the error explains the fix. The newarrowCompression: 'server-default'adapter option leaves the setting out, so batches use the server's compression method. - Detecting a mid-stream failure from its tagged exception block needs ClickHouse 25.11 or later, because older servers send no
X-ClickHouse-Exception-Tag. An Arrow stream from any server now also errors when its bytes end without Arrow's end-of-stream marker, so a failed or truncated stream no longer looks complete. On older servers, ClickHouse's error message is recovered from the response where possible.
- 3bb485c
stream()no longer hangs when an adapter's byte stream splits a JSON row across two chunks, keeps a final row that has no trailing newline, and keeps characters split across chunks intact. The built-in adapter was unaffected because its client hands over whole rows; custom adapters that stream raw bytes were.