Skip to content

[pull] master from cube-js:master #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/cubejs-backend-native/src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::node_obj_deserializer::JsValueDeserializer;
use crate::transport::MapCubeErrExt;
use cubeorchestrator::query_message_parser::QueryResult;
use cubeorchestrator::query_result_transform::{
DBResponsePrimitive, RequestResultData, RequestResultDataMulti, TransformedData,
DBResponsePrimitive, DBResponseValue, RequestResultData, RequestResultDataMulti,
TransformedData,
};
use cubeorchestrator::transport::{JsRawData, TransformDataRequest};
use cubesql::compile::engine::df::scan::{FieldValue, ValueObject};
Expand Down Expand Up @@ -258,7 +259,12 @@ pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult<JsValue> {
let js_row = JsObject::new(&mut cx);
for (key, value) in result.columns.iter().zip(row.iter()) {
let js_key = cx.string(key);
let js_value = cx.string(value.to_string());
let js_value: Handle<'_, JsValue> = match value {
DBResponseValue::Primitive(DBResponsePrimitive::Null) => cx.null().upcast(),
// For compatibility, we convert all primitives to strings
other => cx.string(other.to_string()).upcast(),
};

js_row.set(&mut cx, js_key, js_value)?;
}
Ok(js_row)
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-cubestore-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@types/csv-write-stream": "^2.0.0",
"@types/generic-pool": "^3.8.2",
"@types/jest": "^29",
"@types/node": "^20",
"@types/ws": "^7.4.0",
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-databricks-jdbc-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
},
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@types/generic-pool": "^3.8.2",
"@types/jest": "^29",
"@types/node": "^20",
"@types/ramda": "^0.27.34",
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-dbt-schema-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@cubejs-backend/testing": "1.3.39",
"@types/generic-pool": "^3.8.2",
"@types/jest": "^29",
"jest": "^29",
"stream-to-array": "^2.3.0",
Expand Down
1 change: 0 additions & 1 deletion packages/cubejs-druid-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
},
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@types/generic-pool": "^3.8.2",
"@types/jest": "^29",
"@types/node": "^20",
"jest": "^29",
Expand Down
3 changes: 1 addition & 2 deletions packages/cubejs-jdbc-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@cubejs-backend/base-driver": "1.3.39",
"@cubejs-backend/node-java-maven": "^0.1.3",
"@cubejs-backend/shared": "1.3.39",
"generic-pool": "^3.8.2",
"generic-pool": "^3.9.0",
"sqlstring": "^2.3.0"
},
"optionalDependencies": {
Expand All @@ -44,7 +44,6 @@
},
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@types/generic-pool": "^3.8.2",
"@types/node": "^20",
"@types/sqlstring": "^2.3.0",
"typescript": "~5.2.2"
Expand Down
3 changes: 1 addition & 2 deletions packages/cubejs-mongobi-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@cubejs-backend/base-driver": "1.3.39",
"@cubejs-backend/shared": "1.3.39",
"@types/node": "^20",
"generic-pool": "^3.8.2",
"generic-pool": "^3.9.0",
"moment": "^2.29.1",
"mysql2": "^3.11.5"
},
Expand All @@ -40,7 +40,6 @@
},
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@types/generic-pool": "^3.8.2",
"testcontainers": "^10.28.0",
"typescript": "~5.2.2"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/cubejs-mysql-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
"dependencies": {
"@cubejs-backend/base-driver": "1.3.39",
"@cubejs-backend/shared": "1.3.39",
"generic-pool": "^3.8.2",
"generic-pool": "^3.9.0",
"mysql": "^2.18.1"
},
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@cubejs-backend/testing-shared": "1.3.39",
"@types/generic-pool": "^3.8.2",
"@types/jest": "^29",
"@types/mysql": "^2.15.21",
"jest": "^29",
Expand Down
2 changes: 0 additions & 2 deletions packages/cubejs-query-orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@
"@cubejs-backend/cubestore-driver": "1.3.39",
"@cubejs-backend/shared": "1.3.39",
"csv-write-stream": "^2.0.0",
"generic-pool": "^3.8.2",
"lru-cache": "^11.1.0",
"ramda": "^0.27.2"
},
"devDependencies": {
"@cubejs-backend/linter": "1.3.39",
"@types/generic-pool": "^3.8.2",
"@types/jest": "^29",
"@types/node": "^20",
"@types/ramda": "^0.27.32",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import R from 'ramda';
import { getEnv } from '@cubejs-backend/shared';
import { CubeStoreDriver } from '@cubejs-backend/cubestore-driver';

import { QueryCache, QueryBody, TempTable } from './QueryCache';
import { QueryCache, QueryBody, TempTable, PreAggTableToTempTable } from './QueryCache';
import { PreAggregations, PreAggregationDescription, getLastUpdatedAtTimestamp } from './PreAggregations';
import { DriverFactory, DriverFactoryByDataSource } from './DriverFactory';
import { LocalQueueEventsBus } from './LocalQueueEventsBus';
Expand Down Expand Up @@ -224,28 +224,18 @@ export class QueryOrchestrator {
};
}

const usedPreAggregations = R.pipe(
const usedPreAggregations = R.pipe<
PreAggTableToTempTable[],
Record<string, TempTable>,
Record<string, unknown>
>(
R.fromPairs,
R.map((pa: TempTable) => ({
R.mapObjIndexed((pa: TempTable) => ({
targetTableName: pa.targetTableName,
refreshKeyValues: pa.refreshKeyValues,
lastUpdatedAt: pa.lastUpdatedAt,
})),
)(
preAggregationsTablesToTempTables as unknown as [
number, // TODO: we actually have a string here
{
buildRangeEnd: string,
lastUpdatedAt: number,
queryKey: unknown,
refreshKeyValues: [{
'refresh_key': string,
}][],
targetTableName: string,
type: string,
},
][]
);
)(preAggregationsTablesToTempTables);

if (this.rollupOnlyMode && Object.keys(usedPreAggregations).length === 0) {
throw new Error(
Expand Down
1 change: 1 addition & 0 deletions packages/cubejs-schema-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"@types/inflection": "^1.5.28",
"@types/jest": "^29",
"@types/node": "^20",
"@types/node-dijkstra": "^2.5.6",
"@types/ramda": "^0.27.34",
"@types/sqlstring": "^2.3.0",
"@types/syntax-error": "^1.4.1",
Expand Down
8 changes: 7 additions & 1 deletion packages/cubejs-schema-compiler/src/adapter/BaseDimension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ export class BaseDimension {
if (this.expression) {
return `expr:${this.expressionName}`;
}
return this.query.cubeEvaluator.pathFromArray(this.path() as string[]);

const path = this.path();
if (path === null) {
// Sanity check, this should not actually happen because we checked this.expression earlier
throw new Error('Unexpected null path');
}
return this.query.cubeEvaluator.pathFromArray(path);
}
}
4 changes: 2 additions & 2 deletions packages/cubejs-schema-compiler/src/adapter/BaseFilter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import inlection from 'inflection';
import moment from 'moment-timezone';
import { contains, join, map } from 'ramda';
import { includes, join, map } from 'ramda';
import { FROM_PARTITION_RANGE, TO_PARTITION_RANGE } from '@cubejs-backend/shared';

import { BaseDimension } from './BaseDimension';
Expand Down Expand Up @@ -134,7 +134,7 @@ export class BaseFilter extends BaseDimension {
}

public isDateOperator(): boolean {
return contains(this.camelizeOperator, DATE_OPERATORS);
return includes(this.camelizeOperator, DATE_OPERATORS);
}

public valuesArray() {
Expand Down
28 changes: 17 additions & 11 deletions packages/cubejs-schema-compiler/src/adapter/BaseMeasure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,32 +206,32 @@ export class BaseMeasure {
return this.measureDefinition();
}

public aliasName() {
public aliasName(): string {
return this.query.escapeColumnName(this.unescapedAliasName());
}

public unescapedAliasName() {
public unescapedAliasName(): string {
if (this.expression) {
return this.query.aliasName(this.expressionName);
}
return this.query.aliasName(this.measure);
}

public isCumulative() {
public isCumulative(): boolean {
if (this.expression) { // TODO
return false;
}
return BaseMeasure.isCumulative(this.measureDefinition());
}

public isMultiStage() {
public isMultiStage(): boolean {
if (this.expression) { // TODO
return false;
}
return this.definition().multiStage;
}

public isAdditive() {
public isAdditive(): boolean {
if (this.expression) { // TODO
return false;
}
Expand All @@ -243,7 +243,7 @@ export class BaseMeasure {
definition.type === 'min' || definition.type === 'max';
}

public static isCumulative(definition) {
public static isCumulative(definition): boolean {
return definition.type === 'runningTotal' || !!definition.rollingWindow;
}

Expand Down Expand Up @@ -294,7 +294,7 @@ export class BaseMeasure {
return this.query.minGranularity(granularityA, granularityB);
}

public granularityFromInterval(interval: string) {
public granularityFromInterval(interval: string): string | undefined {
if (!interval) {
return undefined;
}
Expand All @@ -312,25 +312,31 @@ export class BaseMeasure {
return undefined;
}

public shouldUngroupForCumulative() {
public shouldUngroupForCumulative(): boolean {
return this.measureDefinition().rollingWindow && !this.isAdditive();
}

public sqlDefinition() {
return this.measureDefinition().sql;
}

public path() {
public path(): string[] | null {
if (this.expression) {
return null;
}
return this.query.cubeEvaluator.parsePath('measures', this.measure);
}

public expressionPath() {
public expressionPath(): string {
if (this.expression) {
return `expr:${this.expression.expressionName}`;
}
return this.query.cubeEvaluator.pathFromArray(this.path() as string[]);

const path = this.path();
if (path === null) {
// Sanity check, this should not actually happen because we checked this.expression earlier
throw new Error('Unexpected null path');
}
return this.query.cubeEvaluator.pathFromArray(path);
}
}
Loading
Loading