Skip to content
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

feat(api-gateway): Async native query results transformations #8961

Draft
wants to merge 96 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
d77ca50
create a basic cubeorchestrator project structure
KSDaemon Oct 24, 2024
b82d3d2
wip
KSDaemon Oct 24, 2024
1c67862
move flatbuffer schema/code to separate crate
KSDaemon Nov 14, 2024
c466fee
implement parse_cubestore_ws_result
KSDaemon Nov 15, 2024
5a30e03
add cubeorchestrator/parse_cubestore_ws_result_message export
KSDaemon Nov 15, 2024
a32f615
use native parseCubestoreResultMessage
KSDaemon Nov 15, 2024
fca926b
init hashmap with capacity
KSDaemon Nov 15, 2024
729db35
cargo fmt
KSDaemon Nov 15, 2024
4cf3632
some optimizations and improvements
KSDaemon Nov 15, 2024
11a1c71
a bit optimized version
KSDaemon Nov 18, 2024
24b5217
use cx.execute_scoped for optimization
KSDaemon Nov 18, 2024
c6ef843
a bit more rust idiomatic code
KSDaemon Nov 18, 2024
10717f6
put native parseCubestoreResultMessage behind the flag
KSDaemon Nov 20, 2024
06eec29
tiny improvement
KSDaemon Nov 21, 2024
ff1734b
cargo fmt
KSDaemon Nov 25, 2024
7a3b9dc
cargo fmt
KSDaemon Nov 25, 2024
7bceb6f
cargo clippy fix
KSDaemon Nov 25, 2024
fc28b82
update cubestore Dockerfile
KSDaemon Nov 25, 2024
ccb7e99
cargo fmt
KSDaemon Nov 25, 2024
5903113
update cubestore Docker builds
KSDaemon Nov 25, 2024
bceb6f7
introduce CubeStoreResult struct
KSDaemon Nov 27, 2024
0261e86
create CubeStoreResultWrapper class and switch to lazy evaluation of …
KSDaemon Nov 29, 2024
057bc60
add resToRawResultFn in API GW
KSDaemon Nov 29, 2024
ac837e4
cargo fmt
KSDaemon Nov 29, 2024
093ca8a
update resToResultFn
KSDaemon Nov 29, 2024
f74e261
call prepareAnnotation later
KSDaemon Nov 29, 2024
b2c2fb0
remove bytes
KSDaemon Dec 2, 2024
22758b2
add cached flag to CubeStoreResultWrapper
KSDaemon Dec 2, 2024
a9413ec
convert core data types from api gateway
KSDaemon Dec 2, 2024
0a2e8bf
implement transformData and related helpers
KSDaemon Dec 2, 2024
17fa15d
cargo fmt
KSDaemon Dec 2, 2024
95f285c
down chrono to same version as in cubesql (0.4.31)
KSDaemon Dec 2, 2024
38bc568
fail fast in api gw load()
KSDaemon Dec 2, 2024
2a318b7
update cargo.lock (syn crate)
KSDaemon Dec 2, 2024
0df4663
linter fix
KSDaemon Dec 3, 2024
1e9f47b
implement get_query_granularities & get_pivot_query
KSDaemon Dec 9, 2024
3fb372a
prepare transformQueryData native wrapper
KSDaemon Dec 9, 2024
1c920c6
small optimization: do not use native parsing for short messages
KSDaemon Dec 10, 2024
cc91a10
refactor transformValue and related
KSDaemon Dec 10, 2024
e14a0cc
types restructure
KSDaemon Dec 10, 2024
2a38483
debug and fix native transform_data()
KSDaemon Dec 10, 2024
fede005
lazy transformData evaluation
KSDaemon Dec 10, 2024
eb004b9
omplement get_final_cubestore_result & get_final_cubestore_result_mul…
KSDaemon Dec 11, 2024
d3a0a0a
cargo fmt
KSDaemon Dec 11, 2024
34fdc90
cargo clippy fix
KSDaemon Dec 11, 2024
98c4c2e
refactor getVanillaRow
KSDaemon Dec 11, 2024
519282d
implement get_final_cubestore_result_array() native
KSDaemon Dec 11, 2024
1d50719
fix native response flow for sqlApiLoad
KSDaemon Dec 12, 2024
bd0f0de
add postgres with native cubestore results driver tests
KSDaemon Dec 12, 2024
de884bf
Build native (without Python) in drivers tests
KSDaemon Dec 12, 2024
90282df
workaround for native build in testings-drivers
KSDaemon Dec 12, 2024
9ff1fbd
small improvements in CubeStoreResultWrapper
KSDaemon Dec 12, 2024
2df58be
make parse_cubestore_ws_result_message async
KSDaemon Dec 13, 2024
acf8701
make all native cubestore_result_transform functions async
KSDaemon Dec 13, 2024
558316a
cargo fmt
KSDaemon Dec 13, 2024
c65362d
refactor results transformations
KSDaemon Dec 16, 2024
ef2f73a
yarn sync
KSDaemon Dec 16, 2024
ddc1423
fix @cubejs-backend/native version ref
KSDaemon Dec 16, 2024
bf065b0
implement custom deserializer from JS Value to rust
KSDaemon Dec 16, 2024
bedc2a8
refactor json_to_array_buffer()
KSDaemon Dec 17, 2024
5005155
a bit of refactoring
KSDaemon Dec 17, 2024
f0b3179
code rearrangement
KSDaemon Dec 17, 2024
3fa2580
switch to use DBResponsePrimitive instead of just Strings
KSDaemon Dec 17, 2024
6f56be4
refactoring
KSDaemon Dec 17, 2024
4ba9525
always use transform data native for all results
KSDaemon Dec 17, 2024
fbc2f7d
fix dtos for native query processing (thnx unit tests)
KSDaemon Dec 17, 2024
45bad04
cache loadNative
KSDaemon Dec 17, 2024
bc733d7
remove not needed anymore native.transformQueryData
KSDaemon Dec 17, 2024
ecc3aba
add Build native for unit tests in CI
KSDaemon Dec 17, 2024
e81aec0
refactor serde annotations
KSDaemon Dec 17, 2024
10d35ce
remove unused
KSDaemon Dec 17, 2024
74ddacc
annotate native query results processing functions
KSDaemon Dec 17, 2024
9a14338
add Build native for unit tests in CI for Debian without pushing
KSDaemon Dec 17, 2024
8d455f5
add few unit tests
KSDaemon Dec 17, 2024
ff8d884
fix some tests
KSDaemon Dec 17, 2024
8598f02
attempt to fix native build/test in docker-dev CI
KSDaemon Dec 17, 2024
0b42b12
fix empty result set issue
KSDaemon Dec 17, 2024
619ad33
another fix in datetime parsing
KSDaemon Dec 18, 2024
d516048
another fix in deserialization
KSDaemon Dec 18, 2024
3ec92e6
another fix in datetime parsing
KSDaemon Dec 18, 2024
d5bc1d9
update postgres-native-cubestore-response-full.test.ts.snap
KSDaemon Dec 18, 2024
4b6482e
another fix in deserialization
KSDaemon Dec 18, 2024
37c777a
cargo fmt
KSDaemon Dec 18, 2024
6afa7d4
another fix in datetime parsing
KSDaemon Dec 18, 2024
56e23c7
update postgres-native-cubestore-response-full.test.ts.snap
KSDaemon Dec 18, 2024
6da4608
attempt to fix native build/test in docker-dev CI
KSDaemon Dec 18, 2024
0697c03
add some comments
KSDaemon Dec 18, 2024
34d0085
edits in result processing when streaming
KSDaemon Dec 18, 2024
f5e6aec
fix native response processing via websocket
KSDaemon Dec 18, 2024
32e627a
fix yarn lock
KSDaemon Dec 18, 2024
7e772e6
attempt to fix native build/test in cloud integration tests in CI
KSDaemon Dec 19, 2024
fb13514
recreated unit tests for transform data in native
KSDaemon Dec 19, 2024
e3f9ced
run rust unit tests on push
KSDaemon Dec 20, 2024
73ccbb3
commented out cargo fmt/build/test for cubesql, cubesqlplanner
KSDaemon Dec 20, 2024
8361073
remove transformdata JS implementation
KSDaemon Dec 20, 2024
274368b
refactor push CI jobs
KSDaemon Dec 20, 2024
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
18 changes: 18 additions & 0 deletions .github/workflows/cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,31 @@ jobs:
matrix:
node-version: [ 20.x ]
db: [ 'athena', 'bigquery', 'snowflake' ]
target: [ "x86_64-unknown-linux-gnu" ]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-07-15
# override: true # this is by default on
rustflags: ""
components: rustfmt
target: ${{ matrix.target }}
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install cargo-cp-artifact
run: npm install -g [email protected]
- uses: Swatinem/rust-cache@v2
with:
workspaces: ./packages/cubejs-backend-native
key: native-${{ runner.OS }}-${{ matrix.target }}
shared-key: native-${{ runner.OS }}-${{ matrix.target }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
Expand All @@ -87,6 +103,8 @@ jobs:
run: yarn build
- name: Lerna tsc
run: yarn tsc
- name: Build native (no python)
run: cd packages/cubejs-backend-native && npm run native:build-release
- name: Run Integration tests for ${{ matrix.db }} matrix
timeout-minutes: 30
env:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/drivers-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: ./packages/cubejs-backend-native
key: native-${{ runner.OS }}-x86_64-unknown-linux-gnu
shared-key: native-${{ runner.OS }}-x86_64-unknown-linux-gnu
key: native-${{ runner.OS }}-${{ matrix.target }}
shared-key: native-${{ runner.OS }}-${{ matrix.target }}
- name: Build native (fallback)
if: (matrix.python-version == 'fallback')
env:
Expand Down Expand Up @@ -163,7 +163,12 @@ jobs:
uses: actions/download-artifact@v4
with:
name: backend-native
path: packages/cubejs-backend-native/
path: packages/cubejs-backend-native
# current .dockerignore prevents use of native build
- name: Unignore native from .dockerignore
run: |
grep -v -E "packages/cubejs-backend-native/((native)|(index.node))" .dockerignore > .dockerignore.tmp
mv .dockerignore.tmp .dockerignore
- name: Build and push
uses: docker/build-push-action@v6
with:
Expand Down Expand Up @@ -223,6 +228,7 @@ jobs:
- mssql
- mysql
- postgres
- postgres-native-cubestore-response
- redshift
- redshift-export-bucket-s3
- snowflake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ jobs:
- name: Push to Docker Hub
uses: docker/build-push-action@v6
with:
context: ./rust/cubestore/
context: ./rust/
file: ./rust/cubestore/Dockerfile
platforms: ${{ matrix.platforms }}
build-args: ${{ matrix.build-args }}
Expand Down
110 changes: 95 additions & 15 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- 'packages/**'
- 'rust/cubestore/**'
- 'rust/cubesql/**'
- 'rust/cubenativeutils/**'
- 'rust/cubeorchestrator/**'
- 'rust/cubeshared/**'
- 'rust/cubesqlplanner/**'
- '.eslintrc.js'
- '.prettierrc'
- 'package.json'
Expand All @@ -24,6 +28,10 @@ on:
- 'packages/**'
- 'rust/cubestore/**'
- 'rust/cubesql/**'
- 'rust/cubenativeutils/**'
- 'rust/cubeorchestrator/**'
- 'rust/cubeshared/**'
- 'rust/cubesqlplanner/**'
- '.eslintrc.js'
- '.prettierrc'
- 'package.json'
Expand Down Expand Up @@ -95,14 +103,15 @@ jobs:
command: yarn install --frozen-lockfile
- name: Lerna tsc
run: yarn tsc
- name: Build native (no python)
run: cd packages/cubejs-backend-native && npm run native:build-release
- name: Build client
run: yarn build
- name: Build cubejs-backend-native (with Python)
run: yarn run native:build-release-python
working-directory: ./packages/cubejs-backend-native
env:
PYO3_PYTHON: python${{ matrix.python-version }}

- name: Lerna test
run: yarn lerna run --concurrency 1 --stream --no-prefix unit
# - uses: codecov/codecov-action@v1
Expand All @@ -111,6 +120,21 @@ jobs:
# files: ./packages/*/coverage/clover.xml
# flags: cube-backend
# verbose: true # optional (default = false)
- name: Cargo test cubeorchestrator
run: |
cargo test --manifest-path rust/cubeorchestrator/Cargo.toml -j 1
- name: Cargo test cubenativeutils
run: |
cargo test --manifest-path rust/cubenativeutils/Cargo.toml -j 1
- name: Cargo test cubeshared
run: |
cargo test --manifest-path rust/cubeshared/Cargo.toml -j 1
# - name: Cargo test cubesql
# run: |
# cargo test --manifest-path rust/cubesql/Cargo.toml -j 1
# - name: Cargo test cubesqlplanner
# run: |
# cargo test --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 1

lint:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -159,6 +183,21 @@ jobs:
run: yarn lint:npm
- name: Lerna lint
run: yarn lerna run --concurrency 1 lint
- name: Cargo fmt cubeorchestrator
run: |
cargo fmt --manifest-path rust/cubeorchestrator/Cargo.toml -- --check
- name: Cargo fmt cubenativeutils
run: |
cargo fmt --manifest-path rust/cubenativeutils/Cargo.toml -- --check
- name: Cargo fmt cubeshared
run: |
cargo fmt --manifest-path rust/cubeshared/Cargo.toml -- --check
# - name: Cargo fmt cubesql
# run: |
# cargo fmt --manifest-path rust/cubesql/Cargo.toml -- --check
# - name: Cargo fmt cubesqlplanner
# run: |
# cargo fmt --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -- --check

build:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -211,6 +250,21 @@ jobs:
run: yarn lerna run --concurrency 1 build
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Cargo build cubeorchestrator
run: |
cargo build --manifest-path rust/cubeorchestrator/Cargo.toml -j 4
- name: Cargo build cubenativeutils
run: |
cargo build --manifest-path rust/cubenativeutils/Cargo.toml -j 4
- name: Cargo build cubeshared
run: |
cargo build --manifest-path rust/cubeshared/Cargo.toml -j 4
# - name: Cargo build cubesql
# run: |
# cargo build --manifest-path rust/cubesql/Cargo.toml -j 4
# - name: Cargo build cubesqlplanner
# run: |
# cargo build --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 4

build-cubestore:
needs: [latest-tag-sha]
Expand Down Expand Up @@ -539,6 +593,8 @@ jobs:
- 5000:5000
strategy:
matrix:
node-version: [ 20 ]
target: [ "x86_64-unknown-linux-gnu" ]
dockerfile:
- dev.Dockerfile
include:
Expand All @@ -565,21 +621,29 @@ jobs:
df -h
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build image
uses: docker/build-push-action@v6
timeout-minutes: 30
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
context: .
file: ./packages/cubejs-docker/${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
tags: localhost:5000/cubejs/cube:${{ matrix.tag }}
- name: Use Node.js 20.x
toolchain: nightly-2024-07-15
# override: true # this is by default on
rustflags: ""
components: rustfmt
target: ${{ matrix.target }}
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: ${{ matrix.node-version }}
- name: Install Yarn
run: npm install -g yarn
- name: Set Yarn version
run: yarn policies set-version v1.22.22
- name: Install cargo-cp-artifact
run: npm install -g [email protected]
- uses: Swatinem/rust-cache@v2
with:
workspaces: ./packages/cubejs-backend-native
key: native-${{ runner.OS }}-${{ matrix.target }}
shared-key: native-${{ runner.OS }}-${{ matrix.target }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT"
Expand All @@ -591,8 +655,6 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set Yarn version
run: yarn policies set-version v1.22.22
- name: Yarn install
uses: nick-fields/retry@v3
env:
Expand All @@ -607,6 +669,24 @@ jobs:
run: yarn build
- name: Lerna tsc
run: yarn tsc
- name: Build native (no python)
run: cd packages/cubejs-backend-native && npm run native:build-release
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# current .dockerignore prevents use of native build
- name: Unignore native from .dockerignore
run: |
grep -v -E "packages/cubejs-backend-native/((native)|(index.node))" .dockerignore > .dockerignore.tmp
mv .dockerignore.tmp .dockerignore
- name: Build image
uses: docker/build-push-action@v6
timeout-minutes: 30
with:
context: .
file: ./packages/cubejs-docker/${{ matrix.dockerfile }}
platforms: linux/amd64
push: true
tags: localhost:5000/cubejs/cube:${{ matrix.tag }}
- name: Testing CubeJS (container mode) via BirdBox
run: |
cd packages/cubejs-testing/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-cubestore-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
- name: Push to Docker Hub
uses: docker/build-push-action@v6
with:
context: ./rust/cubestore
context: ./rust
file: ./rust/cubestore/Dockerfile
platforms: ${{ matrix.platforms }}
build-args: ${{ matrix.build-args }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-cubestore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Build only
uses: docker/build-push-action@v6
with:
context: ./rust/cubestore/
context: ./rust/
file: ./rust/cubestore/Dockerfile
platforms: ${{ matrix.platforms }}
build-args: ${{ matrix.build-args }}
Expand Down
Loading
Loading