@clickhouse/client 1.23.0-head.c8dc8d8.1 → 1.23.0-head.dbc2960.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/common/index.d.ts +3 -3
- package/dist/common/index.js +2 -2
- package/dist/common/index.js.map +1 -1
- package/dist/common/parse/column_types.d.ts +30 -2
- package/dist/common/parse/column_types.js +8 -0
- package/dist/common/parse/column_types.js.map +1 -1
- package/dist/common/settings.d.ts +17 -0
- package/dist/common/settings.js.map +1 -1
- package/dist/config.d.ts +21 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/clickhouse-js-node-rowbinary-parser/README.md +7 -0
- package/skills/clickhouse-js-node-rowbinary-parser/SKILL.md +16 -0
- package/skills/clickhouse-js-node-rowbinary-parser/src/compile.ts +318 -0
- package/skills/clickhouse-js-node-rowbinary-parser/src/header.ts +29 -0
- package/skills/clickhouse-js-node-rowbinary-parser/src/reader.ts +17 -0
- package/skills/clickhouse-js-node-rowbinary-parser/src/rowBinaryWithNamesAndTypes.ts +155 -0
package/dist/client.js
CHANGED
|
@@ -12,8 +12,15 @@ class NodeClickHouseClient extends index_1.ClickHouseClient {
|
|
|
12
12
|
}
|
|
13
13
|
exports.NodeClickHouseClient = NodeClickHouseClient;
|
|
14
14
|
function createClient(config) {
|
|
15
|
+
// If the caller injected a pre-built Connection, override the
|
|
16
|
+
// default HTTP make_connection factory to return THAT connection
|
|
17
|
+
// instead. Used for the experimental integration with chDB only.
|
|
18
|
+
const injected = config?.connection;
|
|
19
|
+
const impl = injected !== undefined
|
|
20
|
+
? { ...config_1.NodeConfigImpl, make_connection: () => injected }
|
|
21
|
+
: config_1.NodeConfigImpl;
|
|
15
22
|
return new index_1.ClickHouseClient({
|
|
16
|
-
impl
|
|
23
|
+
impl,
|
|
17
24
|
...(config || {}),
|
|
18
25
|
});
|
|
19
26
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAwBA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAwBA,oCAeC;AAtCD,0CAAkD;AAGlD,qCAA0C;AAW1C,MAAa,oBAAqB,SAAQ,wBAAiC;IACzE,0CAA0C;IACjC,KAAK,CACZ,MAAqC;QAErC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAA+B,CAAC;IAC3D,CAAC;CACF;AAPD,oDAOC;AAED,SAAgB,YAAY,CAC1B,MAA0C;IAE1C,8DAA8D;IAC9D,iEAAiE;IACjE,iEAAiE;IACjE,MAAM,QAAQ,GAAG,MAAM,EAAE,UAAU,CAAC;IACpC,MAAM,IAAI,GACR,QAAQ,KAAK,SAAS;QACpB,CAAC,CAAC,EAAE,GAAG,uBAAc,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE;QACxD,CAAC,CAAC,uBAAc,CAAC;IACrB,OAAO,IAAI,wBAAgB,CAAkB;QAC3C,IAAI;QACJ,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;KAClB,CAAyB,CAAC;AAC7B,CAAC"}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -44,14 +44,14 @@ isProgressRow,
|
|
|
44
44
|
isRow,
|
|
45
45
|
/** @deprecated Import `isException` from `@clickhouse/client` (Node.js) or `@clickhouse/client-web` (Web) instead. Importing it from `@clickhouse/client-common` is deprecated. */
|
|
46
46
|
isException, } from "./clickhouse_types";
|
|
47
|
-
export { type ClickHouseSettings, type MergeTreeSettings,
|
|
47
|
+
export { type ClickHouseSettings, type ClickHouseSettingsInterface, type MergeTreeSettings,
|
|
48
48
|
/** @deprecated Import `SettingsMap` from `@clickhouse/client` (Node.js) or `@clickhouse/client-web` (Web) instead. Importing it from `@clickhouse/client-common` is deprecated. */
|
|
49
49
|
SettingsMap, } from "./settings";
|
|
50
50
|
export type { SimpleColumnType, ParsedColumnSimple, ParsedColumnEnum, ParsedColumnFixedString, ParsedColumnNullable, ParsedColumnDecimal, ParsedColumnDateTime, ParsedColumnDateTime64, ParsedColumnArray, ParsedColumnTuple, ParsedColumnMap, ParsedColumnType, JSONHandling, } from "./parse";
|
|
51
51
|
export {
|
|
52
|
-
/** @deprecated
|
|
52
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. (Also: import client APIs from `@clickhouse/client`/`@clickhouse/client-web`, not `@clickhouse/client-common`.) */
|
|
53
53
|
SimpleColumnTypes,
|
|
54
|
-
/** @deprecated
|
|
54
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. (Also: import client APIs from `@clickhouse/client`/`@clickhouse/client-web`, not `@clickhouse/client-common`.) */
|
|
55
55
|
parseColumnType,
|
|
56
56
|
/** @deprecated Import `defaultJSONHandling` from `@clickhouse/client` (Node.js) or `@clickhouse/client-web` (Web) instead. Importing it from `@clickhouse/client-common` is deprecated. */
|
|
57
57
|
defaultJSONHandling, } from "./parse";
|
package/dist/common/index.js
CHANGED
|
@@ -48,9 +48,9 @@ var settings_1 = require("./settings");
|
|
|
48
48
|
/** @deprecated Import `SettingsMap` from `@clickhouse/client` (Node.js) or `@clickhouse/client-web` (Web) instead. Importing it from `@clickhouse/client-common` is deprecated. */
|
|
49
49
|
Object.defineProperty(exports, "SettingsMap", { enumerable: true, get: function () { return settings_1.SettingsMap; } });
|
|
50
50
|
var parse_1 = require("./parse");
|
|
51
|
-
/** @deprecated
|
|
51
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. (Also: import client APIs from `@clickhouse/client`/`@clickhouse/client-web`, not `@clickhouse/client-common`.) */
|
|
52
52
|
Object.defineProperty(exports, "SimpleColumnTypes", { enumerable: true, get: function () { return parse_1.SimpleColumnTypes; } });
|
|
53
|
-
/** @deprecated
|
|
53
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. (Also: import client APIs from `@clickhouse/client`/`@clickhouse/client-web`, not `@clickhouse/client-common`.) */
|
|
54
54
|
Object.defineProperty(exports, "parseColumnType", { enumerable: true, get: function () { return parse_1.parseColumnType; } });
|
|
55
55
|
/** @deprecated Import `defaultJSONHandling` from `@clickhouse/client` (Node.js) or `@clickhouse/client-web` (Web) instead. Importing it from `@clickhouse/client-common` is deprecated. */
|
|
56
56
|
Object.defineProperty(exports, "defaultJSONHandling", { enumerable: true, get: function () { return parse_1.defaultJSONHandling; } });
|
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;AAEH,kDAAkD;AAClD,mCAgBkB;AAVhB,mOAAmO;AACnO,0GAAA,gBAAgB,OAAA;AA2BlB,mDAe0B;AAdxB,4LAA4L;AAC5L,sHAAA,oBAAoB,OAAA;AACpB,2LAA2L;AAC3L,qHAAA,mBAAmB,OAAA;AACnB,yLAAyL;AACzL,mHAAA,iBAAiB,OAAA;AACjB,6LAA6L;AAC7L,uHAAA,qBAAqB,OAAA;AACrB,iMAAiM;AACjM,2HAAA,yBAAyB,OAAA;AACzB,0LAA0L;AAC1L,oHAAA,kBAAkB,OAAA;AAClB,kLAAkL;AAClL,4GAAA,UAAU,OAAA;AAEZ,iCAKiB;AAJf,uLAAuL;AACvL,wGAAA,eAAe,OAAA;AACf,kLAAkL;AAClL,mGAAA,UAAU,OAAA;AAEZ,mCAOkB;AANhB,0LAA0L;AAC1L,4GAAA,kBAAkB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AA,eAAe,OAAA;AAGjB,gEAAgE;AAChE,mDAQ0B;AAPxB,qHAAA,mBAAmB,OAAA;AACnB,mHAAA,iBAAiB,OAAA;AACjB,4GAAA,UAAU,OAAA;AACV,sHAAA,oBAAoB,OAAA;AACpB,wHAAA,sBAAsB,OAAA;AACtB,2HAAA,yBAAyB,OAAA;AACzB,sHAAA,oBAAoB,OAAA;AAEtB,mCAUkB;AAJhB,+GAAA,qBAAqB,OAAA;AACrB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,8GAAA,oBAAoB,OAAA;AAEtB,iCAeiB;AAdf,kHAAA,yBAAyB,OAAA;AACzB,6GAAA,oBAAoB,OAAA;AACpB,8FAAA,KAAK,OAAA;AACL,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,mHAAA,0BAA0B,OAAA;AAC1B,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AACT,oHAAA,2BAA2B,OAAA;AAC3B,qGAAA,YAAY,OAAA;AAEd,mCAA0E;AAAjE,mGAAA,SAAS,OAAA;AAAE,uGAAA,aAAa,OAAA;AACjC,iCAAkE;AAAzD,6GAAA,oBAAoB,OAAA;AAAE,0GAAA,iBAAiB,OAAA"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
1
2
|
export declare class ColumnTypeParseError extends Error {
|
|
2
3
|
readonly args: Record<string, unknown>;
|
|
3
4
|
constructor(message: string, args?: Record<string, unknown>);
|
|
4
5
|
}
|
|
6
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
5
7
|
export declare const SimpleColumnTypes: readonly ["Bool", "UInt8", "Int8", "UInt16", "Int16", "UInt32", "Int32", "UInt64", "Int64", "UInt128", "Int128", "UInt256", "Int256", "Float32", "Float64", "String", "UUID", "Date", "Date32", "IPv4", "IPv6"];
|
|
8
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
6
9
|
export type SimpleColumnType = (typeof SimpleColumnTypes)[number];
|
|
10
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
7
11
|
export interface ParsedColumnSimple {
|
|
8
12
|
type: "Simple";
|
|
9
13
|
/** Without LowCardinality and Nullable. For example:
|
|
@@ -13,16 +17,19 @@ export interface ParsedColumnSimple {
|
|
|
13
17
|
/** The original type before parsing. */
|
|
14
18
|
sourceType: string;
|
|
15
19
|
}
|
|
20
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
16
21
|
export interface ParsedColumnFixedString {
|
|
17
22
|
type: "FixedString";
|
|
18
23
|
sizeBytes: number;
|
|
19
24
|
sourceType: string;
|
|
20
25
|
}
|
|
26
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
21
27
|
export interface ParsedColumnDateTime {
|
|
22
28
|
type: "DateTime";
|
|
23
29
|
timezone: string | null;
|
|
24
30
|
sourceType: string;
|
|
25
31
|
}
|
|
32
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
26
33
|
export interface ParsedColumnDateTime64 {
|
|
27
34
|
type: "DateTime64";
|
|
28
35
|
timezone: string | null;
|
|
@@ -30,6 +37,7 @@ export interface ParsedColumnDateTime64 {
|
|
|
30
37
|
precision: number;
|
|
31
38
|
sourceType: string;
|
|
32
39
|
}
|
|
40
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
33
41
|
export interface ParsedColumnEnum {
|
|
34
42
|
type: "Enum";
|
|
35
43
|
/** Index to name */
|
|
@@ -43,18 +51,25 @@ export interface ParsedColumnEnum {
|
|
|
43
51
|
* * 64 bits for precision < 19
|
|
44
52
|
* * 128 bits for precision < 39
|
|
45
53
|
* * 256 bits for precision >= 39
|
|
54
|
+
*
|
|
55
|
+
* @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version.
|
|
46
56
|
*/
|
|
47
57
|
export interface DecimalParams {
|
|
48
58
|
precision: number;
|
|
49
59
|
scale: number;
|
|
50
60
|
intSize: 32 | 64 | 128 | 256;
|
|
51
61
|
}
|
|
62
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
52
63
|
export interface ParsedColumnDecimal {
|
|
53
64
|
type: "Decimal";
|
|
54
65
|
params: DecimalParams;
|
|
55
66
|
sourceType: string;
|
|
56
67
|
}
|
|
57
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Tuple, Array or Map itself cannot be Nullable
|
|
70
|
+
*
|
|
71
|
+
* @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version.
|
|
72
|
+
*/
|
|
58
73
|
export interface ParsedColumnNullable {
|
|
59
74
|
type: "Nullable";
|
|
60
75
|
value: ParsedColumnSimple | ParsedColumnEnum | ParsedColumnDecimal | ParsedColumnFixedString | ParsedColumnDateTime | ParsedColumnDateTime64;
|
|
@@ -63,6 +78,8 @@ export interface ParsedColumnNullable {
|
|
|
63
78
|
/** Array cannot be Nullable or LowCardinality, but its value type can be.
|
|
64
79
|
* Arrays can be multidimensional, e.g. Array(Array(Array(T))).
|
|
65
80
|
* Arrays are allowed to have a Map as the value type.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version.
|
|
66
83
|
*/
|
|
67
84
|
export interface ParsedColumnArray {
|
|
68
85
|
type: "Array";
|
|
@@ -71,7 +88,10 @@ export interface ParsedColumnArray {
|
|
|
71
88
|
dimensions: number;
|
|
72
89
|
sourceType: string;
|
|
73
90
|
}
|
|
74
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* @see https://clickhouse.com/docs/en/sql-reference/data-types/map
|
|
93
|
+
* @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version.
|
|
94
|
+
*/
|
|
75
95
|
export interface ParsedColumnMap {
|
|
76
96
|
type: "Map";
|
|
77
97
|
/** Possible key types:
|
|
@@ -85,14 +105,22 @@ export interface ParsedColumnMap {
|
|
|
85
105
|
value: ParsedColumnType;
|
|
86
106
|
sourceType: string;
|
|
87
107
|
}
|
|
108
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
88
109
|
export interface ParsedColumnTuple {
|
|
89
110
|
type: "Tuple";
|
|
90
111
|
/** Element types are arbitrary, including Map, Array, and Tuple. */
|
|
91
112
|
elements: ParsedColumnType[];
|
|
92
113
|
sourceType: string;
|
|
93
114
|
}
|
|
115
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
94
116
|
export type ParsedColumnType = ParsedColumnSimple | ParsedColumnEnum | ParsedColumnFixedString | ParsedColumnNullable | ParsedColumnDecimal | ParsedColumnDateTime | ParsedColumnDateTime64 | ParsedColumnArray | ParsedColumnTuple | ParsedColumnMap;
|
|
95
117
|
/**
|
|
118
|
+
* @deprecated Superseded by the standalone `@clickhouse/datatype-parser` package
|
|
119
|
+
* — use `parseDataType` and its `Node` AST instead. That parser is
|
|
120
|
+
* server-faithful and already handles the source types listed below as
|
|
121
|
+
* unsupported here (Geo, (Simple)AggregateFunction, Nested, JSON, Dynamic,
|
|
122
|
+
* Variant). Slated for removal in a future major version.
|
|
123
|
+
*
|
|
96
124
|
* @experimental - incomplete, unstable API;
|
|
97
125
|
* originally intended to be used for RowBinary/Native header parsing internally.
|
|
98
126
|
* Currently unsupported source types:
|
|
@@ -12,6 +12,7 @@ exports.parseDateTime64Type = parseDateTime64Type;
|
|
|
12
12
|
exports.parseFixedStringType = parseFixedStringType;
|
|
13
13
|
exports.asNullableType = asNullableType;
|
|
14
14
|
exports.getElementsTypes = getElementsTypes;
|
|
15
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
15
16
|
class ColumnTypeParseError extends Error {
|
|
16
17
|
args;
|
|
17
18
|
constructor(message, args) {
|
|
@@ -23,6 +24,7 @@ class ColumnTypeParseError extends Error {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
exports.ColumnTypeParseError = ColumnTypeParseError;
|
|
27
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
26
28
|
exports.SimpleColumnTypes = [
|
|
27
29
|
"Bool",
|
|
28
30
|
"UInt8",
|
|
@@ -47,6 +49,12 @@ exports.SimpleColumnTypes = [
|
|
|
47
49
|
"IPv6",
|
|
48
50
|
];
|
|
49
51
|
/**
|
|
52
|
+
* @deprecated Superseded by the standalone `@clickhouse/datatype-parser` package
|
|
53
|
+
* — use `parseDataType` and its `Node` AST instead. That parser is
|
|
54
|
+
* server-faithful and already handles the source types listed below as
|
|
55
|
+
* unsupported here (Geo, (Simple)AggregateFunction, Nested, JSON, Dynamic,
|
|
56
|
+
* Variant). Slated for removal in a future major version.
|
|
57
|
+
*
|
|
50
58
|
* @experimental - incomplete, unstable API;
|
|
51
59
|
* originally intended to be used for RowBinary/Native header parsing internally.
|
|
52
60
|
* Currently unsupported source types:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column_types.js","sourceRoot":"","sources":["../../../src/common/parse/column_types.ts"],"names":[],"mappings":";;;AAgLA,0CA+CC;AAED,4CA4DC;AA8CD,sCA+HC;AAED,oCAuCC;AAED,wCAsBC;AAED,wCA2CC;AAED,8CAgCC;AAED,kDAgCC;AAED,oDA6BC;AAED,wCAsBC;AAMD,4CAmDC;AA5uBD,MAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA0B;IACvC,YAAY,OAAe,EAAE,IAA8B;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,qCAAqC;QACrC,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AAVD,oDAUC;AAEY,QAAA,iBAAiB,GAAG;IAC/B,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;CACE,CAAC;AAmIX;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,IAAI,UAAU,GAAG,UAAU,CAAC;IAC5B,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,UAAU,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAChD,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1C,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,cA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W,CAAC;AACpC,MAAM,UAAU,GAAG,EAAW,CAAC;AAC/B,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,cAAc,GAAG,EAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"column_types.js","sourceRoot":"","sources":["../../../src/common/parse/column_types.ts"],"names":[],"mappings":";;;AA4MA,0CA+CC;AAED,4CA4DC;AA8CD,sCA+HC;AAED,oCAuCC;AAED,wCAsBC;AAED,wCA2CC;AAED,8CAgCC;AAED,kDAgCC;AAED,oDA6BC;AAED,wCAsBC;AAMD,4CAmDC;AAxwBD,4JAA4J;AAC5J,MAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA0B;IACvC,YAAY,OAAe,EAAE,IAA8B;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,qCAAqC;QACrC,gIAAgI;QAChI,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;CACF;AAVD,oDAUC;AAED,4JAA4J;AAC/I,QAAA,iBAAiB,GAAG;IAC/B,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;CACE,CAAC;AAuJX;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,IAAI,UAAU,GAAG,UAAU,CAAC;IAC5B,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,UAAU,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAChD,UAAU,GAAG,UA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,CAAC;AACxD,MAAM,gBAAgB,GAAG,aAAsB,CAAC;AAChD,MAAM,iBAAiB,GAAG,cAAuB,CAAC;AAElD,MAAM,gBAAgB,GAAG,EAAW,CAAC;AACrC,MAAM,cAAc,GAAG,EAAW,CAAC;AACnC,MAAM,eAAe,GAAG,EAAW,CAAC;AACpC,MAAM,UAAU,GAAG,EAAW,CAAC;AAC/B,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,SAAS,GAAG,EAAW,CAAC;AAC9B,MAAM,cAAc,GAAG,EAAW,CAAC"}
|
|
@@ -1634,6 +1634,23 @@ interface ClickHouseHTTPSettings {
|
|
|
1634
1634
|
session_check: Bool;
|
|
1635
1635
|
}
|
|
1636
1636
|
export type ClickHouseSettings = Partial<ClickHouseServerSettings> & Partial<ClickHouseHTTPSettings> & Record<string, number | string | boolean | SettingsMap | undefined>;
|
|
1637
|
+
/**
|
|
1638
|
+
* A package-neutral, structural view of {@link ClickHouseSettings}.
|
|
1639
|
+
*
|
|
1640
|
+
* Identical to {@link ClickHouseSettings} except that the index signature does
|
|
1641
|
+
* not include {@link SettingsMap}. `SettingsMap` is a class with a private
|
|
1642
|
+
* member, so TypeScript compares it nominally; because `@clickhouse/client` and
|
|
1643
|
+
* `@clickhouse/client-web` each bundle their own copy of this module, their
|
|
1644
|
+
* `ClickHouseSettings` types are mutually unassignable. This interface omits the
|
|
1645
|
+
* only nominal member, so it is structurally identical across all three packages
|
|
1646
|
+
* and assignable into each package's `ClickHouseSettings`.
|
|
1647
|
+
*
|
|
1648
|
+
* Intended for consumers that share a single settings-producing helper across
|
|
1649
|
+
* both the Node.js and Web clients and therefore cannot import a single concrete
|
|
1650
|
+
* `ClickHouseSettings`. Note: values typed as {@link SettingsMap} cannot be
|
|
1651
|
+
* carried through this type — use {@link ClickHouseSettings} if you need them.
|
|
1652
|
+
*/
|
|
1653
|
+
export type ClickHouseSettingsInterface = Partial<ClickHouseServerSettings> & Partial<ClickHouseHTTPSettings> & Record<string, number | string | boolean | undefined>;
|
|
1637
1654
|
export interface MergeTreeSettings {
|
|
1638
1655
|
/** Allow floating point as partition key */
|
|
1639
1656
|
allow_floating_point_partition_key?: Bool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/common/settings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/common/settings.ts"],"names":[],"mappings":";;;AAm8DA,MAAa,WAAW;IACL,MAAM,CAAyB;IAChD,YAAoB,MAA8B;QAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;aAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAA8B;QACxC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACF;AAfD,kCAeC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImplementationDetails } from "./common/index";
|
|
2
|
-
import { type BaseClickHouseClientConfigOptions } from "./common/index";
|
|
2
|
+
import { type BaseClickHouseClientConfigOptions, type Connection } from "./common/index";
|
|
3
3
|
import type http from "http";
|
|
4
4
|
import type https from "node:https";
|
|
5
5
|
import type Stream from "stream";
|
|
@@ -62,6 +62,26 @@ export type NodeClickHouseClientConfigOptions = BaseClickHouseClientConfigOption
|
|
|
62
62
|
* through to the request options.
|
|
63
63
|
* @default undefined */
|
|
64
64
|
max_response_headers_size?: number;
|
|
65
|
+
/** Pre-built backend connection to use for this client instead of the
|
|
66
|
+
* default HTTP(S) connection factory. When provided, the client routes
|
|
67
|
+
* every method (`query` / `insert` / `command` / `exec` / `ping` /
|
|
68
|
+
* `close`) through this connection's implementation of the internal
|
|
69
|
+
* {@link Connection} contract, and the HTTP-related options above
|
|
70
|
+
* (`tls`, `keep_alive`, `http_agent`, `max_open_connections`, …) are
|
|
71
|
+
* ignored.
|
|
72
|
+
*
|
|
73
|
+
* This is a deliberately narrow, internal experiment to unblock the chDB
|
|
74
|
+
* integration — NOT the start of a public pluggable-backend / plugin system.
|
|
75
|
+
* The {@link Connection} contract is intentionally not re-exported from the
|
|
76
|
+
* package entrypoint, so a backend must deep-import or structurally match its
|
|
77
|
+
* shape; that friction is by design and signals the API may change. Keeping
|
|
78
|
+
* the client's public surface slim avoids a second client family mirroring the
|
|
79
|
+
* whole public API.
|
|
80
|
+
*
|
|
81
|
+
* @experimental - unstable API; used only for integrating with chDB.
|
|
82
|
+
* @see https://github.com/chdb-io/chdb-node/pull/52
|
|
83
|
+
* @default undefined */
|
|
84
|
+
connection?: Connection<Stream.Readable>;
|
|
65
85
|
};
|
|
66
86
|
interface BasicTLSOptions {
|
|
67
87
|
ca_cert: Buffer;
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAOA,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAOA,0CAMwB;AAIxB,gDAAwB;AACxB,6CAAqE;AACrE,6CAAyC;AACzC,mCAA4C;AA8F5C,SAAS,iBAAiB,CACxB,KAAa,EACb,SAAiC;IAEjC,OAAO,IAAI,KAAK,CACd,WAAW,SAAS,uBAAuB,KAAK,KAAK;QACnD,mCAAmC,CACtC,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,gFAAgF;AAChF,8DAA8D;AAE9D;;;+EAG+E;AAC/E,SAAS,2BAA2B,CAAC,KAAwB;IAC3D,IAAI,KAAK,KA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,GAAG,UAAU,CAAC,GAAG;iBAClB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,GAAG,GAAG;oBACJ,IAAI,EAAE,OAAO;oBACb,GAAG,UAAU,CAAC,GAAG;iBAClB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,iEAAiE;QACjE,MAAM,UAAU,GAAG;YACjB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,IAAI,IAAI;YAChD,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,IAAI,IAAI;SACjE,CAAC;QACF,OAAO,kCAAqB,CAAC,MAAM,CAAC;YAClC,iBAAiB,EAAE,MAAM;YACzB,qBAAqB,EAAE,UAAU,CAAC,qBAAqB,IAAI,IAAI;YAC/D,4BAA4B,EAC1B,UAAU,CAAC,4BAA4B,IAAI,KAAK;YAClD,6BAA6B,EAC3B,UAAU,CAAC,UAAU,EAAE,6BAA6B,IAAI,KAAK;YAC/D,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,UAAU;YACV,GAAG;YACH,yBAAyB,EAAE,UAAU,CAAC,yBAAyB;SAChE,CAAC,CAAC;IACL,CAAC;IACD,cAAc,EAAE,CAAC,YAA0B,EAAE,EAAE,CAC7C,IAAI,yBAAiB,CAAC,YAAY,CAAC;IACrC,eAAe,EAAE,CAAC,CAChB,MAAuB,EACvB,MAAkB,EAClB,QAAgB,EAChB,SAA+B,EAC/B,gBAAiC,EACjC,YAA0B,EAC1B,IAAqB,EACrB,EAAE,CACF,sBAAS,CAAC,QAAQ,CAAC;QACjB,MAAM;QACN,MAAM;QACN,QAAQ;QACR,SAAS;QACT,gBAAgB;QAChB,YAAY;QACZ,IAAI;KACL,CAAC,CAAQ;CACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { type NodeClickHouseClientConfigOptions as ClickHouseClientConfigOptions
|
|
|
4
4
|
export { ResultSet, type StreamReadable } from "./result_set";
|
|
5
5
|
export { drainStream } from "./connection/stream";
|
|
6
6
|
/** Re-export common (formerly @clickhouse/client-common) types */
|
|
7
|
-
export { type BaseClickHouseClientConfigOptions, type BaseQueryParams, type QueryParams, type ExecParams, type InsertParams, type InsertValues, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type DataFormat, type RawDataFormat, type JSONDataFormat, type StreamableDataFormat, type StreamableJSONDataFormat, type SingleDocumentJSONFormat, type Logger, type LogParams, type ErrorLogParams, type WarnLogParams, type ClickHouseSettings, type MergeTreeSettings, type Row, type ResponseJSON, type InputJSON, type InputJSONObjectEachRow, type BaseResultSet, type PingResult, type ResponseHeaders, type SimpleColumnType, type ParsedColumnSimple, type ParsedColumnEnum, type ParsedColumnFixedString, type ParsedColumnNullable, type ParsedColumnDecimal, type ParsedColumnDateTime, type ParsedColumnDateTime64, type ParsedColumnArray, type ParsedColumnTuple, type ParsedColumnMap, type ParsedColumnType, type ProgressRow, type RowOrProgress, type ClickHouseAuth, type ClickHouseJWTAuth, type ClickHouseCredentialsAuth, type ClickHouseTracer, type ClickHouseSpan, type ClickHouseSpanOptions, type ClickHouseSpanAttributes, type ClickHouseSpanStatus, type ClickHouseSpanName, } from "./common/index";
|
|
7
|
+
export { type BaseClickHouseClientConfigOptions, type BaseQueryParams, type QueryParams, type ExecParams, type InsertParams, type InsertValues, type CommandParams, type CommandResult, type ExecResult, type InsertResult, type DataFormat, type RawDataFormat, type JSONDataFormat, type StreamableDataFormat, type StreamableJSONDataFormat, type SingleDocumentJSONFormat, type Logger, type LogParams, type ErrorLogParams, type WarnLogParams, type ClickHouseSettings, type ClickHouseSettingsInterface, type MergeTreeSettings, type Row, type ResponseJSON, type InputJSON, type InputJSONObjectEachRow, type BaseResultSet, type PingResult, type ResponseHeaders, type SimpleColumnType, type ParsedColumnSimple, type ParsedColumnEnum, type ParsedColumnFixedString, type ParsedColumnNullable, type ParsedColumnDecimal, type ParsedColumnDateTime, type ParsedColumnDateTime64, type ParsedColumnArray, type ParsedColumnTuple, type ParsedColumnMap, type ParsedColumnType, type ProgressRow, type RowOrProgress, type ClickHouseAuth, type ClickHouseJWTAuth, type ClickHouseCredentialsAuth, type ClickHouseTracer, type ClickHouseSpan, type ClickHouseSpanOptions, type ClickHouseSpanAttributes, type ClickHouseSpanStatus, type ClickHouseSpanName, } from "./common/index";
|
|
8
8
|
/**
|
|
9
9
|
* Re-export common (formerly @clickhouse/client-common) runtime values.
|
|
10
10
|
*
|
|
@@ -40,7 +40,9 @@ export declare const StreamableFormats: readonly ["JSONEachRow", "JSONStringsEac
|
|
|
40
40
|
export declare const StreamableJSONFormats: readonly ["JSONEachRow", "JSONStringsEachRow", "JSONCompactEachRow", "JSONCompactStringsEachRow", "JSONCompactEachRowWithNames", "JSONCompactEachRowWithNamesAndTypes", "JSONCompactStringsEachRowWithNames", "JSONCompactStringsEachRowWithNamesAndTypes", "JSONEachRowWithProgress"];
|
|
41
41
|
export declare const SingleDocumentJSONFormats: readonly ["JSON", "JSONStrings", "JSONCompact", "JSONCompactStrings", "JSONColumnsWithMetadata"];
|
|
42
42
|
export declare const RecordsJSONFormats: readonly ["JSONObjectEachRow"];
|
|
43
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
43
44
|
export declare const parseColumnType: typeof parseColumnType_;
|
|
45
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
44
46
|
export declare const SimpleColumnTypes: readonly ["Bool", "UInt8", "Int8", "UInt16", "Int16", "UInt32", "Int32", "UInt64", "Int64", "UInt128", "Int128", "UInt256", "Int256", "Float32", "Float64", "String", "UUID", "Date", "Date32", "IPv4", "IPv6"];
|
|
45
47
|
export declare const isProgressRow: typeof isProgressRow_;
|
|
46
48
|
export declare const isRow: typeof isRow_;
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,9 @@ exports.StreamableFormats = index_1.StreamableFormats;
|
|
|
28
28
|
exports.StreamableJSONFormats = index_1.StreamableJSONFormats;
|
|
29
29
|
exports.SingleDocumentJSONFormats = index_1.SingleDocumentJSONFormats;
|
|
30
30
|
exports.RecordsJSONFormats = index_1.RecordsJSONFormats;
|
|
31
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
31
32
|
exports.parseColumnType = index_1.parseColumnType;
|
|
33
|
+
/** @deprecated Superseded by the `@clickhouse/datatype-parser` package (`parseDataType` + its `Node` AST); slated for removal in a future major version. */
|
|
32
34
|
exports.SimpleColumnTypes = index_1.SimpleColumnTypes;
|
|
33
35
|
exports.isProgressRow = index_1.isProgressRow;
|
|
34
36
|
exports.isRow = index_1.isRow;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAGkB;AAFhB,0GAAA,oBAAoB,OAAoB;AAG1C,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAErB,2CAA8D;AAArD,uGAAA,SAAS,OAAA;AAClB,8CAAkD;AAAzC,qGAAA,WAAW,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAGkB;AAFhB,0GAAA,oBAAoB,OAAoB;AAG1C,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AAErB,2CAA8D;AAArD,uGAAA,SAAS,OAAA;AAClB,8CAAkD;AAAzC,qGAAA,WAAW,OAAA;AA2DpB;;;;;;;GAOG;AACH,0CAqBwB;AAEX,QAAA,eAAe,GAAG,uBAAgB,CAAC;AAEnC,QAAA,UAAU,GAAG,kBAAW,CAAC;AACzB,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AAEzC,QAAA,WAAW,GAAG,mBAAY,CAAC;AAE3B,QAAA,oBAAoB,GAAG,4BAAqB,CAAC;AAC7C,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,iBAAiB,GAAG,yBAAkB,CAAC;AACvC,QAAA,qBAAqB,GAAG,6BAAsB,CAAC;AAC/C,QAAA,yBAAyB,GAAG,iCAA0B,CAAC;AACvD,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AACtD,4JAA4J;AAC/I,QAAA,eAAe,GAAG,uBAAgB,CAAC;AAChD,4JAA4J;AAC/I,QAAA,iBAAiB,GAAG,yBAAkB,CAAC;AACvC,QAAA,aAAa,GAAG,qBAAc,CAAC;AAC/B,QAAA,KAAK,GAAG,aAAM,CAAC;AACf,QAAA,WAAW,GAAG,mBAAY,CAAC;AAC3B,QAAA,UAAU,GAAG,kBAAW,CAAC;AAEzB,QAAA,mBAAmB,GAAG,2BAAoB,CAAC;AAC3C,QAAA,wBAAwB,GAAG,gCAAyB,CAAC;AACrD,QAAA,kBAAkB,GAAG,0BAAmB,CAAC;AACzC,QAAA,mBAAmB,GAAG,2BAAoB,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.23.0-head.
|
|
1
|
+
declare const _default: "1.23.0-head.dbc2960.1";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@clickhouse/client",
|
|
3
3
|
"description": "Official JS client for ClickHouse DB - Node.js implementation",
|
|
4
4
|
"homepage": "https://clickhouse.com",
|
|
5
|
-
"version": "1.23.0-head.
|
|
5
|
+
"version": "1.23.0-head.dbc2960.1",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"clickhouse",
|
|
@@ -129,6 +129,13 @@ than shipping a generic, runtime-driven decoder, it emits straight-line code
|
|
|
129
129
|
that reads each column in order, so the parser only contains the logic the
|
|
130
130
|
specific result shape needs.
|
|
131
131
|
|
|
132
|
+
**Schema only known at runtime?** `compileRowBinaryWithNamesAndTypes(cursor)`
|
|
133
|
+
reads the `RowBinaryWithNamesAndTypes` header and folds each column type into a
|
|
134
|
+
reader on the fly (type strings parsed by `@clickhouse/datatype-parser`),
|
|
135
|
+
returning a `readRows` driver for the rest of the stream — a generic, no-codegen
|
|
136
|
+
path for dynamic schemas. The specialized codegen above stays the fast path when
|
|
137
|
+
the types are fixed.
|
|
138
|
+
|
|
132
139
|
## Correctness on the gotcha-heavy types
|
|
133
140
|
|
|
134
141
|
For a plain `UInt64, String, DateTime` result a strong model already writes fast,
|
|
@@ -84,6 +84,19 @@ bandwidth). Measured in `tests/iot.columnar.bench.ts`; rationale in
|
|
|
84
84
|
- **Hybrid:** store columnar, expose a lazy `rowAt(i)` accessor that builds an
|
|
85
85
|
object only for rows actually touched (see `iotRowAt` in `src/examples/iot.ts`).
|
|
86
86
|
|
|
87
|
+
## Fourth: are the column types known ahead of time?
|
|
88
|
+
|
|
89
|
+
- **Known (the default).** Generate a straight-line reader specialized to those
|
|
90
|
+
types — everything below.
|
|
91
|
+
- **Only at runtime** (the schema varies, or you just want to decode an arbitrary
|
|
92
|
+
`RowBinaryWithNamesAndTypes` stream). Call
|
|
93
|
+
`compileRowBinaryWithNamesAndTypes(cursor)` (`src/rowBinaryWithNamesAndTypes.ts`):
|
|
94
|
+
it reads the header, folds each column type's AST into a `Reader`
|
|
95
|
+
(`astToReader`, `src/compile.ts`; type strings parsed by
|
|
96
|
+
`@clickhouse/datatype-parser`), and returns a `readRows` driver for the rest of
|
|
97
|
+
the stream. Generic and unoptimized (no codegen), so prefer the specialized
|
|
98
|
+
path whenever the types are fixed.
|
|
99
|
+
|
|
87
100
|
## Core guidance
|
|
88
101
|
|
|
89
102
|
When generating a parser, follow these:
|
|
@@ -165,6 +178,9 @@ The readers live as real code under `src/`, split by type family.
|
|
|
165
178
|
| `JSON` | `src/json.ts` |
|
|
166
179
|
| The whole result — loop rows to EOF (`readRows`) | `src/rows.ts` |
|
|
167
180
|
| A chunked HTTP response — `streamRowBatches`, `coalesceChunks` | `src/stream.ts` |
|
|
181
|
+
| The `RowBinaryWithNamesAndTypes` header — column names + type strings (`readHeader`) | `src/header.ts` |
|
|
182
|
+
| Fold one parsed type AST into a `Reader` (`astToReader`) — AST in, reader out | `src/compile.ts` |
|
|
183
|
+
| **Types known only at runtime** — compile a whole header into a row reader (`compileRowBinaryWithNamesAndTypes`, `typeStringToReader`) | `src/rowBinaryWithNamesAndTypes.ts` |
|
|
168
184
|
| **Numeric/fixed-width result read column-wise** (aggregate/scan/plot, hand to a Worker/WASM) → decode into typed arrays, not row objects (~4x) | `src/columnar.ts` (`streamSensorColumns` — streaming, yields transferable typed-array batches); `decodeIotColumnar` in `src/examples/iot.ts` is the whole-buffer form |
|
|
169
185
|
| `LowCardinality(T)` — transparent, decode as `T` | `src/lowCardinality.ts` |
|
|
170
186
|
| `SimpleAggregateFunction(f, T)` — transparent, decode as `T` | `src/simpleAggregateFunction.ts` |
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fold: turn a parsed ClickHouse data-type AST (from
|
|
3
|
+
* `@clickhouse/datatype-parser`) into a RowBinary value {@link Reader}.
|
|
4
|
+
*
|
|
5
|
+
* AST in, reader out — nothing else. Reading the `RowBinaryWithNamesAndTypes`
|
|
6
|
+
* header, parsing type strings, and assembling a row reader live in
|
|
7
|
+
* `rowBinaryWithNamesAndTypes.ts`; this module is just the type-to-reader
|
|
8
|
+
* mapping.
|
|
9
|
+
*
|
|
10
|
+
* It composes the existing GENERIC curried combinators at runtime, exactly as a
|
|
11
|
+
* hand-written reader would — no code generation and no monomorphization (those
|
|
12
|
+
* are the deliberate next step; see the `MONOMORPHIZE` notes throughout the
|
|
13
|
+
* combinator modules). The shape mirrors {@link readDynamicType} in
|
|
14
|
+
* `dynamic.ts`, which performs the same "type → Reader" mapping but driven by
|
|
15
|
+
* ClickHouse's BINARY type encoding rather than the textual type's AST.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { NodeKind, type Node } from "@clickhouse/datatype-parser";
|
|
19
|
+
|
|
20
|
+
import type { Reader } from "./core.js";
|
|
21
|
+
import {
|
|
22
|
+
readInt8,
|
|
23
|
+
readInt16,
|
|
24
|
+
readInt32,
|
|
25
|
+
readInt64,
|
|
26
|
+
readInt128,
|
|
27
|
+
readInt256,
|
|
28
|
+
readUInt8,
|
|
29
|
+
readUInt16,
|
|
30
|
+
readUInt32,
|
|
31
|
+
readUInt64,
|
|
32
|
+
readUInt128,
|
|
33
|
+
readUInt256,
|
|
34
|
+
} from "./integers.js";
|
|
35
|
+
import { readFloat32, readFloat64, readBFloat16 } from "./floats.js";
|
|
36
|
+
import { readBool } from "./bool.js";
|
|
37
|
+
import { readString, readFixedString } from "./strings.js";
|
|
38
|
+
import { readUUID } from "./uuid.js";
|
|
39
|
+
import { readIPv4, readIPv6 } from "./ip.js";
|
|
40
|
+
import {
|
|
41
|
+
readDate,
|
|
42
|
+
readDate32,
|
|
43
|
+
readDateTime,
|
|
44
|
+
readDateTime64,
|
|
45
|
+
} from "./datetime.js";
|
|
46
|
+
import { readTime, readTime64 } from "./time.js";
|
|
47
|
+
import { readInterval } from "./interval.js";
|
|
48
|
+
import {
|
|
49
|
+
readDecimal32,
|
|
50
|
+
readDecimal64,
|
|
51
|
+
readDecimal128,
|
|
52
|
+
readDecimal256,
|
|
53
|
+
} from "./decimals.js";
|
|
54
|
+
import { readEnum8, readEnum16 } from "./enums.js";
|
|
55
|
+
import {
|
|
56
|
+
readArray,
|
|
57
|
+
readMap,
|
|
58
|
+
readNullable,
|
|
59
|
+
readTuple,
|
|
60
|
+
readTupleNamed,
|
|
61
|
+
readVariant,
|
|
62
|
+
readQBit,
|
|
63
|
+
} from "./composite.js";
|
|
64
|
+
import { readLowCardinality } from "./lowCardinality.js";
|
|
65
|
+
import { readNested } from "./nested.js";
|
|
66
|
+
import { readNothing } from "./nothing.js";
|
|
67
|
+
import {
|
|
68
|
+
readPoint,
|
|
69
|
+
readRing,
|
|
70
|
+
readLineString,
|
|
71
|
+
readPolygon,
|
|
72
|
+
readMultiLineString,
|
|
73
|
+
readMultiPolygon,
|
|
74
|
+
readGeometry,
|
|
75
|
+
} from "./geo.js";
|
|
76
|
+
import { readJSON } from "./json.js";
|
|
77
|
+
import { readDynamic } from "./dynamic.js";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Thrown when a ClickHouse type cannot be turned into a RowBinary reader —
|
|
81
|
+
* either the type string did not parse, or the parsed type is unsupported or
|
|
82
|
+
* malformed for RowBinary decoding (`AggregateFunction`, a missing argument, a
|
|
83
|
+
* malformed `Nested(...)`, …).
|
|
84
|
+
*
|
|
85
|
+
* A dedicated class so callers can `catch (e) { if (e instanceof
|
|
86
|
+
* RowBinaryTypeError) … }` and branch on a bad-type error specifically rather
|
|
87
|
+
* than string-matching a generic `Error`. Note the standalone
|
|
88
|
+
* `@clickhouse/datatype-parser` is itself NON-throwing (it returns a
|
|
89
|
+
* `ParseResult`); this is the error the compile layer raises on top of it.
|
|
90
|
+
*/
|
|
91
|
+
export class RowBinaryTypeError extends Error {
|
|
92
|
+
/** The full ClickHouse type string being compiled, when the throw site knows it. */
|
|
93
|
+
readonly typeString?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Byte offset into `typeString` where parsing stopped — set for PARSE
|
|
96
|
+
* failures (from the underlying parser), undefined for fold-time errors.
|
|
97
|
+
*/
|
|
98
|
+
readonly position?: number;
|
|
99
|
+
|
|
100
|
+
constructor(
|
|
101
|
+
message: string,
|
|
102
|
+
options: { typeString?: string; position?: number } = {},
|
|
103
|
+
) {
|
|
104
|
+
super(message);
|
|
105
|
+
this.name = "RowBinaryTypeError";
|
|
106
|
+
this.typeString = options.typeString;
|
|
107
|
+
this.position = options.position;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The fold itself: turn a parsed type-AST node into a value {@link Reader},
|
|
113
|
+
* recursing into element / key / field types for composites. The shape mirrors
|
|
114
|
+
* the server's `EXPLAIN AST` data-type subtree (see the parser's `ast.ts`).
|
|
115
|
+
*/
|
|
116
|
+
export function astToReader(node: Node): Reader<unknown> {
|
|
117
|
+
switch (node.kind) {
|
|
118
|
+
case NodeKind.EnumDataType:
|
|
119
|
+
// Explicit-value enum: the wire value is the underlying int; the
|
|
120
|
+
// name<->value map is metadata we don't need to decode.
|
|
121
|
+
return node.name === "Enum16" ? readEnum16 : readEnum8;
|
|
122
|
+
case NodeKind.TupleDataType:
|
|
123
|
+
return tupleReader(node);
|
|
124
|
+
case NodeKind.DataType:
|
|
125
|
+
return dataTypeReader(node);
|
|
126
|
+
default:
|
|
127
|
+
// Literal / Function / Identifier / NameTypePair are argument nodes,
|
|
128
|
+
// consumed by their parent — never a standalone column type.
|
|
129
|
+
throw new RowBinaryTypeError(
|
|
130
|
+
`cannot build a column reader for a ${node.kind} node (${node.name || "?"})`,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Fold a generic `DataType` node (`name` + optional `arguments`) — the bulk of
|
|
137
|
+
* the type system: scalars, the parameterized types, and the
|
|
138
|
+
* wrappers/composites that recurse through {@link astToReader}.
|
|
139
|
+
*/
|
|
140
|
+
function dataTypeReader(node: Node): Reader<unknown> {
|
|
141
|
+
switch (node.name) {
|
|
142
|
+
// --- wrappers & composites (recurse into argument types) ---
|
|
143
|
+
case "Nullable":
|
|
144
|
+
return readNullable(astToReader(requireArg(node, 0)));
|
|
145
|
+
case "LowCardinality":
|
|
146
|
+
// Transparent in RowBinary: just the inner type's reader.
|
|
147
|
+
return readLowCardinality(astToReader(requireArg(node, 0)));
|
|
148
|
+
case "Array":
|
|
149
|
+
return readArray(astToReader(requireArg(node, 0)));
|
|
150
|
+
case "QBit":
|
|
151
|
+
// QBit(element_type, dimension): wire-identical to Array(element_type);
|
|
152
|
+
// the dimension (arg 1) is metadata, not in the value stream.
|
|
153
|
+
return readQBit(astToReader(requireArg(node, 0)));
|
|
154
|
+
case "Map":
|
|
155
|
+
return readMap(
|
|
156
|
+
astToReader(requireArg(node, 0)),
|
|
157
|
+
astToReader(requireArg(node, 1)),
|
|
158
|
+
);
|
|
159
|
+
case "Variant":
|
|
160
|
+
return variantReader(node);
|
|
161
|
+
case "Nested":
|
|
162
|
+
return nestedReader(node);
|
|
163
|
+
|
|
164
|
+
// --- parameterized scalars ---
|
|
165
|
+
case "FixedString":
|
|
166
|
+
return readFixedString(literalInt(requireArg(node, 0)));
|
|
167
|
+
case "DateTime":
|
|
168
|
+
case "DateTime32":
|
|
169
|
+
// An optional timezone argument is metadata; the value wire is the same.
|
|
170
|
+
return readDateTime;
|
|
171
|
+
case "DateTime64":
|
|
172
|
+
// DateTime64(P [, 'tz']); default precision 3 if somehow omitted.
|
|
173
|
+
return readDateTime64(
|
|
174
|
+
node.arguments.length > 0 ? literalInt(node.arguments[0]!) : 3,
|
|
175
|
+
);
|
|
176
|
+
case "Time64":
|
|
177
|
+
return readTime64(literalInt(requireArg(node, 0)));
|
|
178
|
+
case "Decimal":
|
|
179
|
+
return decimalReader(node);
|
|
180
|
+
case "Decimal32":
|
|
181
|
+
return readDecimal32(literalInt(requireArg(node, 0)));
|
|
182
|
+
case "Decimal64":
|
|
183
|
+
return readDecimal64(literalInt(requireArg(node, 0)));
|
|
184
|
+
case "Decimal128":
|
|
185
|
+
return readDecimal128(literalInt(requireArg(node, 0)));
|
|
186
|
+
case "Decimal256":
|
|
187
|
+
return readDecimal256(literalInt(requireArg(node, 0)));
|
|
188
|
+
// Auto-assigned enums arrive as a plain DataType (no explicit values); the
|
|
189
|
+
// wire value is still the underlying int.
|
|
190
|
+
case "Enum8":
|
|
191
|
+
return readEnum8;
|
|
192
|
+
case "Enum16":
|
|
193
|
+
return readEnum16;
|
|
194
|
+
|
|
195
|
+
default: {
|
|
196
|
+
// Interval<Unit> (IntervalSecond, IntervalDay, …): all decode to the
|
|
197
|
+
// signed Int64 count; the unit lives in the type name, not the wire.
|
|
198
|
+
if (node.name.startsWith("Interval")) return readInterval;
|
|
199
|
+
const leaf = NULLARY[node.name];
|
|
200
|
+
if (leaf !== undefined) return leaf;
|
|
201
|
+
throw new RowBinaryTypeError(`unsupported RowBinary type: ${node.name}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Folds a `Tuple(...)` — named (object) when every element is named, else positional (array). */
|
|
207
|
+
function tupleReader(node: Node): Reader<unknown> {
|
|
208
|
+
const readers = node.arguments.map(astToReader);
|
|
209
|
+
const names = node.element_names;
|
|
210
|
+
const named =
|
|
211
|
+
names.length === readers.length && names.every((n) => n.length > 0);
|
|
212
|
+
if (named) {
|
|
213
|
+
const fields: Record<string, Reader<unknown>> = {};
|
|
214
|
+
for (let i = 0; i < names.length; i++) fields[names[i]!] = readers[i]!;
|
|
215
|
+
return readTupleNamed(fields);
|
|
216
|
+
}
|
|
217
|
+
return readTuple(readers);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Folds a `Variant(...)`. The 1-byte discriminant indexes the alternatives
|
|
222
|
+
* sorted by type NAME (ClickHouse's global ordering), and the server writes the
|
|
223
|
+
* type string with alternatives ALREADY in that sorted order — so for a
|
|
224
|
+
* header-sourced type the AST argument order is the discriminant order and we
|
|
225
|
+
* pass them straight through. (A hand-written, non-normalized `Variant(...)`
|
|
226
|
+
* string would need sorting first.)
|
|
227
|
+
*/
|
|
228
|
+
function variantReader(node: Node): Reader<unknown> {
|
|
229
|
+
return readVariant(node.arguments.map(astToReader));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Folds a `Nested(name Type, …)`: on the wire it IS `Array(Tuple(...))` with
|
|
234
|
+
* the field names, so we compose {@link readNested} (= `readArray(readTupleNamed)`)
|
|
235
|
+
* over the `NameTypePair` children.
|
|
236
|
+
*/
|
|
237
|
+
function nestedReader(node: Node): Reader<unknown> {
|
|
238
|
+
const fields: Record<string, Reader<unknown>> = {};
|
|
239
|
+
for (const child of node.arguments) {
|
|
240
|
+
if (child.kind !== NodeKind.NameTypePair || child.data_type === null) {
|
|
241
|
+
throw new RowBinaryTypeError(
|
|
242
|
+
"malformed Nested(...): expected name/type pairs",
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
fields[child.name] = astToReader(child.data_type);
|
|
246
|
+
}
|
|
247
|
+
return readNested(fields);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Folds `Decimal(P, S)` to the right width by precision P; scale S drives decoding. */
|
|
251
|
+
function decimalReader(node: Node): Reader<unknown> {
|
|
252
|
+
const precision = literalInt(requireArg(node, 0));
|
|
253
|
+
const scale = literalInt(requireArg(node, 1));
|
|
254
|
+
if (precision <= 9) return readDecimal32(scale);
|
|
255
|
+
if (precision <= 18) return readDecimal64(scale);
|
|
256
|
+
if (precision <= 38) return readDecimal128(scale);
|
|
257
|
+
return readDecimal256(scale);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** The nullary (no-argument) scalar types, mapped to their leaf readers. */
|
|
261
|
+
const NULLARY: Record<string, Reader<unknown>> = {
|
|
262
|
+
UInt8: readUInt8,
|
|
263
|
+
UInt16: readUInt16,
|
|
264
|
+
UInt32: readUInt32,
|
|
265
|
+
UInt64: readUInt64,
|
|
266
|
+
UInt128: readUInt128,
|
|
267
|
+
UInt256: readUInt256,
|
|
268
|
+
Int8: readInt8,
|
|
269
|
+
Int16: readInt16,
|
|
270
|
+
Int32: readInt32,
|
|
271
|
+
Int64: readInt64,
|
|
272
|
+
Int128: readInt128,
|
|
273
|
+
Int256: readInt256,
|
|
274
|
+
Float32: readFloat32,
|
|
275
|
+
Float64: readFloat64,
|
|
276
|
+
BFloat16: readBFloat16,
|
|
277
|
+
Bool: readBool,
|
|
278
|
+
String: readString,
|
|
279
|
+
UUID: readUUID,
|
|
280
|
+
IPv4: readIPv4,
|
|
281
|
+
IPv6: readIPv6,
|
|
282
|
+
Date: readDate,
|
|
283
|
+
Date32: readDate32,
|
|
284
|
+
Time: readTime,
|
|
285
|
+
Nothing: readNothing,
|
|
286
|
+
// Geo types.
|
|
287
|
+
Point: readPoint,
|
|
288
|
+
Ring: readRing,
|
|
289
|
+
LineString: readLineString,
|
|
290
|
+
Polygon: readPolygon,
|
|
291
|
+
MultiLineString: readMultiLineString,
|
|
292
|
+
MultiPolygon: readMultiPolygon,
|
|
293
|
+
Geometry: readGeometry as Reader<unknown>,
|
|
294
|
+
// Self-describing types: bare `JSON` / `Dynamic` (any args are metadata).
|
|
295
|
+
JSON: readJSON,
|
|
296
|
+
Dynamic: readDynamic,
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
/** Argument accessor that fails loudly instead of returning `undefined`. */
|
|
300
|
+
function requireArg(node: Node, index: number): Node {
|
|
301
|
+
const arg = node.arguments[index];
|
|
302
|
+
if (arg === undefined) {
|
|
303
|
+
throw new RowBinaryTypeError(
|
|
304
|
+
`type ${node.name} is missing argument ${index}`,
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
return arg;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Reads an integer out of a `Literal` argument node (e.g. the N in FixedString(N)). */
|
|
311
|
+
function literalInt(node: Node): number {
|
|
312
|
+
if (node.kind !== NodeKind.Literal) {
|
|
313
|
+
throw new RowBinaryTypeError(
|
|
314
|
+
`expected a literal argument, got a ${node.kind} node`,
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
return Number(node.value);
|
|
318
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `RowBinaryWithNamesAndTypes` HEADER: the column names and their type
|
|
3
|
+
* strings the server writes before the row data. Parsing the type strings into
|
|
4
|
+
* readers lives in `compile.ts`; this module is just the wire read.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Cursor } from "./core.js";
|
|
8
|
+
import { readUVarint } from "./varint.js";
|
|
9
|
+
import { readString } from "./strings.js";
|
|
10
|
+
|
|
11
|
+
/** Column names and their type strings, in stream order. */
|
|
12
|
+
export interface RowBinaryHeader {
|
|
13
|
+
names: string[];
|
|
14
|
+
types: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Read the `RowBinaryWithNamesAndTypes` header off the cursor: a LEB128 column
|
|
19
|
+
* count, then that many column-name `String`s, then that many type-string
|
|
20
|
+
* `String`s. Leaves the cursor at the first row's bytes.
|
|
21
|
+
*/
|
|
22
|
+
export function readHeader(state: Cursor): RowBinaryHeader {
|
|
23
|
+
const count = readUVarint(state);
|
|
24
|
+
const names: string[] = new Array(count);
|
|
25
|
+
for (let i = 0; i < count; i++) names[i] = readString(state);
|
|
26
|
+
const types: string[] = new Array(count);
|
|
27
|
+
for (let i = 0; i < count; i++) types[i] = readString(state);
|
|
28
|
+
return { names, types };
|
|
29
|
+
}
|
|
@@ -24,6 +24,20 @@
|
|
|
24
24
|
* lowCardinality (readLowCardinality), simpleAggregateFunction
|
|
25
25
|
* (readSimpleAggregateFunction), nested (readNested), nothing (readNothing),
|
|
26
26
|
* aggregateFunction (readAggregateFunction)
|
|
27
|
+
*
|
|
28
|
+
* Runtime schema path — compile a reader from the type STRINGS rather than
|
|
29
|
+
* hand-/code-generating one. Use this when the column types are not known until
|
|
30
|
+
* the response arrives (or you just want a generic decoder); for a fixed,
|
|
31
|
+
* known schema the specialized straight-line reader is faster.
|
|
32
|
+
* - header — readHeader: the RowBinaryWithNamesAndTypes preamble (column
|
|
33
|
+
* names + type strings) off the cursor
|
|
34
|
+
* - compile — astToReader: fold one parsed type AST (from
|
|
35
|
+
* `@clickhouse/datatype-parser`) into a value Reader. AST in,
|
|
36
|
+
* reader out — the type-to-combinator mapping, nothing else
|
|
37
|
+
* - rowBinaryWithNamesAndTypes — typeStringToReader (parse a type string +
|
|
38
|
+
* fold) and compileRowBinaryWithNamesAndTypes (read the header,
|
|
39
|
+
* compile every column, return a `readRows` driver for the rest of
|
|
40
|
+
* the stream): the end-to-end runtime entry point
|
|
27
41
|
*/
|
|
28
42
|
export * from "./core.js";
|
|
29
43
|
export * from "./varint.js";
|
|
@@ -49,3 +63,6 @@ export * from "./simpleAggregateFunction.js";
|
|
|
49
63
|
export * from "./nested.js";
|
|
50
64
|
export * from "./nothing.js";
|
|
51
65
|
export * from "./aggregateFunction.js";
|
|
66
|
+
export * from "./header.js";
|
|
67
|
+
export * from "./compile.js";
|
|
68
|
+
export * from "./rowBinaryWithNamesAndTypes.js";
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `RowBinaryWithNamesAndTypes` entry point: read the header off a cursor,
|
|
3
|
+
* compile each column's type string into a reader, and hand back a driver that
|
|
4
|
+
* decodes the rest of the stream.
|
|
5
|
+
*
|
|
6
|
+
* This ties together the pieces: {@link readHeader} (wire), the parser
|
|
7
|
+
* (`@clickhouse/datatype-parser`), and {@link astToReader} (the AST → reader
|
|
8
|
+
* fold in `compile.ts`), then assembles a named-tuple row reader over the
|
|
9
|
+
* columns and a {@link readRows} driver for the row data.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { parseDataType } from "@clickhouse/datatype-parser";
|
|
13
|
+
|
|
14
|
+
import type { Reader, Cursor } from "./core.js";
|
|
15
|
+
import { readHeader } from "./header.js";
|
|
16
|
+
import { readRows } from "./rows.js";
|
|
17
|
+
import { astToReader, RowBinaryTypeError } from "./compile.js";
|
|
18
|
+
|
|
19
|
+
/** One decoded row, keyed by column name. */
|
|
20
|
+
export type Row = Record<string, unknown>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The product of compiling a `RowBinaryWithNamesAndTypes` header: the column
|
|
24
|
+
* metadata, the per-column readers, and — the headline — `readRows`, the
|
|
25
|
+
* {@link Reader} that decodes every remaining row of the stream.
|
|
26
|
+
*/
|
|
27
|
+
export interface CompiledStream {
|
|
28
|
+
/** Column names, in stream order (from the header). */
|
|
29
|
+
names: string[];
|
|
30
|
+
/** Column type strings, in stream order (from the header). */
|
|
31
|
+
types: string[];
|
|
32
|
+
/** One folded reader per column, in stream order. */
|
|
33
|
+
columnReaders: Reader<unknown>[];
|
|
34
|
+
/** Reads exactly one row into a `{ [name]: value }` object. */
|
|
35
|
+
readRow: Reader<Row>;
|
|
36
|
+
/**
|
|
37
|
+
* Reads the REST of the stream (all rows after the header) into an array.
|
|
38
|
+
* Streaming-aware via {@link readRows}: on a partial trailing row it rewinds
|
|
39
|
+
* to the last complete row and returns what it has.
|
|
40
|
+
*/
|
|
41
|
+
readRows: Reader<Row[]>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Parse one ClickHouse type string and fold it into a {@link Reader}. Throws a
|
|
46
|
+
* {@link RowBinaryTypeError} if the parser rejects the string (e.g. the
|
|
47
|
+
* deliberately unsupported `AggregateFunction` / `SimpleAggregateFunction`) —
|
|
48
|
+
* carrying the `typeString` and the parse `position`.
|
|
49
|
+
*/
|
|
50
|
+
export function typeStringToReader(typeStr: string): Reader<unknown> {
|
|
51
|
+
const result = parseDataType(typeStr);
|
|
52
|
+
if (!result.ok()) {
|
|
53
|
+
const err = result.error!;
|
|
54
|
+
throw new RowBinaryTypeError(
|
|
55
|
+
`cannot compile type ${JSON.stringify(typeStr)}: ${err.message}`,
|
|
56
|
+
{ typeString: typeStr, position: err.position },
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return astToReader(result.ast!);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Resolves a ClickHouse type string to a reader — `typeStringToReader` or a cache wrapping it. */
|
|
63
|
+
export type TypeReaderResolver = (typeStr: string) => Reader<unknown>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Build an LRU-cached {@link typeStringToReader}. The full ClickHouse type
|
|
67
|
+
* STRING is a perfect cache key: two columns of the same type compile to the
|
|
68
|
+
* same reader, and a reader is stateless (it only ever touches the cursor it is
|
|
69
|
+
* handed), so one instance is safe to share across columns and across streams —
|
|
70
|
+
* a cache hit skips the parse + AST fold entirely.
|
|
71
|
+
*
|
|
72
|
+
* Worth it when you decode many `RowBinaryWithNamesAndTypes` responses whose
|
|
73
|
+
* schemas overlap (e.g. the same query run repeatedly): keep one cache and pass
|
|
74
|
+
* it to {@link compileRowBinaryWithNamesAndTypes}, so a recurring type is
|
|
75
|
+
* compiled once rather than once per response. A single response rarely repeats
|
|
76
|
+
* a type across its own columns, so the win is across calls, not within one.
|
|
77
|
+
*
|
|
78
|
+
* Classic Map-based LRU: a `Map` iterates in insertion order, so on a HIT we
|
|
79
|
+
* delete + re-set the entry to move it to the most-recently-used end, and on
|
|
80
|
+
* overflow we evict the oldest key (the first the `Map` yields). `maxSize` caps
|
|
81
|
+
* memory. A parse FAILURE is never cached — {@link typeStringToReader} throws
|
|
82
|
+
* before anything is stored — so fixing a bad type is not shadowed by a cached
|
|
83
|
+
* error.
|
|
84
|
+
*/
|
|
85
|
+
export function createTypeReaderCache(maxSize = 256): TypeReaderResolver {
|
|
86
|
+
const cache = new Map<string, Reader<unknown>>();
|
|
87
|
+
return (typeStr) => {
|
|
88
|
+
const cached = cache.get(typeStr);
|
|
89
|
+
if (cached !== undefined) {
|
|
90
|
+
// Touch on hit. A Map iterates in INSERTION order, not usage order — so on
|
|
91
|
+
// its own `keys().next()` would give the oldest-added key, not the
|
|
92
|
+
// least-recently-USED one. Deleting and re-inserting moves this key to the
|
|
93
|
+
// tail, which is what turns insertion order INTO recency order: every
|
|
94
|
+
// access (hit here, or miss below) lands the key at the tail, leaving the
|
|
95
|
+
// head as the genuine least-recently-used entry.
|
|
96
|
+
cache.delete(typeStr);
|
|
97
|
+
cache.set(typeStr, cached);
|
|
98
|
+
return cached;
|
|
99
|
+
}
|
|
100
|
+
const reader = typeStringToReader(typeStr); // may throw — then nothing is cached
|
|
101
|
+
cache.set(typeStr, reader);
|
|
102
|
+
if (cache.size > maxSize) {
|
|
103
|
+
// The head is the least-recently-used key (see touch-on-hit above), so it
|
|
104
|
+
// is the correct one to evict.
|
|
105
|
+
const lru = cache.keys().next().value;
|
|
106
|
+
if (lru !== undefined) cache.delete(lru);
|
|
107
|
+
}
|
|
108
|
+
return reader;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The headline entry point. Reads the `RowBinaryWithNamesAndTypes` header off
|
|
114
|
+
* `state`, compiles each column type into a combinator reader, and returns the
|
|
115
|
+
* column metadata plus the readers — including `readRows`, the reader for the
|
|
116
|
+
* REST of the stream. After this call the cursor sits at the first row, so:
|
|
117
|
+
*
|
|
118
|
+
* const s = new Cursor(buf);
|
|
119
|
+
* const { names, readRows } = compileRowBinaryWithNamesAndTypes(s);
|
|
120
|
+
* const rows = readRows(s); // decode every remaining row
|
|
121
|
+
*
|
|
122
|
+
* Pass `resolveType` to reuse readers across calls — e.g. a shared
|
|
123
|
+
* {@link createTypeReaderCache}. It defaults to {@link typeStringToReader}
|
|
124
|
+
* (compile every column afresh).
|
|
125
|
+
*/
|
|
126
|
+
export function compileRowBinaryWithNamesAndTypes(
|
|
127
|
+
state: Cursor,
|
|
128
|
+
resolveType: TypeReaderResolver = typeStringToReader,
|
|
129
|
+
): CompiledStream {
|
|
130
|
+
const { names, types } = readHeader(state);
|
|
131
|
+
const columnReaders = types.map((t) => resolveType(t));
|
|
132
|
+
|
|
133
|
+
// Build the row reader POSITIONALLY — by column index, NOT by keying the
|
|
134
|
+
// readers on column name and handing them to `readTupleNamed`. The header is
|
|
135
|
+
// an ordered list and RowBinary has no row delimiter, so every row MUST read
|
|
136
|
+
// exactly these readers, in exactly this order. Keying readers by name first
|
|
137
|
+
// would corrupt the stream on legal-but-awkward headers:
|
|
138
|
+
// - duplicate column names (e.g. two `SELECT 1 AS x, 2 AS x`) collapse to a
|
|
139
|
+
// single entry in a `Record`, so fewer readers run than there are columns;
|
|
140
|
+
// - integer-like names (`0`, `1`, …) are reordered ahead of string keys by
|
|
141
|
+
// `Object.keys()`, so the readers would run out of header order.
|
|
142
|
+
// Either desyncs the cursor and misreads every subsequent row. Reading by
|
|
143
|
+
// index sidesteps both. The row OBJECT is still keyed by name; on a duplicate
|
|
144
|
+
// name the last column with that name wins in the object, but every column is
|
|
145
|
+
// still consumed off the wire in order, so the cursor stays in sync.
|
|
146
|
+
const readRow: Reader<Row> = (s) => {
|
|
147
|
+
const row: Row = {};
|
|
148
|
+
for (let i = 0; i < columnReaders.length; i++) {
|
|
149
|
+
row[names[i]!] = columnReaders[i]!(s);
|
|
150
|
+
}
|
|
151
|
+
return row;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return { names, types, columnReaders, readRow, readRows: readRows(readRow) };
|
|
155
|
+
}
|