ClickHouse/clickhouse-js

[client-common] Missing `rows_before_limit_at_least` property in `ResponseJSON<T>` type

0237h opened this issue · 3 comments

Describe the bug

It seems that the property rows_before_limit_at_least (described here in the docs) is missing from the ResponseJSON<T> type for the client-common library.

This leads to a property doesn't exists error in Typescript although the property can be accessed at runtime.

Current definition

packages/client-common/src/clickhouse_types.ts

export interface ResponseJSON<T = unknown> {
    data: Array<T>;
    query_id?: string;
    totals?: Record<string, number>;
    extremes?: Record<string, any>;
    meta?: Array<{
        name: string;
        type: string;
    }>;
    statistics?: {
        elapsed: number;
        rows_read: number;
        bytes_read: number;
    };
    rows?: number;
}

Expected definition

export interface ResponseJSON<T = unknown> {
    data: Array<T>;
    query_id?: string;
    totals?: Record<string, number>;
    extremes?: Record<string, any>;
    meta?: Array<{
        name: string;
        type: string;
    }>;
    statistics?: {
        elapsed: number;
        rows_read: number;
        bytes_read: number;
    };
    rows?: number;
    rows_before_limit_at_least?: number;
}

Code example

const response = await client.query({ query, query_params, format: "JSON" });
const data: ResponseJSON<T> = await response.json();

console.log({
    statistics: data.statistics,
    rows: data.rows,
    rows_before_limit_at_least: data.rows_before_limit_at_least // property doesn't exists
});

Configuration

Environment

  • Client version: 1.0.1
  • Language version: 5.4.5

Thanks for the report. Do you want to open a PR?

Thanks for the report. Do you want to open a PR?

Sure can do 👍

The fix will be released as 1.0.2 on Monday.