Skip to content

Commit 06f64cf

Browse files
authored
feat(cubestore): Support passing parameters in protocol (cache/queue) (#6225)
1 parent 311a6a8 commit 06f64cf

29 files changed

Lines changed: 2165 additions & 149 deletions

.github/workflows/rust-cubestore-master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ jobs:
213213
if: ${{ startsWith(matrix.os, 'windows') }}
214214
run: choco install -y --force llvm --version 18.1.6
215215
- name: Set Env Variables for Windows
216-
uses: allenevans/set-env@v3.0.0
216+
uses: allenevans/set-env@v4.0.0
217217
if: ${{ startsWith(matrix.os, 'windows') }}
218218
with:
219219
OPENSSL_DIR: 'C:/vcpkg/packages/openssl_x64-windows'

.github/workflows/rust-cubestore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
if: ${{ startsWith(matrix.os, 'windows') }}
153153
run: choco install -y --force llvm --version 18.1.6
154154
- name: Set Env Variables for Windows
155-
uses: allenevans/set-env@v3.0.0
155+
uses: allenevans/set-env@v4.0.0
156156
if: ${{ startsWith(matrix.os, 'windows') }}
157157
with:
158158
OPENSSL_DIR: 'C:/vcpkg/packages/openssl_x64-windows'

packages/cubejs-backend-shared/src/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,9 @@ const variables: Record<string, (...args: any) => any> = {
20112011
livePreview: () => get('CUBEJS_LIVE_PREVIEW')
20122012
.default('true')
20132013
.asBoolStrict(),
2014+
cubestoreSendableParameters: () => get('CUBEJS_CUBESTORE_SENDABLE_PARAMETERS')
2015+
.default('false')
2016+
.asBoolStrict(),
20142017
externalDefault: () => get('CUBEJS_EXTERNAL_DEFAULT')
20152018
.default('true')
20162019
.asBoolStrict(),
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// automatically generated by the FlatBuffers compiler, do not modify
2+
3+
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4+
5+
import * as flatbuffers from 'flatbuffers';
6+
7+
export class BinaryValue {
8+
bb: flatbuffers.ByteBuffer|null = null;
9+
bb_pos = 0;
10+
__init(i:number, bb:flatbuffers.ByteBuffer):BinaryValue {
11+
this.bb_pos = i;
12+
this.bb = bb;
13+
return this;
14+
}
15+
16+
static getRootAsBinaryValue(bb:flatbuffers.ByteBuffer, obj?:BinaryValue):BinaryValue {
17+
return (obj || new BinaryValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18+
}
19+
20+
static getSizePrefixedRootAsBinaryValue(bb:flatbuffers.ByteBuffer, obj?:BinaryValue):BinaryValue {
21+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22+
return (obj || new BinaryValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23+
}
24+
25+
v(index: number):number|null {
26+
const offset = this.bb!.__offset(this.bb_pos, 4);
27+
return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
28+
}
29+
30+
vLength():number {
31+
const offset = this.bb!.__offset(this.bb_pos, 4);
32+
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
33+
}
34+
35+
vArray():Uint8Array|null {
36+
const offset = this.bb!.__offset(this.bb_pos, 4);
37+
return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
38+
}
39+
40+
static startBinaryValue(builder:flatbuffers.Builder) {
41+
builder.startObject(1);
42+
}
43+
44+
static addV(builder:flatbuffers.Builder, vOffset:flatbuffers.Offset) {
45+
builder.addFieldOffset(0, vOffset, 0);
46+
}
47+
48+
static createVVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
49+
builder.startVector(1, data.length, 1);
50+
for (let i = data.length - 1; i >= 0; i--) {
51+
builder.addInt8(data[i]!);
52+
}
53+
return builder.endVector();
54+
}
55+
56+
static startVVector(builder:flatbuffers.Builder, numElems:number) {
57+
builder.startVector(1, numElems, 1);
58+
}
59+
60+
static endBinaryValue(builder:flatbuffers.Builder):flatbuffers.Offset {
61+
const offset = builder.endObject();
62+
builder.requiredField(offset, 4) // v
63+
return offset;
64+
}
65+
66+
static createBinaryValue(builder:flatbuffers.Builder, vOffset:flatbuffers.Offset):flatbuffers.Offset {
67+
BinaryValue.startBinaryValue(builder);
68+
BinaryValue.addV(builder, vOffset);
69+
return BinaryValue.endBinaryValue(builder);
70+
}
71+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// automatically generated by the FlatBuffers compiler, do not modify
2+
3+
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4+
5+
import * as flatbuffers from 'flatbuffers';
6+
7+
export class BoolValue {
8+
bb: flatbuffers.ByteBuffer|null = null;
9+
bb_pos = 0;
10+
__init(i:number, bb:flatbuffers.ByteBuffer):BoolValue {
11+
this.bb_pos = i;
12+
this.bb = bb;
13+
return this;
14+
}
15+
16+
static getRootAsBoolValue(bb:flatbuffers.ByteBuffer, obj?:BoolValue):BoolValue {
17+
return (obj || new BoolValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18+
}
19+
20+
static getSizePrefixedRootAsBoolValue(bb:flatbuffers.ByteBuffer, obj?:BoolValue):BoolValue {
21+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22+
return (obj || new BoolValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23+
}
24+
25+
v():boolean {
26+
const offset = this.bb!.__offset(this.bb_pos, 4);
27+
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
28+
}
29+
30+
static startBoolValue(builder:flatbuffers.Builder) {
31+
builder.startObject(1);
32+
}
33+
34+
static addV(builder:flatbuffers.Builder, v:boolean) {
35+
builder.addFieldInt8(0, +v, +false);
36+
}
37+
38+
static endBoolValue(builder:flatbuffers.Builder):flatbuffers.Offset {
39+
const offset = builder.endObject();
40+
return offset;
41+
}
42+
43+
static createBoolValue(builder:flatbuffers.Builder, v:boolean):flatbuffers.Offset {
44+
BoolValue.startBoolValue(builder);
45+
BoolValue.addV(builder, v);
46+
return BoolValue.endBoolValue(builder);
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// automatically generated by the FlatBuffers compiler, do not modify
2+
3+
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4+
5+
import * as flatbuffers from 'flatbuffers';
6+
7+
export class Float64Value {
8+
bb: flatbuffers.ByteBuffer|null = null;
9+
bb_pos = 0;
10+
__init(i:number, bb:flatbuffers.ByteBuffer):Float64Value {
11+
this.bb_pos = i;
12+
this.bb = bb;
13+
return this;
14+
}
15+
16+
static getRootAsFloat64Value(bb:flatbuffers.ByteBuffer, obj?:Float64Value):Float64Value {
17+
return (obj || new Float64Value()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
18+
}
19+
20+
static getSizePrefixedRootAsFloat64Value(bb:flatbuffers.ByteBuffer, obj?:Float64Value):Float64Value {
21+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
22+
return (obj || new Float64Value()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
23+
}
24+
25+
v():number {
26+
const offset = this.bb!.__offset(this.bb_pos, 4);
27+
return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
28+
}
29+
30+
static startFloat64Value(builder:flatbuffers.Builder) {
31+
builder.startObject(1);
32+
}
33+
34+
static addV(builder:flatbuffers.Builder, v:number) {
35+
builder.addFieldFloat64(0, v, 0.0);
36+
}
37+
38+
static endFloat64Value(builder:flatbuffers.Builder):flatbuffers.Offset {
39+
const offset = builder.endObject();
40+
return offset;
41+
}
42+
43+
static createFloat64Value(builder:flatbuffers.Builder, v:number):flatbuffers.Offset {
44+
Float64Value.startFloat64Value(builder);
45+
Float64Value.addV(builder, v);
46+
return Float64Value.endFloat64Value(builder);
47+
}
48+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// automatically generated by the FlatBuffers compiler, do not modify
2+
3+
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4+
5+
import { BinaryValue } from './binary-value.js';
6+
import { BoolValue } from './bool-value.js';
7+
import { Float64Value } from './float64-value.js';
8+
import { Int64Value } from './int64-value.js';
9+
import { NullValue } from './null-value.js';
10+
import { StringValue } from './string-value.js';
11+
12+
13+
export enum HttpParameterValue {
14+
NONE = 0,
15+
Int64Value = 1,
16+
BoolValue = 2,
17+
StringValue = 3,
18+
BinaryValue = 4,
19+
Float64Value = 5,
20+
NullValue = 6
21+
}
22+
23+
export function unionToHttpParameterValue(
24+
type: HttpParameterValue,
25+
accessor: (obj:BinaryValue|BoolValue|Float64Value|Int64Value|NullValue|StringValue) => BinaryValue|BoolValue|Float64Value|Int64Value|NullValue|StringValue|null
26+
): BinaryValue|BoolValue|Float64Value|Int64Value|NullValue|StringValue|null {
27+
switch(HttpParameterValue[type]) {
28+
case 'NONE': return null;
29+
case 'Int64Value': return accessor(new Int64Value())! as Int64Value;
30+
case 'BoolValue': return accessor(new BoolValue())! as BoolValue;
31+
case 'StringValue': return accessor(new StringValue())! as StringValue;
32+
case 'BinaryValue': return accessor(new BinaryValue())! as BinaryValue;
33+
case 'Float64Value': return accessor(new Float64Value())! as Float64Value;
34+
case 'NullValue': return accessor(new NullValue())! as NullValue;
35+
default: return null;
36+
}
37+
}
38+
39+
export function unionListToHttpParameterValue(
40+
type: HttpParameterValue,
41+
accessor: (index: number, obj:BinaryValue|BoolValue|Float64Value|Int64Value|NullValue|StringValue) => BinaryValue|BoolValue|Float64Value|Int64Value|NullValue|StringValue|null,
42+
index: number
43+
): BinaryValue|BoolValue|Float64Value|Int64Value|NullValue|StringValue|null {
44+
switch(HttpParameterValue[type]) {
45+
case 'NONE': return null;
46+
case 'Int64Value': return accessor(index, new Int64Value())! as Int64Value;
47+
case 'BoolValue': return accessor(index, new BoolValue())! as BoolValue;
48+
case 'StringValue': return accessor(index, new StringValue())! as StringValue;
49+
case 'BinaryValue': return accessor(index, new BinaryValue())! as BinaryValue;
50+
case 'Float64Value': return accessor(index, new Float64Value())! as Float64Value;
51+
case 'NullValue': return accessor(index, new NullValue())! as NullValue;
52+
default: return null;
53+
}
54+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// automatically generated by the FlatBuffers compiler, do not modify
2+
3+
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4+
5+
import * as flatbuffers from 'flatbuffers';
6+
7+
import { HttpParameterValue, unionToHttpParameterValue, unionListToHttpParameterValue } from './http-parameter-value.js';
8+
9+
10+
export class HttpParameter {
11+
bb: flatbuffers.ByteBuffer|null = null;
12+
bb_pos = 0;
13+
__init(i:number, bb:flatbuffers.ByteBuffer):HttpParameter {
14+
this.bb_pos = i;
15+
this.bb = bb;
16+
return this;
17+
}
18+
19+
static getRootAsHttpParameter(bb:flatbuffers.ByteBuffer, obj?:HttpParameter):HttpParameter {
20+
return (obj || new HttpParameter()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21+
}
22+
23+
static getSizePrefixedRootAsHttpParameter(bb:flatbuffers.ByteBuffer, obj?:HttpParameter):HttpParameter {
24+
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25+
return (obj || new HttpParameter()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26+
}
27+
28+
valueType():HttpParameterValue {
29+
const offset = this.bb!.__offset(this.bb_pos, 4);
30+
return offset ? this.bb!.readUint8(this.bb_pos + offset) : HttpParameterValue.NONE;
31+
}
32+
33+
value<T extends flatbuffers.Table>(obj:any):any|null {
34+
const offset = this.bb!.__offset(this.bb_pos, 6);
35+
return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
36+
}
37+
38+
static startHttpParameter(builder:flatbuffers.Builder) {
39+
builder.startObject(2);
40+
}
41+
42+
static addValueType(builder:flatbuffers.Builder, valueType:HttpParameterValue) {
43+
builder.addFieldInt8(0, valueType, HttpParameterValue.NONE);
44+
}
45+
46+
static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) {
47+
builder.addFieldOffset(1, valueOffset, 0);
48+
}
49+
50+
static endHttpParameter(builder:flatbuffers.Builder):flatbuffers.Offset {
51+
const offset = builder.endObject();
52+
builder.requiredField(offset, 6) // value
53+
return offset;
54+
}
55+
56+
static createHttpParameter(builder:flatbuffers.Builder, valueType:HttpParameterValue, valueOffset:flatbuffers.Offset):flatbuffers.Offset {
57+
HttpParameter.startHttpParameter(builder);
58+
HttpParameter.addValueType(builder, valueType);
59+
HttpParameter.addValue(builder, valueOffset);
60+
return HttpParameter.endHttpParameter(builder);
61+
}
62+
}

packages/cubejs-cubestore-driver/codegen/http-query.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import * as flatbuffers from 'flatbuffers';
66

7+
import { HttpParameter } from './http-parameter.js';
78
import { HttpTable } from './http-table.js';
89

910

@@ -49,8 +50,18 @@ inlineTablesLength():number {
4950
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
5051
}
5152

53+
parameters(index: number, obj?:HttpParameter):HttpParameter|null {
54+
const offset = this.bb!.__offset(this.bb_pos, 10);
55+
return offset ? (obj || new HttpParameter()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
56+
}
57+
58+
parametersLength():number {
59+
const offset = this.bb!.__offset(this.bb_pos, 10);
60+
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
61+
}
62+
5263
static startHttpQuery(builder:flatbuffers.Builder) {
53-
builder.startObject(3);
64+
builder.startObject(4);
5465
}
5566

5667
static addQuery(builder:flatbuffers.Builder, queryOffset:flatbuffers.Offset) {
@@ -77,16 +88,33 @@ static startInlineTablesVector(builder:flatbuffers.Builder, numElems:number) {
7788
builder.startVector(4, numElems, 4);
7889
}
7990

91+
static addParameters(builder:flatbuffers.Builder, parametersOffset:flatbuffers.Offset) {
92+
builder.addFieldOffset(3, parametersOffset, 0);
93+
}
94+
95+
static createParametersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
96+
builder.startVector(4, data.length, 4);
97+
for (let i = data.length - 1; i >= 0; i--) {
98+
builder.addOffset(data[i]!);
99+
}
100+
return builder.endVector();
101+
}
102+
103+
static startParametersVector(builder:flatbuffers.Builder, numElems:number) {
104+
builder.startVector(4, numElems, 4);
105+
}
106+
80107
static endHttpQuery(builder:flatbuffers.Builder):flatbuffers.Offset {
81108
const offset = builder.endObject();
82109
return offset;
83110
}
84111

85-
static createHttpQuery(builder:flatbuffers.Builder, queryOffset:flatbuffers.Offset, traceObjOffset:flatbuffers.Offset, inlineTablesOffset:flatbuffers.Offset):flatbuffers.Offset {
112+
static createHttpQuery(builder:flatbuffers.Builder, queryOffset:flatbuffers.Offset, traceObjOffset:flatbuffers.Offset, inlineTablesOffset:flatbuffers.Offset, parametersOffset:flatbuffers.Offset):flatbuffers.Offset {
86113
HttpQuery.startHttpQuery(builder);
87114
HttpQuery.addQuery(builder, queryOffset);
88115
HttpQuery.addTraceObj(builder, traceObjOffset);
89116
HttpQuery.addInlineTables(builder, inlineTablesOffset);
117+
HttpQuery.addParameters(builder, parametersOffset);
90118
return HttpQuery.endHttpQuery(builder);
91119
}
92120
}

packages/cubejs-cubestore-driver/codegen/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22

33
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
44

5+
export { BinaryValue } from './binary-value.js';
6+
export { BoolValue } from './bool-value.js';
7+
export { Float64Value } from './float64-value.js';
58
export { HttpColumnValue } from './http-column-value.js';
69
export { HttpCommand } from './http-command.js';
710
export { HttpError } from './http-error.js';
811
export { HttpMessage } from './http-message.js';
12+
export { HttpParameter } from './http-parameter.js';
13+
export { HttpParameterValue } from './http-parameter-value.js';
914
export { HttpQuery } from './http-query.js';
1015
export { HttpResultSet } from './http-result-set.js';
1116
export { HttpRow } from './http-row.js';
1217
export { HttpTable } from './http-table.js';
18+
export { Int64Value } from './int64-value.js';
19+
export { NullValue } from './null-value.js';
20+
export { StringValue } from './string-value.js';

0 commit comments

Comments
 (0)