Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Random data column sequence in API response (endpoint: /v1/load) #10080

Open
Labels
questionThe issue is a question. Please use Stack Overflow for questions.
@UsmanYasin

Description

Problem

Cube.dev load api call is returning a response, but the sequence of the columns changes for every request. It is a challenge in case of pagination requests in compact mode, as the data array may have a different column sequence for every page, which has to be realigned to combine multiple pages together. A similar issue is observed in the case of default responseFormat, where the property fields in every single JSON object in the result have a different sequence. I remember some older version(maybe before v0.36.x) didn't have this issue. So, the question is whether this is a regression or intended behaviour.

Expected Behaviour
In my understanding, the expected behaviour is to have the columns sequence in the same order as the Time dimension first, followed by the dimensions in the provided sequence, followed by the measures in their provided sequence.

Probable Root Cause
I have had a brief look into the code and believe the behaviour is happening because of using HashMap instead of IndexMap in Rust (rust/cubeorchestrator/src/query_result_transform.rs). IndexMap is drop-in compatible with HashMap, so do you think this can be a way to add deterministic behaviour to cube.dev responses? Happy to contribute a PR if you think this is the right approach.

Related Cube.js schema
Used the Demo deployment. I can share a simple schema as well if that helps.

Screenshots:
Default Mode:

{
 "query": {
 "dimensions": [
 "orders.users_city",
 "orders.users_state",
 "orders.users_age",
 "orders.status"
 ],
 "measures": [
 "orders.total",
 "orders.count",
 "orders.completed_count",
 "orders.completed_percentage"
 ],
 "limit": 10
 }
}

1st Run:
Image

2nd Run:
Image

Compact mode:

{
 "query": {
 "responseFormat": "compact",
 "dimensions": [
 "orders.users_city",
 "orders.users_state",
 "orders.users_age",
 "orders.status"
 ],
 "measures": [
 "orders.total",
 "orders.count",
 "orders.completed_count",
 "orders.completed_percentage"
 ],
 "limit": 10
 }
}

1st Run:
Image

2nd Run:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThe issue is a question. Please use Stack Overflow for questions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /