cube-js / cube-js/cube

The database is an int type, and /load api returns integers as decimals

Open
#10,546 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

CUBEJS version : 1.6.27
database: mysql

**Describe the bug**

Image

database schema
Image

rest api curl

`curl --location 'http://localhost:4000/cubejs-api/v1/load?query=%7B%22dimensions%22%3A%5B%22dim_calendar.year%22%2C%22dim_calendar.month%22%2C%22dim_calendar.week%22%5D%2C%22limit%22%3A3%7D&queryType=multi'\
--header 'authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzQ0MDk2ODksImV4cCI6MTc3NDQ5NjA4OX0.0hvVaaM8gebsL9RnWeNxFKUcooKg2zphUk84vlkJ95w' \`

api response
```
{
"queryType": "regularQuery",
"results": [
{
"query": {
"dimensions": [
"dim_calendar.year",
"dim_calendar.month",
"dim_calendar.week"
],
"timeDimensions": [],
"limit": 3,
"timezone": "UTC",
"filters": [],
"rowLimit": 3
},
"lastRefreshTime": "2026-03-25T03:58:07.541Z",
"refreshKeyValues": [
[
{
"refresh_key": "177441107"
}
]
],
"usedPreAggregations": {},
"transformedQuery": {
"sortedDimensions": [
"dim_calendar.month",
"dim_calendar.week",
"dim_calendar.year"
],
"sortedTimeDimensions": [],
"timeDimensions": [],
"measures": [],
"leafMeasureAdditive": true,
"leafMeasures": [],
"leafMeasuresFullPaths": [],
"measureToLeafMeasures": {},
"hasNoTimeDimensionsWithoutGranularity": true,
"allFiltersWithinSelectedDimensions": true,
"isAdditive": true,
"granularityHierarchies": {},
"hasMultipliedMeasures": false,
"hasCumulativeMeasures": false,
"windowGranularity": null,
"filterDimensionsSingleValueEqual": {},
"ownedDimensions": [
"dim_calendar.month",
"dim_calendar.week",
"dim_calendar.year"
],
"ownedTimeDimensionsWithRollupGranularity": [],
"ownedTimeDimensionsAsIs": [],
"allBackAliasMembers": {},
"ungrouped": null,
"sortedUsedCubePrimaryKeys": null,
"sortedAllCubeNames": null,
"hasMultiStage": false
},
"requestId": "ec72ef31-f05f-4d58-8ea2-aeb6135b84f6-span-1",
"annotation": {
"measures": {},
"dimensions": {
"dim_calendar.month": {
"title": "Dim Calendar 所属月份",
"shortTitle": "所属月份",
"description": "所属月份",
"type": "number"
},
"dim_calendar.week": {
"title": "Dim Calendar 星期几",
"shortTitle": "星期几",
"description": "星期几",
"type": "number"
},
"dim_calendar.year": {
"title": "Dim Calendar 所属年份",
"shortTitle": "所属年份",
"description": "所属年份",
"type": "number"
}
},
"timeDimensions": {},
"segments": {}
},
"dataSource": "default",
"dbType": "mysql",
"extDbType": "cubestore",
"external": false,
"slowQuery": false,
"data": [
{
"dim_calendar.year": 2022.0,
"dim_calendar.month": 11.0,
"dim_calendar.week": 0.0
},
{
"dim_calendar.year": 2022.0,
"dim_calendar.month": 8.0,
"dim_calendar.week": 6.0
},
{
"dim_calendar.year": 2022.0,
"dim_calendar.month": 4.0,
"dim_calendar.week": 5.0
}
]
}
],
"pivotQuery": {
"dimensions": [
"dim_calendar.year",
"dim_calendar.month",
"dim_calendar.week"
],
"timeDimensions": [],
"limit": 3,
"timezone": "UTC",
"filters": [],
"rowLimit": 3,
"queryType": "regularQuery"
},
"slowQuery": false
}
```

**Minimally reproducible Cube Schema**
In case your bug report is data modelling related please put your minimally reproducible Cube Schema here.
You can use selects without tables in order to achieve that as follows.

```javascript
cube(`dim_calendar`, {
sql_table: `dim.dim_calendar`,
data_source: `default`,

/**
* 度量字段(measures)
*/
measures: {

},

/**
* 维度字段(dimensions)
*/
dimensions: {
day_id: {
sql: `day_id`,
type: `number`,
primaryKey: true,

title: `主键`,
description: `主键`
},

day_short: {
sql: `day_short`,
type: `string`,
title: `日期`,
description: `日期`
},

year: {
sql: `year`,
type: `number`,
title: `所属年份`,
description: `所属年份`
},

week: {
sql: `week`,
type: `number`,

title: `星期几`,
description: `星期几`
},

month: {
sql: `month`,
type: `number`,

title: `所属月份`,
description: `所属月份`
},

quarter: {
sql: `quarter`,
type: `number`,

title: `所属季度`,
description: `所属季度`
},

week_of_year: {
sql: `week_of_year`,
type: `number`,

title: `本年第几周`,
description: `本年第几周`
},

day_of_month: {
sql: `day_of_month`,
type: `number`,

title: `本月第几天`,
description: `本月第几天`
},

day_of_year: {
sql: `day_of_year`,
type: `number`,

title: `本年第几天`,
description: `本年第几天`
},

month_date_num: {
sql: `month_date_num`,
type: `number`,

title: `本月的天数`,
description: `本月的天数`
},

is_Holidays: {
sql: `is_Holidays`,
type: `number`,

title: `是否节假日`,
description: `是否节假日`
},

// ===== string 类型 =====
week_first_date: {
sql: `week_first_date`,
type: `string`,
title: `本周第一天日期`,
description: `本周第一天日期`
},

week_last_date: {
sql: `week_last_date`,
type: `string`,
title: `本周最后一天日期`,
description: `本周最后一天日期`
},

week_cn: {
sql: `week_cn`,
type: `string`,
title: `星期几(中文)`,
description: `星期几(中文)`
},

week_en: {
sql: `week_en`,
type: `string`,
title: `星期几(英文)`,
description: `星期几(英文)`
},

month_cn: {
sql: `month_cn`,
type: `string`,
title: `所属月份(中文)`,
description: `所属月份(中文)`
},

month_en: {
sql: `month_en`,
type: `string`,
title: `所属月份(英文)`,
description: `所属月份(英文)`
},

month_first_date: {
sql: `month_first_date`,
type: `string`,
title: `本月第一天日期`,
description: `本月第一天日期`
},

month_last_date: {
sql: `month_last_date`,
type: `string`,
title: `本月最后一天日期`,
description: `本月最后一天日期`
},

quarter_cn: {
sql: `quarter_cn`,
type: `string`,
title: `所属季度(中文)`,
description: `所属季度(中文)`
}
},

joins: {

},

preAggregations: {

},

description: `dim_calendar`
});
},
dimensions: {
status: {
sql: `status`,
type: `string`,
},
},
});
```

**Version:**
1.6.27

**Additional context**
Add any other context about the problem here.

Doc refrence:[https://cube.dev/docs/product/apis-integrations/core-data-apis/rest-api/reference?utm_source=chatgpt.com](https://cube.dev/docs/product/apis-integrations/core-data-apis/rest-api/reference?utm_source=chatgpt.com)

[https://cube.dev/docs/product/data-modeling/reference/types-and-formats](https://cube.dev/docs/product/data-modeling/reference/types-and-formats)

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.