From 8e8a69f890bf584733a27ecd7d97141b88267d4c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 24 Oct 2024 18:16:35 +0300 Subject: [PATCH 001/128] create a basic cubeorchestrator project structure --- rust/cubenativeutils/rustfmt.toml | 1 + rust/cubeorchestrator/.gitignore | 3 + rust/cubeorchestrator/CHANGELOG.md | 2 + rust/cubeorchestrator/Cargo.lock | 3504 +++++++++++++++++++++ rust/cubeorchestrator/Cargo.toml | 12 + rust/cubeorchestrator/rust-toolchain.toml | 5 + rust/cubeorchestrator/rustfmt.toml | 1 + rust/cubeorchestrator/src/lib.rs | 0 8 files changed, 3528 insertions(+) create mode 100644 rust/cubenativeutils/rustfmt.toml create mode 100644 rust/cubeorchestrator/.gitignore create mode 100644 rust/cubeorchestrator/CHANGELOG.md create mode 100644 rust/cubeorchestrator/Cargo.lock create mode 100644 rust/cubeorchestrator/Cargo.toml create mode 100644 rust/cubeorchestrator/rust-toolchain.toml create mode 100644 rust/cubeorchestrator/rustfmt.toml create mode 100644 rust/cubeorchestrator/src/lib.rs diff --git a/rust/cubenativeutils/rustfmt.toml b/rust/cubenativeutils/rustfmt.toml new file mode 100644 index 0000000000000..d9ba5fdb90ba3 --- /dev/null +++ b/rust/cubenativeutils/rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Crate" \ No newline at end of file diff --git a/rust/cubeorchestrator/.gitignore b/rust/cubeorchestrator/.gitignore new file mode 100644 index 0000000000000..2a0a960cb1ec5 --- /dev/null +++ b/rust/cubeorchestrator/.gitignore @@ -0,0 +1,3 @@ +/target +/.idea +.vscode diff --git a/rust/cubeorchestrator/CHANGELOG.md b/rust/cubeorchestrator/CHANGELOG.md new file mode 100644 index 0000000000000..f05ecfa971fe9 --- /dev/null +++ b/rust/cubeorchestrator/CHANGELOG.md @@ -0,0 +1,2 @@ +# ChangeLog + diff --git a/rust/cubeorchestrator/Cargo.lock b/rust/cubeorchestrator/Cargo.lock new file mode 100644 index 0000000000000..95dfbec5b39f5 --- /dev/null +++ b/rust/cubeorchestrator/Cargo.lock @@ -0,0 +1,3504 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" + +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "arrow" +version = "13.0.0" +source = "git+https://github.com/cube-js/arrow-rs.git?rev=a03d4eef5640e05dddf99fc2357ad6d58b5337cb#a03d4eef5640e05dddf99fc2357ad6d58b5337cb" +dependencies = [ + "bitflags 1.3.2", + "chrono", + "comfy-table 5.0.1", + "csv", + "flatbuffers", + "half", + "hex", + "indexmap 1.9.3", + "lazy_static", + "lexical-core", + "multiversion", + "num", + "rand", + "regex", + "regex-syntax 0.6.29", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bigdecimal" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "blake3" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 1.0.0", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", + "syn_derive", +] + +[[package]] +name = "brotli" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytecheck" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" + +[[package]] +name = "cc" +version = "1.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets", +] + +[[package]] +name = "chrono-tz" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", +] + +[[package]] +name = "colored" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" +dependencies = [ + "is-terminal", + "lazy_static", + "winapi", +] + +[[package]] +name = "comfy-table" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b103d85ca6e209388771bfb7aa6b68a7aeec4afbf6f0a0264bfbf50360e5212e" +dependencies = [ + "strum 0.23.0", + "strum_macros 0.23.1", + "unicode-width", +] + +[[package]] +name = "comfy-table" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" +dependencies = [ + "crossterm", + "strum 0.26.3", + "strum_macros 0.26.4", + "unicode-width", +] + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crossterm" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" +dependencies = [ + "bitflags 2.6.0", + "crossterm_winapi", + "libc", + "parking_lot", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "csv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +dependencies = [ + "memchr", +] + +[[package]] +name = "cube-ext" +version = "1.0.0" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" +dependencies = [ + "arrow", + "chrono", + "datafusion-common", + "datafusion-expr", +] + +[[package]] +name = "cubeclient" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "log", + "reqwest", + "reqwest-middleware", + "serde", + "serde_derive", + "serde_json", + "tokio", + "url", + "uuid 1.11.0", +] + +[[package]] +name = "cubeorchestrator" +version = "0.1.0" +dependencies = [ + "cubesql", + "neon", +] + +[[package]] +name = "cubesql" +version = "0.28.0" +dependencies = [ + "anyhow", + "arc-swap", + "async-stream", + "async-trait", + "base64 0.13.1", + "bigdecimal", + "bincode", + "bitflags 1.3.2", + "byteorder", + "bytes", + "chrono", + "chrono-tz", + "comfy-table 7.1.1", + "csv", + "cubeclient", + "datafusion", + "egg", + "futures", + "futures-core", + "futures-util", + "hashbrown 0.14.5", + "indexmap 1.9.3", + "itertools", + "log", + "lru", + "minijinja", + "mockall", + "paste", + "pg-srv", + "postgres-types", + "rand", + "regex", + "rust_decimal", + "serde", + "serde_json", + "sha1_smol", + "sha2", + "simple_logger", + "smallvec", + "sqlparser", + "tera", + "thiserror", + "tokio", + "tokio-util", + "tracing", + "uuid 1.11.0", +] + +[[package]] +name = "datafusion" +version = "7.0.0" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" +dependencies = [ + "ahash 0.7.8", + "arrow", + "async-trait", + "chrono", + "datafusion-common", + "datafusion-data-access", + "datafusion-expr", + "datafusion-physical-expr", + "futures", + "hashbrown 0.12.3", + "itertools", + "lazy_static", + "log", + "num_cpus", + "ordered-float 2.10.1", + "parking_lot", + "parquet", + "paste", + "pin-project-lite", + "rand", + "smallvec", + "sqlparser", + "tempfile", + "tokio", + "tokio-stream", + "uuid 0.8.2", +] + +[[package]] +name = "datafusion-common" +version = "7.0.0" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" +dependencies = [ + "arrow", + "ordered-float 2.10.1", + "parquet", + "sqlparser", +] + +[[package]] +name = "datafusion-data-access" +version = "1.0.0" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" +dependencies = [ + "async-trait", + "chrono", + "futures", + "parking_lot", + "tempfile", + "tokio", +] + +[[package]] +name = "datafusion-expr" +version = "7.0.0" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" +dependencies = [ + "ahash 0.7.8", + "arrow", + "datafusion-common", + "sqlparser", +] + +[[package]] +name = "datafusion-physical-expr" +version = "7.0.0" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" +dependencies = [ + "ahash 0.7.8", + "arrow", + "blake2", + "blake3", + "chrono", + "cube-ext", + "datafusion-common", + "datafusion-expr", + "hashbrown 0.12.3", + "lazy_static", + "md-5", + "ordered-float 2.10.1", + "paste", + "rand", + "regex", + "sha2", + "unicode-segmentation", +] + +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d" + +[[package]] +name = "egg" +version = "0.9.5" +source = "git+https://github.com/cube-js/egg.git?rev=952f8c2a1033e5da097d23c523b0d8e392eb532b#952f8c2a1033e5da097d23c523b0d8e392eb532b" +dependencies = [ + "env_logger", + "fxhash", + "hashbrown 0.12.3", + "indexmap 1.9.3", + "instant", + "log", + "num-bigint", + "num-traits", + "saturating", + "smallvec", + "symbol_table", + "symbolic_expressions", + "thiserror", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "flatbuffers" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b428b715fdbdd1c364b84573b5fdc0f84f8e423661b9f398735278bc7f2b6a" +dependencies = [ + "bitflags 1.3.2", + "smallvec", + "thiserror", +] + +[[package]] +name = "flate2" +version = "1.0.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "float-cmp" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fragile" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7464c5c4a3f014d9b2ec4073650e5c06596f385060af740fc45ad5a19f959e8" +dependencies = [ + "fragile 2.0.0", +] + +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "globset" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax 0.8.5", +] + +[[package]] +name = "globwalk" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +dependencies = [ + "bitflags 2.6.0", + "ignore", + "walkdir", +] + +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "hyper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "integer-encoding" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48dc51180a9b377fd75814d0cc02199c20f8e99433d6762f650d39cdbbd3b56f" + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "is-terminal" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +dependencies = [ + "hermit-abi 0.4.0", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lexical-core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if 1.0.0", + "windows-targets", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.0", +] + +[[package]] +name = "lz4" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" +dependencies = [ + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.11.1+lz4-1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if 1.0.0", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memo-map" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minijinja" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e877d961d4f96ce13615862322df7c0b6d169d40cab71a7ef3f9b9e594451e" +dependencies = [ + "memo-map", + "self_cell", + "serde", + "serde_json", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "mockall" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cabea45a7fc0e37093f4f30a5e2b62602253f91791c057d5f0470c63260c3d" +dependencies = [ + "cfg-if 0.1.10", + "downcast", + "fragile 1.2.2", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c461918bf7f59eefb1459252756bf2351a995d6bd510d0b2061bd86bcdabfa6" +dependencies = [ + "cfg-if 0.1.10", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "multiversion" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "025c962a3dd3cc5e0e520aa9c612201d127dcdf28616974961a649dca64f5373" +dependencies = [ + "multiversion-macros", +] + +[[package]] +name = "multiversion-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a3e2bde382ebf960c1f3e79689fa5941625fe9bf694a1cb64af3e85faff3af" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "neon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d75440242411c87dc39847b0e33e961ec1f10326a9d8ecf9c1ea64a3b3c13dc" +dependencies = [ + "libloading", + "neon-macros", + "once_cell", + "semver", + "send_wrapper", + "smallvec", + "tokio", +] + +[[package]] +name = "neon-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" +dependencies = [ + "quote", + "syn 2.0.85", + "syn-mid", +] + +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "ordered-float" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "parquet" +version = "13.0.0" +source = "git+https://github.com/cube-js/arrow-rs.git?rev=a03d4eef5640e05dddf99fc2357ad6d58b5337cb#a03d4eef5640e05dddf99fc2357ad6d58b5337cb" +dependencies = [ + "arrow", + "base64 0.13.1", + "brotli", + "byteorder", + "chrono", + "flate2", + "lz4", + "num", + "num-bigint", + "parquet-format", + "rand", + "snap", + "thrift", + "zstd", +] + +[[package]] +name = "parquet-format" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f0c06cdcd5460967c485f9c40a821746f5955ad81990533c7fae95dbd9bc0b5" +dependencies = [ + "thrift", +] + +[[package]] +name = "parse-zoneinfo" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" +dependencies = [ + "regex", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "pest_meta" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "pg-srv" +version = "0.2.0" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "chrono", + "log", + "thiserror", + "tokio", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", + "uncased", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "postgres-protocol" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acda0ebdebc28befa84bee35e651e4c5f09073d668c7aed4cf7e23c3cda84b23" +dependencies = [ + "base64 0.22.1", + "byteorder", + "bytes", + "fallible-iterator", + "hmac", + "md-5", + "memchr", + "rand", + "sha2", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f66ea23a2d0e5734297357705193335e0a957696f34bed2f2faefacb2fec336f" +dependencies = [ + "bytes", + "fallible-iterator", + "postgres-protocol", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "predicates" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df" +dependencies = [ + "difference", + "float-cmp", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" + +[[package]] +name = "predicates-tree" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quinn" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "reqwest" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "windows-registry", +] + +[[package]] +name = "reqwest-middleware" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" +dependencies = [ + "anyhow", + "async-trait", + "http", + "reqwest", + "serde", + "thiserror", + "tower-service", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rkyv" +version = "0.7.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid 1.11.0", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rust_decimal" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +dependencies = [ + "arrayvec", + "borsh", + "bytes", + "num-traits", + "postgres-types", + "rand", + "rkyv", + "serde", + "serde_json", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "saturating" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "self_cell" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.213" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.213" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "serde_json" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +dependencies = [ + "indexmap 2.6.0", + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simple_logger" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7de33c687404ec3045d4a0d437580455257c0436f858d702f244e7d652f9f07" +dependencies = [ + "atty", + "chrono", + "colored", + "log", + "winapi", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "snap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "sqlparser" +version = "0.16.0" +source = "git+https://github.com/cube-js/sqlparser-rs.git?rev=6a54d27d3b75a04b9f9cbe309a83078aa54b32fd#6a54d27d3b75a04b9f9cbe309a83078aa54b32fd" +dependencies = [ + "log", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strum" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" + +[[package]] +name = "strum_macros" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" +dependencies = [ + "heck 0.3.3", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.85", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "symbol_table" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32bf088d1d7df2b2b6711b06da3471bc86677383c57b27251e18c56df8deac14" +dependencies = [ + "ahash 0.7.8", + "hashbrown 0.12.3", +] + +[[package]] +name = "symbolic_expressions" +version = "5.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c68d531d83ec6c531150584c42a4290911964d5f0d79132b193b67252a23b71" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-mid" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "tera" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9d851b45e865f178319da0abdbfe6acbc4328759ff18dafc3a41c16b4cd2ee" +dependencies = [ + "globwalk", + "lazy_static", + "pest", + "pest_derive", + "regex", + "serde", + "serde_json", + "unic-segment", +] + +[[package]] +name = "termtree" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" + +[[package]] +name = "thiserror" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "thrift" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6d965454947cc7266d22716ebfd07b18d84ebaf35eec558586bbb2a8cb6b5b" +dependencies = [ + "byteorder", + "integer-encoding", + "log", + "ordered-float 1.1.1", + "threadpool", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap 2.6.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "version_check", +] + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +dependencies = [ + "unic-ucd-segment", +] + +[[package]] +name = "unic-ucd-segment" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicase" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" + +[[package]] +name = "unicode-bidi" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", +] + +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.85", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "web-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml new file mode 100644 index 0000000000000..38d2f9b5d39e9 --- /dev/null +++ b/rust/cubeorchestrator/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "cubeorchestrator" +version = "0.1.0" +edition = "2021" + +[dependencies] +cubesql = { path = "../cubesql/cubesql" } + +[dependencies.neon] +version = "=1" +default-features = false +features = ["napi-1", "napi-4", "napi-6", "futures"] diff --git a/rust/cubeorchestrator/rust-toolchain.toml b/rust/cubeorchestrator/rust-toolchain.toml new file mode 100644 index 0000000000000..040357e9b1d43 --- /dev/null +++ b/rust/cubeorchestrator/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +#channel = "stable" +channel = "nightly-2024-07-15" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/rust/cubeorchestrator/rustfmt.toml b/rust/cubeorchestrator/rustfmt.toml new file mode 100644 index 0000000000000..d9ba5fdb90ba3 --- /dev/null +++ b/rust/cubeorchestrator/rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Crate" \ No newline at end of file diff --git a/rust/cubeorchestrator/src/lib.rs b/rust/cubeorchestrator/src/lib.rs new file mode 100644 index 0000000000000..e69de29bb2d1d From 5a89f42bdc9cc628907eb81b5048a0f633b26a2b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 24 Oct 2024 21:12:05 +0300 Subject: [PATCH 002/128] wip --- rust/cubeorchestrator/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/cubeorchestrator/src/lib.rs b/rust/cubeorchestrator/src/lib.rs index e69de29bb2d1d..40031d8d4122d 100644 --- a/rust/cubeorchestrator/src/lib.rs +++ b/rust/cubeorchestrator/src/lib.rs @@ -0,0 +1,2 @@ +pub use cubesql::CubeError; + From 9db41a01249196b7f56a390f833adcdeabf5ef6a Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 14 Nov 2024 19:04:28 +0200 Subject: [PATCH 003/128] =?UTF-8?q?move=20flatbuffer=20schema/code=20to?= =?UTF-8?q?=C2=A0separate=20crate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust/cubeshared/.gitignore | 3 ++ rust/cubeshared/CHANGELOG.md | 2 + rust/cubeshared/Cargo.lock | 41 +++++++++++++++++++ rust/cubeshared/Cargo.toml | 7 ++++ rust/cubeshared/flatbuffers-codegen.sh | 4 ++ rust/cubeshared/rust-toolchain.toml | 5 +++ rust/cubeshared/rustfmt.toml | 1 + .../src/codegen/http_message.fbs | 0 .../src/codegen/http_message_generated.rs | 0 .../src/codegen/mod.rs | 1 + rust/cubeshared/src/lib.rs | 1 + rust/cubestore/Cargo.lock | 8 ++++ rust/cubestore/cubestore/Cargo.toml | 1 + rust/cubestore/cubestore/src/http/mod.rs | 20 ++++----- rust/cubestore/cubestore/src/lib.rs | 1 - 15 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 rust/cubeshared/.gitignore create mode 100644 rust/cubeshared/CHANGELOG.md create mode 100644 rust/cubeshared/Cargo.lock create mode 100644 rust/cubeshared/Cargo.toml create mode 100755 rust/cubeshared/flatbuffers-codegen.sh create mode 100644 rust/cubeshared/rust-toolchain.toml create mode 100644 rust/cubeshared/rustfmt.toml rename rust/{cubestore/cubestore => cubeshared}/src/codegen/http_message.fbs (100%) rename rust/{cubestore/cubestore => cubeshared}/src/codegen/http_message_generated.rs (100%) rename rust/{cubestore/cubestore => cubeshared}/src/codegen/mod.rs (71%) create mode 100644 rust/cubeshared/src/lib.rs diff --git a/rust/cubeshared/.gitignore b/rust/cubeshared/.gitignore new file mode 100644 index 0000000000000..2a0a960cb1ec5 --- /dev/null +++ b/rust/cubeshared/.gitignore @@ -0,0 +1,3 @@ +/target +/.idea +.vscode diff --git a/rust/cubeshared/CHANGELOG.md b/rust/cubeshared/CHANGELOG.md new file mode 100644 index 0000000000000..f05ecfa971fe9 --- /dev/null +++ b/rust/cubeshared/CHANGELOG.md @@ -0,0 +1,2 @@ +# ChangeLog + diff --git a/rust/cubeshared/Cargo.lock b/rust/cubeshared/Cargo.lock new file mode 100644 index 0000000000000..e7d949fe75ccd --- /dev/null +++ b/rust/cubeshared/Cargo.lock @@ -0,0 +1,41 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cubeshared" +version = "0.1.0" +dependencies = [ + "flatbuffers", +] + +[[package]] +name = "flatbuffers" +version = "23.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" +dependencies = [ + "bitflags", + "rustc_version", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" diff --git a/rust/cubeshared/Cargo.toml b/rust/cubeshared/Cargo.toml new file mode 100644 index 0000000000000..b40a0b5739708 --- /dev/null +++ b/rust/cubeshared/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "cubeshared" +version = "0.1.0" +edition = "2021" + +[dependencies] +flatbuffers = "23.1.21" diff --git a/rust/cubeshared/flatbuffers-codegen.sh b/rust/cubeshared/flatbuffers-codegen.sh new file mode 100755 index 0000000000000..e0a62d0d507a5 --- /dev/null +++ b/rust/cubeshared/flatbuffers-codegen.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ./src/codegen || exit 1 +flatc --rust http_message.fbs diff --git a/rust/cubeshared/rust-toolchain.toml b/rust/cubeshared/rust-toolchain.toml new file mode 100644 index 0000000000000..040357e9b1d43 --- /dev/null +++ b/rust/cubeshared/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +#channel = "stable" +channel = "nightly-2024-07-15" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/rust/cubeshared/rustfmt.toml b/rust/cubeshared/rustfmt.toml new file mode 100644 index 0000000000000..d9ba5fdb90ba3 --- /dev/null +++ b/rust/cubeshared/rustfmt.toml @@ -0,0 +1 @@ +imports_granularity = "Crate" \ No newline at end of file diff --git a/rust/cubestore/cubestore/src/codegen/http_message.fbs b/rust/cubeshared/src/codegen/http_message.fbs similarity index 100% rename from rust/cubestore/cubestore/src/codegen/http_message.fbs rename to rust/cubeshared/src/codegen/http_message.fbs diff --git a/rust/cubestore/cubestore/src/codegen/http_message_generated.rs b/rust/cubeshared/src/codegen/http_message_generated.rs similarity index 100% rename from rust/cubestore/cubestore/src/codegen/http_message_generated.rs rename to rust/cubeshared/src/codegen/http_message_generated.rs diff --git a/rust/cubestore/cubestore/src/codegen/mod.rs b/rust/cubeshared/src/codegen/mod.rs similarity index 71% rename from rust/cubestore/cubestore/src/codegen/mod.rs rename to rust/cubeshared/src/codegen/mod.rs index 1b691689fb9aa..fa722ae71b1e7 100644 --- a/rust/cubestore/cubestore/src/codegen/mod.rs +++ b/rust/cubeshared/src/codegen/mod.rs @@ -1,3 +1,4 @@ +#[allow(unused_imports)] mod http_message_generated; pub use http_message_generated::*; diff --git a/rust/cubeshared/src/lib.rs b/rust/cubeshared/src/lib.rs new file mode 100644 index 0000000000000..24ccbddd82ed0 --- /dev/null +++ b/rust/cubeshared/src/lib.rs @@ -0,0 +1 @@ +pub mod codegen; diff --git a/rust/cubestore/Cargo.lock b/rust/cubestore/Cargo.lock index 89352f63787dc..c6c32d50505b0 100644 --- a/rust/cubestore/Cargo.lock +++ b/rust/cubestore/Cargo.lock @@ -1148,6 +1148,13 @@ dependencies = [ "syn 1.0.107", ] +[[package]] +name = "cubeshared" +version = "0.1.0" +dependencies = [ + "flatbuffers 23.1.21", +] + [[package]] name = "cubestore" version = "0.1.0" @@ -1173,6 +1180,7 @@ dependencies = [ "cubehll", "cuberockstore", "cuberpc", + "cubeshared", "cubezetasketch", "datafusion", "deadqueue", diff --git a/rust/cubestore/cubestore/Cargo.toml b/rust/cubestore/cubestore/Cargo.toml index 2e3dc5f5caf2b..3e54d4428f00c 100644 --- a/rust/cubestore/cubestore/Cargo.toml +++ b/rust/cubestore/cubestore/Cargo.toml @@ -27,6 +27,7 @@ cuberockstore = { path = "../cuberockstore" } cubehll = { path = "../cubehll" } cubezetasketch = { path = "../cubezetasketch" } cubedatasketches = { path = "../cubedatasketches" } +cubeshared = { path = "../../cubeshared" } cuberpc = { path = "../cuberpc" } datafusion = { git = "https://github.com/cube-js/arrow-datafusion", branch = "cube", features = ["default_nulls_last"] } csv = "1.1.3" diff --git a/rust/cubestore/cubestore/src/http/mod.rs b/rust/cubestore/cubestore/src/http/mod.rs index f627a1f5f067e..69dc028a570ff 100644 --- a/rust/cubestore/cubestore/src/http/mod.rs +++ b/rust/cubestore/cubestore/src/http/mod.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use warp::{Filter, Rejection, Reply}; -use crate::codegen::{ +use cubeshared::codegen::{ root_as_http_message, HttpColumnValue, HttpColumnValueArgs, HttpError, HttpErrorArgs, HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpResultSet, HttpResultSetArgs, HttpRow, HttpRowArgs, @@ -603,10 +603,10 @@ impl HttpMessage { let args = HttpMessageArgs { message_id: self.message_id, command_type: match self.command { - HttpCommand::Query { .. } => crate::codegen::HttpCommand::HttpQuery, - HttpCommand::ResultSet { .. } => crate::codegen::HttpCommand::HttpResultSet, + HttpCommand::Query { .. } => cubeshared::codegen::HttpCommand::HttpQuery, + HttpCommand::ResultSet { .. } => cubeshared::codegen::HttpCommand::HttpResultSet, HttpCommand::CloseConnection { .. } | HttpCommand::Error { .. } => { - crate::codegen::HttpCommand::HttpError + cubeshared::codegen::HttpCommand::HttpError } }, command: match &self.command { @@ -666,7 +666,7 @@ impl HttpMessage { .as_ref() .map(|c| builder.create_string(c)), }; - let message = crate::codegen::HttpMessage::create(&mut builder, &args); + let message = cubeshared::codegen::HttpMessage::create(&mut builder, &args); builder.finish(message, None); builder.finished_data().to_vec() // TODO copy } @@ -762,7 +762,7 @@ impl HttpMessage { message_id: http_message.message_id(), connection_id: http_message.connection_id().map(|s| s.to_string()), command: match http_message.command_type() { - crate::codegen::HttpCommand::HttpQuery => { + cubeshared::codegen::HttpCommand::HttpQuery => { let query = http_message.command_as_http_query().unwrap(); let mut inline_tables = Vec::new(); if let Some(query_inline_tables) = query.inline_tables() { @@ -809,7 +809,7 @@ impl HttpMessage { trace_obj: query.trace_obj().map(|q| q.to_string()), } } - crate::codegen::HttpCommand::HttpResultSet => { + cubeshared::codegen::HttpCommand::HttpResultSet => { let result_set = http_message.command_as_http_result_set().unwrap(); let mut result_rows = Vec::new(); if let Some(rows) = result_set.rows() { @@ -857,7 +857,7 @@ impl HttpMessage { #[cfg(test)] mod tests { - use crate::codegen::{HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpTable, HttpTableArgs}; + use cubeshared::codegen::{HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpTable, HttpTableArgs}; use crate::config::{init_test_logger, Config}; use crate::http::{HttpCommand, HttpMessage, HttpServer}; use crate::metastore::{Column, ColumnType}; @@ -973,11 +973,11 @@ mod tests { ); let args = HttpMessageArgs { message_id: 1234, - command_type: crate::codegen::HttpCommand::HttpQuery, + command_type: cubeshared::codegen::HttpCommand::HttpQuery, command: Some(query_value.as_union_value()), connection_id: Some(connection_id_offset), }; - let message = crate::codegen::HttpMessage::create(&mut builder, &args); + let message = cubeshared::codegen::HttpMessage::create(&mut builder, &args); builder.finish(message, None); let bytes = builder.finished_data().to_vec(); let message = HttpMessage::read(bytes).await.unwrap(); diff --git a/rust/cubestore/cubestore/src/lib.rs b/rust/cubestore/cubestore/src/lib.rs index 89ddb44e15599..05d24b86f0a14 100644 --- a/rust/cubestore/cubestore/src/lib.rs +++ b/rust/cubestore/cubestore/src/lib.rs @@ -38,7 +38,6 @@ use tokio::time::error::Elapsed; pub mod app_metrics; pub mod cachestore; pub mod cluster; -pub mod codegen; pub mod config; pub mod http; pub mod import; From ebb38a02a15a935f06afcabd61ef445420ece51d Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 15 Nov 2024 11:03:09 +0200 Subject: [PATCH 004/128] implement parse_cubestore_ws_result --- rust/cubeorchestrator/Cargo.lock | 3473 +---------------- rust/cubeorchestrator/Cargo.toml | 2 +- .../src/cubestore_message_parser.rs | 81 + rust/cubeorchestrator/src/lib.rs | 3 +- 4 files changed, 224 insertions(+), 3335 deletions(-) create mode 100644 rust/cubeorchestrator/src/cubestore_message_parser.rs diff --git a/rust/cubeorchestrator/Cargo.lock b/rust/cubeorchestrator/Cargo.lock index 95dfbec5b39f5..00c71b742b35a 100644 --- a/rust/cubeorchestrator/Cargo.lock +++ b/rust/cubeorchestrator/Cargo.lock @@ -4,3377 +4,266 @@ version = 3 [[package]] name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" - -[[package]] -name = "arc-swap" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" - -[[package]] -name = "arrayref" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" - -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "arrow" -version = "13.0.0" -source = "git+https://github.com/cube-js/arrow-rs.git?rev=a03d4eef5640e05dddf99fc2357ad6d58b5337cb#a03d4eef5640e05dddf99fc2357ad6d58b5337cb" -dependencies = [ - "bitflags 1.3.2", - "chrono", - "comfy-table 5.0.1", - "csv", - "flatbuffers", - "half", - "hex", - "indexmap 1.9.3", - "lazy_static", - "lexical-core", - "multiversion", - "num", - "rand", - "regex", - "regex-syntax 0.6.29", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "async-trait" -version = "0.1.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bigdecimal" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" -dependencies = [ - "autocfg", - "libm", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "blake3" -version = "1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 1.0.0", - "constant_time_eq", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "borsh" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" -dependencies = [ - "borsh-derive", - "cfg_aliases", -] - -[[package]] -name = "borsh-derive" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" -dependencies = [ - "once_cell", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.85", - "syn_derive", -] - -[[package]] -name = "brotli" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "2.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bstr" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "bytecheck" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" - -[[package]] -name = "cc" -version = "1.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets", -] - -[[package]] -name = "chrono-tz" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde" -dependencies = [ - "chrono", - "chrono-tz-build", - "phf", -] - -[[package]] -name = "chrono-tz-build" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c" -dependencies = [ - "parse-zoneinfo", - "phf", - "phf_codegen", -] - -[[package]] -name = "colored" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" -dependencies = [ - "is-terminal", - "lazy_static", - "winapi", -] - -[[package]] -name = "comfy-table" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b103d85ca6e209388771bfb7aa6b68a7aeec4afbf6f0a0264bfbf50360e5212e" -dependencies = [ - "strum 0.23.0", - "strum_macros 0.23.1", - "unicode-width", -] - -[[package]] -name = "comfy-table" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" -dependencies = [ - "crossterm", - "strum 0.26.3", - "strum_macros 0.26.4", - "unicode-width", -] - -[[package]] -name = "constant_time_eq" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cpufeatures" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crossterm" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" -dependencies = [ - "bitflags 2.6.0", - "crossterm_winapi", - "libc", - "parking_lot", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "csv" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" -dependencies = [ - "memchr", -] - -[[package]] -name = "cube-ext" -version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" -dependencies = [ - "arrow", - "chrono", - "datafusion-common", - "datafusion-expr", -] - -[[package]] -name = "cubeclient" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "log", - "reqwest", - "reqwest-middleware", - "serde", - "serde_derive", - "serde_json", - "tokio", - "url", - "uuid 1.11.0", -] - -[[package]] -name = "cubeorchestrator" -version = "0.1.0" -dependencies = [ - "cubesql", - "neon", -] - -[[package]] -name = "cubesql" -version = "0.28.0" -dependencies = [ - "anyhow", - "arc-swap", - "async-stream", - "async-trait", - "base64 0.13.1", - "bigdecimal", - "bincode", - "bitflags 1.3.2", - "byteorder", - "bytes", - "chrono", - "chrono-tz", - "comfy-table 7.1.1", - "csv", - "cubeclient", - "datafusion", - "egg", - "futures", - "futures-core", - "futures-util", - "hashbrown 0.14.5", - "indexmap 1.9.3", - "itertools", - "log", - "lru", - "minijinja", - "mockall", - "paste", - "pg-srv", - "postgres-types", - "rand", - "regex", - "rust_decimal", - "serde", - "serde_json", - "sha1_smol", - "sha2", - "simple_logger", - "smallvec", - "sqlparser", - "tera", - "thiserror", - "tokio", - "tokio-util", - "tracing", - "uuid 1.11.0", -] - -[[package]] -name = "datafusion" -version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" -dependencies = [ - "ahash 0.7.8", - "arrow", - "async-trait", - "chrono", - "datafusion-common", - "datafusion-data-access", - "datafusion-expr", - "datafusion-physical-expr", - "futures", - "hashbrown 0.12.3", - "itertools", - "lazy_static", - "log", - "num_cpus", - "ordered-float 2.10.1", - "parking_lot", - "parquet", - "paste", - "pin-project-lite", - "rand", - "smallvec", - "sqlparser", - "tempfile", - "tokio", - "tokio-stream", - "uuid 0.8.2", -] - -[[package]] -name = "datafusion-common" -version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" -dependencies = [ - "arrow", - "ordered-float 2.10.1", - "parquet", - "sqlparser", -] - -[[package]] -name = "datafusion-data-access" -version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" -dependencies = [ - "async-trait", - "chrono", - "futures", - "parking_lot", - "tempfile", - "tokio", -] - -[[package]] -name = "datafusion-expr" -version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" -dependencies = [ - "ahash 0.7.8", - "arrow", - "datafusion-common", - "sqlparser", -] - -[[package]] -name = "datafusion-physical-expr" -version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" -dependencies = [ - "ahash 0.7.8", - "arrow", - "blake2", - "blake3", - "chrono", - "cube-ext", - "datafusion-common", - "datafusion-expr", - "hashbrown 0.12.3", - "lazy_static", - "md-5", - "ordered-float 2.10.1", - "paste", - "rand", - "regex", - "sha2", - "unicode-segmentation", -] - -[[package]] -name = "difference" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "downcast" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb454f0228b18c7f4c3b0ebbee346ed9c52e7443b0999cd543ff3571205701d" - -[[package]] -name = "egg" -version = "0.9.5" -source = "git+https://github.com/cube-js/egg.git?rev=952f8c2a1033e5da097d23c523b0d8e392eb532b#952f8c2a1033e5da097d23c523b0d8e392eb532b" -dependencies = [ - "env_logger", - "fxhash", - "hashbrown 0.12.3", - "indexmap 1.9.3", - "instant", - "log", - "num-bigint", - "num-traits", - "saturating", - "smallvec", - "symbol_table", - "symbolic_expressions", - "thiserror", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "log", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fastrand" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" - -[[package]] -name = "flatbuffers" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b428b715fdbdd1c364b84573b5fdc0f84f8e423661b9f398735278bc7f2b6a" -dependencies = [ - "bitflags 1.3.2", - "smallvec", - "thiserror", -] - -[[package]] -name = "flate2" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "float-cmp" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4" -dependencies = [ - "num-traits", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fragile" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7464c5c4a3f014d9b2ec4073650e5c06596f385060af740fc45ad5a19f959e8" -dependencies = [ - "fragile 2.0.0", -] - -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "globset" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax 0.8.5", -] - -[[package]] -name = "globwalk" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" -dependencies = [ - "bitflags 2.6.0", - "ignore", - "walkdir", -] - -[[package]] -name = "half" -version = "1.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash 0.8.11", - "allocator-api2", -] - -[[package]] -name = "hashbrown" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" -dependencies = [ - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" - -[[package]] -name = "hyper" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" -dependencies = [ - "futures-util", - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", - "webpki-roots", -] - -[[package]] -name = "hyper-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "ignore" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" -dependencies = [ - "equivalent", - "hashbrown 0.15.0", -] - -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "integer-encoding" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48dc51180a9b377fd75814d0cc02199c20f8e99433d6762f650d39cdbbd3b56f" - -[[package]] -name = "ipnet" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" - -[[package]] -name = "is-terminal" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" -dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "lexical-core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" -dependencies = [ - "lexical-parse-float", - "lexical-parse-integer", - "lexical-util", - "lexical-write-float", - "lexical-write-integer", -] - -[[package]] -name = "lexical-parse-float" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" -dependencies = [ - "lexical-parse-integer", - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-parse-integer" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" -dependencies = [ - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-util" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" -dependencies = [ - "static_assertions", -] - -[[package]] -name = "lexical-write-float" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" -dependencies = [ - "lexical-util", - "lexical-write-integer", - "static_assertions", -] - -[[package]] -name = "lexical-write-integer" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" -dependencies = [ - "lexical-util", - "static_assertions", -] - -[[package]] -name = "libc" -version = "0.2.161" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" - -[[package]] -name = "libloading" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" -dependencies = [ - "cfg-if 1.0.0", - "windows-targets", -] - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "lru" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -dependencies = [ - "hashbrown 0.15.0", -] - -[[package]] -name = "lz4" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" -dependencies = [ - "lz4-sys", -] - -[[package]] -name = "lz4-sys" -version = "1.11.1+lz4-1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if 1.0.0", - "digest", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "memo-map" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mime_guess" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" -dependencies = [ - "mime", - "unicase", -] - -[[package]] -name = "minijinja" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e877d961d4f96ce13615862322df7c0b6d169d40cab71a7ef3f9b9e594451e" -dependencies = [ - "memo-map", - "self_cell", - "serde", - "serde_json", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi 0.3.9", - "libc", - "wasi", - "windows-sys 0.52.0", -] - -[[package]] -name = "mockall" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cabea45a7fc0e37093f4f30a5e2b62602253f91791c057d5f0470c63260c3d" -dependencies = [ - "cfg-if 0.1.10", - "downcast", - "fragile 1.2.2", - "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", -] - -[[package]] -name = "mockall_derive" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c461918bf7f59eefb1459252756bf2351a995d6bd510d0b2061bd86bcdabfa6" -dependencies = [ - "cfg-if 0.1.10", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "multiversion" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025c962a3dd3cc5e0e520aa9c612201d127dcdf28616974961a649dca64f5373" -dependencies = [ - "multiversion-macros", -] - -[[package]] -name = "multiversion-macros" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a3e2bde382ebf960c1f3e79689fa5941625fe9bf694a1cb64af3e85faff3af" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "neon" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d75440242411c87dc39847b0e33e961ec1f10326a9d8ecf9c1ea64a3b3c13dc" -dependencies = [ - "libloading", - "neon-macros", - "once_cell", - "semver", - "send_wrapper", - "smallvec", - "tokio", -] - -[[package]] -name = "neon-macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" -dependencies = [ - "quote", - "syn 2.0.85", - "syn-mid", -] - -[[package]] -name = "normalize-line-endings" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" - -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - -[[package]] -name = "object" -version = "0.36.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "ordered-float" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7" -dependencies = [ - "num-traits", -] - -[[package]] -name = "ordered-float" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" -dependencies = [ - "num-traits", -] - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "parquet" -version = "13.0.0" -source = "git+https://github.com/cube-js/arrow-rs.git?rev=a03d4eef5640e05dddf99fc2357ad6d58b5337cb#a03d4eef5640e05dddf99fc2357ad6d58b5337cb" -dependencies = [ - "arrow", - "base64 0.13.1", - "brotli", - "byteorder", - "chrono", - "flate2", - "lz4", - "num", - "num-bigint", - "parquet-format", - "rand", - "snap", - "thrift", - "zstd", -] - -[[package]] -name = "parquet-format" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f0c06cdcd5460967c485f9c40a821746f5955ad81990533c7fae95dbd9bc0b5" -dependencies = [ - "thrift", -] - -[[package]] -name = "parse-zoneinfo" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" -dependencies = [ - "regex", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pest" -version = "2.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "pest_meta" -version = "2.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "pg-srv" -version = "0.2.0" -dependencies = [ - "async-trait", - "byteorder", - "bytes", - "chrono", - "log", - "thiserror", - "tokio", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_codegen" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", - "uncased", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - -[[package]] -name = "postgres-protocol" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acda0ebdebc28befa84bee35e651e4c5f09073d668c7aed4cf7e23c3cda84b23" -dependencies = [ - "base64 0.22.1", - "byteorder", - "bytes", - "fallible-iterator", - "hmac", - "md-5", - "memchr", - "rand", - "sha2", - "stringprep", -] - -[[package]] -name = "postgres-types" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f66ea23a2d0e5734297357705193335e0a957696f34bed2f2faefacb2fec336f" -dependencies = [ - "bytes", - "fallible-iterator", - "postgres-protocol", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "predicates" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df" -dependencies = [ - "difference", - "float-cmp", - "normalize-line-endings", - "predicates-core", - "regex", -] - -[[package]] -name = "predicates-core" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" - -[[package]] -name = "predicates-tree" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" -dependencies = [ - "predicates-core", - "termtree", -] - -[[package]] -name = "proc-macro-crate" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" -dependencies = [ - "toml_edit", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "quinn" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls", - "socket2", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "quinn-proto" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" -dependencies = [ - "bytes", - "rand", - "ring", - "rustc-hash", - "rustls", - "slab", - "thiserror", - "tinyvec", - "tracing", -] - -[[package]] -name = "quinn-udp" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" -dependencies = [ - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rend" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" -dependencies = [ - "bytecheck", -] - -[[package]] -name = "reqwest" -version = "0.12.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" -dependencies = [ - "base64 0.22.1", - "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "mime_guess", - "once_cell", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pemfile", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "windows-registry", -] - -[[package]] -name = "reqwest-middleware" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" -dependencies = [ - "anyhow", - "async-trait", - "http", - "reqwest", - "serde", - "thiserror", - "tower-service", -] - -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if 1.0.0", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - -[[package]] -name = "rkyv" -version = "0.7.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" -dependencies = [ - "bitvec", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid 1.11.0", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "rust_decimal" -version = "1.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" -dependencies = [ - "arrayvec", - "borsh", - "bytes", - "num-traits", - "postgres-types", - "rand", - "rkyv", - "serde", - "serde_json", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hash" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" - -[[package]] -name = "rustix" -version = "0.38.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustls" -version = "0.23.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" -dependencies = [ - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" - -[[package]] -name = "rustls-webpki" -version = "0.102.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - -[[package]] -name = "rustversion" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "saturating" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "self_cell" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" - -[[package]] -name = "serde" -version = "1.0.213" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.213" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "serde_json" -version = "1.0.132" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" -dependencies = [ - "indexmap 2.6.0", - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha1_smol" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - -[[package]] -name = "simple_logger" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7de33c687404ec3045d4a0d437580455257c0436f858d702f244e7d652f9f07" -dependencies = [ - "atty", - "chrono", - "colored", - "log", - "winapi", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "snap" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" - -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "sqlparser" -version = "0.16.0" -source = "git+https://github.com/cube-js/sqlparser-rs.git?rev=6a54d27d3b75a04b9f9cbe309a83078aa54b32fd#6a54d27d3b75a04b9f9cbe309a83078aa54b32fd" -dependencies = [ - "log", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stringprep" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" -dependencies = [ - "unicode-bidi", - "unicode-normalization", - "unicode-properties", -] - -[[package]] -name = "strum" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" - -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" - -[[package]] -name = "strum_macros" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "rustversion", - "syn 1.0.109", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.85", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "symbol_table" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bf088d1d7df2b2b6711b06da3471bc86677383c57b27251e18c56df8deac14" -dependencies = [ - "ahash 0.7.8", - "hashbrown 0.12.3", -] - -[[package]] -name = "symbolic_expressions" -version = "5.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c68d531d83ec6c531150584c42a4290911964d5f0d79132b193b67252a23b71" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn-mid" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" -dependencies = [ - "futures-core", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tempfile" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" -dependencies = [ - "cfg-if 1.0.0", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "tera" -version = "1.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9d851b45e865f178319da0abdbfe6acbc4328759ff18dafc3a41c16b4cd2ee" -dependencies = [ - "globwalk", - "lazy_static", - "pest", - "pest_derive", - "regex", - "serde", - "serde_json", - "unic-segment", -] - -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - -[[package]] -name = "thiserror" -version = "1.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "thrift" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6d965454947cc7266d22716ebfd07b18d84ebaf35eec558586bbb2a8cb6b5b" -dependencies = [ - "byteorder", - "integer-encoding", - "log", - "ordered-float 1.1.1", - "threadpool", -] - -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "tracing", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-macros" -version = "2.4.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", + "gimli", ] [[package]] -name = "tokio-rustls" -version = "0.26.0" +name = "adler" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls", - "rustls-pki-types", - "tokio", -] +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "tokio-stream" -version = "0.1.16" +name = "autocfg" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "tokio-util" -version = "0.7.12" +name = "backtrace" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" dependencies = [ - "bytes", - "futures-core", - "futures-io", - "futures-sink", - "pin-project-lite", - "tokio", + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", ] [[package]] -name = "toml_datetime" -version = "0.6.8" +name = "bitflags" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "toml_edit" -version = "0.22.22" +name = "cc" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap 2.6.0", - "toml_datetime", - "winnow", -] +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" [[package]] -name = "tower-service" -version = "0.3.3" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +name = "cubeorchestrator" +version = "0.1.0" dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", + "cubeshared", + "neon", ] [[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +name = "cubeshared" +version = "0.1.0" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", + "flatbuffers", ] [[package]] -name = "tracing-core" -version = "0.1.32" +name = "flatbuffers" +version = "23.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" dependencies = [ - "once_cell", + "bitflags", + "rustc_version", ] [[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.7" +name = "gimli" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" +checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" [[package]] -name = "uncased" -version = "0.9.10" +name = "libc" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] -name = "unic-char-property" -version = "0.9.0" +name = "libloading" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ - "unic-char-range", + "cfg-if", + "windows-targets", ] [[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" +name = "memchr" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" [[package]] -name = "unic-segment" -version = "0.9.0" +name = "miniz_oxide" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ - "unic-ucd-segment", + "adler", + "autocfg", ] [[package]] -name = "unic-ucd-segment" -version = "0.9.0" +name = "neon" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" +checksum = "7d75440242411c87dc39847b0e33e961ec1f10326a9d8ecf9c1ea64a3b3c13dc" dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", + "libloading", + "neon-macros", + "once_cell", + "semver", + "send_wrapper", + "smallvec", + "tokio", ] [[package]] -name = "unic-ucd-version" -version = "0.9.0" +name = "neon-macros" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" dependencies = [ - "unic-common", + "quote", + "syn", + "syn-mid", ] [[package]] -name = "unicase" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" - -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - -[[package]] -name = "unicode-ident" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" - -[[package]] -name = "unicode-normalization" -version = "0.1.24" +name = "object" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +checksum = "c55827317fb4c08822499848a14237d2874d6f139828893017237e7ab93eb386" dependencies = [ - "tinyvec", + "memchr", ] [[package]] -name = "unicode-properties" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" - -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "untrusted" -version = "0.9.0" +name = "once_cell" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "url" -version = "2.5.2" +name = "pin-project-lite" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] -name = "uuid" -version = "0.8.2" +name = "proc-macro2" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ - "getrandom", + "unicode-ident", ] [[package]] -name = "uuid" -version = "1.11.0" +name = "quote" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ - "getrandom", - "serde", + "proc-macro2", ] [[package]] -name = "version_check" -version = "0.9.5" +name = "rustc-demangle" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" [[package]] -name = "walkdir" -version = "2.5.0" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "same-file", - "winapi-util", + "semver", ] [[package]] -name = "want" -version = "0.3.1" +name = "semver" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "send_wrapper" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] -name = "wasm-bindgen" -version = "0.2.95" +name = "smallvec" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "wasm-bindgen-macro", -] +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] -name = "wasm-bindgen-backend" -version = "0.2.95" +name = "syn" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ - "bumpalo", - "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.85", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "unicode-ident", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.95" +name = "syn-mid" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" - -[[package]] -name = "web-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "0.26.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-registry" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" -dependencies = [ - "windows-result", - "windows-strings", - "windows-targets", -] - -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-strings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result", - "windows-targets", + "syn", ] [[package]] -name = "windows-sys" -version = "0.52.0" +name = "tokio" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ - "windows-targets", + "backtrace", + "pin-project-lite", ] [[package]] -name = "windows-sys" -version = "0.59.0" +name = "unicode-ident" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", - "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -3383,122 +272,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.85", -] - -[[package]] -name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", -] +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml index 38d2f9b5d39e9..3a6fbdf5e1484 100644 --- a/rust/cubeorchestrator/Cargo.toml +++ b/rust/cubeorchestrator/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -cubesql = { path = "../cubesql/cubesql" } +cubeshared = { path = "../cubeshared" } [dependencies.neon] version = "=1" diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs new file mode 100644 index 0000000000000..31fd4bbe4ff34 --- /dev/null +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -0,0 +1,81 @@ +use cubeshared::codegen::{root_as_http_message, HttpCommand}; +use std::collections::HashMap; + +#[derive(Debug)] +pub enum ParseError { + UnsupportedCommand, + EmptyResultSet, + NullRow, + ColumnValueMissed, + ColumnNameNotDefined, + FlatBufferError, + ErrorMessage(String), +} + +impl std::fmt::Display for ParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ParseError::UnsupportedCommand => write!(f, "Unsupported command"), + ParseError::EmptyResultSet => write!(f, "Empty resultSet"), + ParseError::NullRow => write!(f, "Null row"), + ParseError::ColumnValueMissed => write!(f, "Column value missed"), + ParseError::ColumnNameNotDefined => write!(f, "Column name is not defined"), + ParseError::FlatBufferError => write!(f, "FlatBuffer parsing error"), + ParseError::ErrorMessage(msg) => write!(f, "Error: {}", msg), + } + } +} + +impl std::error::Error for ParseError {} + +pub fn parse_cubestore_ws_result( + msg_data: Vec, +) -> Result>, ParseError> { + let http_message = + root_as_http_message(msg_data.as_slice()).map_err(|_| ParseError::FlatBufferError)?; + + let command_type = http_message.command_type(); + + match command_type { + HttpCommand::HttpError => { + let http_error = http_message + .command_as_http_error() + .ok_or(ParseError::FlatBufferError)?; + let error_message = http_error.error().unwrap_or("Unknown error").to_string(); + Err(ParseError::ErrorMessage(error_message)) + } + HttpCommand::HttpResultSet => { + let result_set = http_message + .command_as_http_result_set() + .ok_or(ParseError::EmptyResultSet)?; + + let result_set_columns = result_set.columns().ok_or(ParseError::EmptyResultSet)?; + let mut columns = Vec::with_capacity(result_set_columns.len()); + + for column in result_set_columns.iter() { + if column.is_empty() { + return Err(ParseError::ColumnNameNotDefined); + } + columns.push(column.to_string()); + } + + let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; + let mut result = Vec::with_capacity(result_set_rows.len()); + + for row in result_set_rows.iter() { + let values = row.values().ok_or(ParseError::NullRow)?; + let mut row_obj = HashMap::new(); + + for (i, val) in values.iter().enumerate() { + let value = val.string_value().ok_or(ParseError::ColumnValueMissed)?; + row_obj.insert(columns[i].clone(), value.to_string()); + } + + result.push(row_obj); + } + + Ok(result) + } + _ => Err(ParseError::UnsupportedCommand), + } +} diff --git a/rust/cubeorchestrator/src/lib.rs b/rust/cubeorchestrator/src/lib.rs index 40031d8d4122d..252a6a548c360 100644 --- a/rust/cubeorchestrator/src/lib.rs +++ b/rust/cubeorchestrator/src/lib.rs @@ -1,2 +1 @@ -pub use cubesql::CubeError; - +pub mod cubestore_message_parser; From 6ecef1ece7ad089d30eab9639c8799ca36ab27a1 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 15 Nov 2024 20:49:29 +0200 Subject: [PATCH 005/128] add cubeorchestrator/parse_cubestore_ws_result_message export --- packages/cubejs-backend-native/Cargo.lock | 37 ++++++++++++++++++- packages/cubejs-backend-native/Cargo.toml | 3 +- packages/cubejs-backend-native/js/index.ts | 8 ++++ .../cubejs-backend-native/src/node_export.rs | 31 ++++++++++++++++ 4 files changed, 77 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index 1ec0fc189e2b5..64736453ec854 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -128,7 +128,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers", + "flatbuffers 2.1.2", "half", "hex", "indexmap 1.9.3", @@ -738,6 +738,7 @@ dependencies = [ "bytes", "convert_case", "cubenativeutils", + "cubeorchestrator", "cubesql", "cubesqlplanner", "findshlibs", @@ -779,6 +780,21 @@ dependencies = [ "uuid 0.8.2", ] +[[package]] +name = "cubeorchestrator" +version = "0.1.0" +dependencies = [ + "cubeshared", + "neon", +] + +[[package]] +name = "cubeshared" +version = "0.1.0" +dependencies = [ + "flatbuffers 23.5.26", +] + [[package]] name = "cubesql" version = "0.28.0" @@ -1089,6 +1105,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "flatbuffers" +version = "23.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" +dependencies = [ + "bitflags 1.3.2", + "rustc_version", +] + [[package]] name = "flate2" version = "1.0.28" @@ -2775,6 +2801,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.28" diff --git a/packages/cubejs-backend-native/Cargo.toml b/packages/cubejs-backend-native/Cargo.toml index 3c3666761e1e9..debb2bea8dc84 100644 --- a/packages/cubejs-backend-native/Cargo.toml +++ b/packages/cubejs-backend-native/Cargo.toml @@ -16,7 +16,8 @@ opt-level = 1 crate-type = ["cdylib", "lib"] [dependencies] -cubesqlplanner = { path = "../../rust/cubesqlplanner/cubesqlplanner/" } +cubesqlplanner = { path = "../../rust/cubesqlplanner/cubesqlplanner" } +cubeorchestrator = { path = "../../rust/cubeorchestrator" } cubenativeutils = { path = "../../rust/cubenativeutils" } async-channel = { version = "2" } async-trait = "0.1.36" diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 779195ccfa8f5..fb120be7c99a5 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -348,6 +348,14 @@ export const buildSqlAndParams = (cubeEvaluator: any): String => { return native.buildSqlAndParams(cubeEvaluator); }; +export type ResultRow = Record; + +export const parseCubestoreResultMessage = (message: ArrayBuffer): ResultRow[] => { + const native = loadNative(); + + return native.parseCubestoreResultMessage(message); +}; + export interface PyConfiguration { repositoryFactory?: (ctx: unknown) => Promise, logger?: (msg: string, params: Record) => void, diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 53464958d20b2..52a03b175ccd1 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -32,9 +32,12 @@ use cubenativeutils::wrappers::NativeContextHolder; use cubesqlplanner::cube_bridge::base_query_options::NativeBaseQueryOptions; use cubesqlplanner::planner::base_query::BaseQuery; +use cubeorchestrator::cubestore_message_parser::parse_cubestore_ws_result; + use cubesql::{telemetry::ReportingLogger, CubeError}; use neon::prelude::*; +use neon::types::buffer::TypedArray; struct SQLInterface { services: Arc, @@ -503,6 +506,30 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { arg_clrep.into_js(&mut cx) } +//============ sql orchestrator =================== + +fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { + let msg = cx.argument::(0)?; + let msg_data = msg.as_slice(&cx); + match parse_cubestore_ws_result(msg_data.to_vec()) { + Ok(result) => { + let js_array = JsArray::new(&mut cx, result.len()); + for (i, row) in result.into_iter().enumerate() { + let js_row = JsObject::new(&mut cx); + for (key, value) in row { + let js_key = cx.string(key); + let js_value = cx.string(value); + js_row.set(&mut cx, js_key, js_value)?; + } + js_array.set(&mut cx, i as u32, js_row)?; + } + Ok(js_array.upcast()) + } + Err(err) => cx.throw_error(err.to_string()), + } +} + + pub fn register_module_exports( mut cx: ModuleContext, ) -> NeonResult<()> { @@ -513,8 +540,12 @@ pub fn register_module_exports( cx.export_function("isFallbackBuild", is_fallback_build)?; cx.export_function("__js_to_clrepr_to_js", debug_js_to_clrepr_to_js)?; + //============ sql planner exports =================== cx.export_function("buildSqlAndParams", build_sql_and_params)?; + //========= sql orchestrator exports ================= + cx.export_function("parseCubestoreResultMessage", parse_cubestore_ws_result_message)?; + crate::template::template_register_module(&mut cx)?; #[cfg(feature = "python")] From dcc29ea8748b1c421214ae03c37d5ed3365e4efb Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 15 Nov 2024 20:52:06 +0200 Subject: [PATCH 006/128] use native parseCubestoreResultMessage --- packages/cubejs-cubestore-driver/package.json | 1 + .../src/WebSocketConnection.ts | 49 +++---------------- 2 files changed, 9 insertions(+), 41 deletions(-) diff --git a/packages/cubejs-cubestore-driver/package.json b/packages/cubejs-cubestore-driver/package.json index c4ffa68063194..8722abaca23c8 100644 --- a/packages/cubejs-cubestore-driver/package.json +++ b/packages/cubejs-cubestore-driver/package.json @@ -29,6 +29,7 @@ "@cubejs-backend/base-driver": "1.1.12", "@cubejs-backend/cubestore": "1.1.12", "@cubejs-backend/shared": "1.1.12", + "@cubejs-backend/native": "1.1.12", "csv-write-stream": "^2.0.0", "flatbuffers": "23.3.3", "fs-extra": "^9.1.0", diff --git a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts index 92da79e88ca2d..646ebfd98560a 100644 --- a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts +++ b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts @@ -1,14 +1,13 @@ import WebSocket from 'ws'; import * as flatbuffers from 'flatbuffers'; +import { v4 as uuidv4 } from 'uuid'; import { InlineTable } from '@cubejs-backend/base-driver'; import { getEnv } from '@cubejs-backend/shared'; -import { v4 as uuidv4 } from 'uuid'; +import { parseCubestoreResultMessage } from '@cubejs-backend/native'; import { HttpCommand, - HttpError, HttpMessage, HttpQuery, - HttpResultSet, HttpTable } from '../codegen'; @@ -116,44 +115,12 @@ export class WebSocketConnection { if (!resolvers) { throw new Error(`Cube Store missed message id: ${httpMessage.messageId()}`); // logging } - const commandType = httpMessage.commandType(); - if (commandType === HttpCommand.HttpError) { - resolvers.reject(new Error(`${httpMessage.command(new HttpError())?.error()}`)); - } else if (commandType === HttpCommand.HttpResultSet) { - const resultSet = httpMessage.command(new HttpResultSet()); - if (!resultSet) { - resolvers.reject(new Error('Empty resultSet')); - return; - } - const columnsLen = resultSet.columnsLength(); - const columns: Array = []; - for (let i = 0; i < columnsLen; i++) { - const columnName = resultSet.columns(i); - if (!columnName) { - resolvers.reject(new Error('Column name is not defined')); - return; - } - columns.push(columnName); - } - const rowLen = resultSet.rowsLength(); - const result: any[] = []; - for (let i = 0; i < rowLen; i++) { - const row = resultSet.rows(i); - if (!row) { - resolvers.reject(new Error('Null row')); - return; - } - const valueLen = row.valuesLength(); - const rowObj = {}; - for (let j = 0; j < valueLen; j++) { - const value = row.values(j); - rowObj[columns[j]] = value?.stringValue(); - } - result.push(rowObj); - } - resolvers.resolve(result); - } else { - resolvers.reject(new Error('Unsupported command')); + + try { + const nativeResMsg = parseCubestoreResultMessage(msg); + resolvers.resolve(nativeResMsg); + } catch (e) { + resolvers.reject(e); } }); }); From 9a9a214d197498e2d6304bf2a9ba2f3d035cf6d6 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 15 Nov 2024 22:56:28 +0200 Subject: [PATCH 007/128] init hashmap with capacity --- rust/cubeorchestrator/src/cubestore_message_parser.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 31fd4bbe4ff34..3bd00388fce98 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -50,7 +50,8 @@ pub fn parse_cubestore_ws_result( .ok_or(ParseError::EmptyResultSet)?; let result_set_columns = result_set.columns().ok_or(ParseError::EmptyResultSet)?; - let mut columns = Vec::with_capacity(result_set_columns.len()); + let columns_len = result_set_columns.len(); + let mut columns = Vec::with_capacity(columns_len); for column in result_set_columns.iter() { if column.is_empty() { @@ -64,7 +65,7 @@ pub fn parse_cubestore_ws_result( for row in result_set_rows.iter() { let values = row.values().ok_or(ParseError::NullRow)?; - let mut row_obj = HashMap::new(); + let mut row_obj = HashMap::with_capacity(columns_len); for (i, val) in values.iter().enumerate() { let value = val.string_value().ok_or(ParseError::ColumnValueMissed)?; From 7abab9c828df35faee7103f6c433ae5f2720b7c2 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 15 Nov 2024 23:01:00 +0200 Subject: [PATCH 008/128] cargo fmt --- packages/cubejs-backend-native/src/node_export.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 52a03b175ccd1..cb9ffe0469aaf 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -529,7 +529,6 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult( mut cx: ModuleContext, ) -> NeonResult<()> { @@ -544,7 +543,10 @@ pub fn register_module_exports( cx.export_function("buildSqlAndParams", build_sql_and_params)?; //========= sql orchestrator exports ================= - cx.export_function("parseCubestoreResultMessage", parse_cubestore_ws_result_message)?; + cx.export_function( + "parseCubestoreResultMessage", + parse_cubestore_ws_result_message, + )?; crate::template::template_register_module(&mut cx)?; From 069399051861497ca5787344376c5da248aef4a4 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Sat, 16 Nov 2024 00:35:47 +0200 Subject: [PATCH 009/128] =?UTF-8?q?some=20optimizations=20and=C2=A0improve?= =?UTF-8?q?ments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/src/node_export.rs | 8 ++++---- rust/cubeorchestrator/rustfmt.toml | 2 +- rust/cubeorchestrator/src/cubestore_message_parser.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index cb9ffe0469aaf..c77debe2ae9e2 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -511,14 +511,14 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { let msg = cx.argument::(0)?; let msg_data = msg.as_slice(&cx); - match parse_cubestore_ws_result(msg_data.to_vec()) { + match parse_cubestore_ws_result(msg_data) { Ok(result) => { let js_array = JsArray::new(&mut cx, result.len()); for (i, row) in result.into_iter().enumerate() { let js_row = JsObject::new(&mut cx); - for (key, value) in row { - let js_key = cx.string(key); - let js_value = cx.string(value); + for (key, value) in row.into_iter() { + let js_key = cx.string(&key); + let js_value = cx.string(&value); js_row.set(&mut cx, js_key, js_value)?; } js_array.set(&mut cx, i as u32, js_row)?; diff --git a/rust/cubeorchestrator/rustfmt.toml b/rust/cubeorchestrator/rustfmt.toml index d9ba5fdb90ba3..c3c8c37533810 100644 --- a/rust/cubeorchestrator/rustfmt.toml +++ b/rust/cubeorchestrator/rustfmt.toml @@ -1 +1 @@ -imports_granularity = "Crate" \ No newline at end of file +imports_granularity = "Crate" diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 3bd00388fce98..dd712888b99d6 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -29,10 +29,10 @@ impl std::fmt::Display for ParseError { impl std::error::Error for ParseError {} pub fn parse_cubestore_ws_result( - msg_data: Vec, + msg_data: &[u8], ) -> Result>, ParseError> { let http_message = - root_as_http_message(msg_data.as_slice()).map_err(|_| ParseError::FlatBufferError)?; + root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; let command_type = http_message.command_type(); From d6879cd0a5ab1bf391f34d17dfa431a604edcede Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 18 Nov 2024 12:22:55 +0200 Subject: [PATCH 010/128] a bit optimized version --- packages/cubejs-backend-native/src/node_export.rs | 8 ++++---- rust/cubeorchestrator/src/cubestore_message_parser.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index c77debe2ae9e2..5752949afb799 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -510,15 +510,15 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { let msg = cx.argument::(0)?; - let msg_data = msg.as_slice(&cx); - match parse_cubestore_ws_result(msg_data) { + let msg_data = msg.as_slice(&cx).to_vec(); + match parse_cubestore_ws_result(&*msg_data) { Ok(result) => { let js_array = JsArray::new(&mut cx, result.len()); for (i, row) in result.into_iter().enumerate() { let js_row = JsObject::new(&mut cx); for (key, value) in row.into_iter() { - let js_key = cx.string(&key); - let js_value = cx.string(&value); + let js_key = cx.string(key); + let js_value = cx.string(value); js_row.set(&mut cx, js_key, js_value)?; } js_array.set(&mut cx, i as u32, js_row)?; diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index dd712888b99d6..99578f905b1e0 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -30,7 +30,7 @@ impl std::error::Error for ParseError {} pub fn parse_cubestore_ws_result( msg_data: &[u8], -) -> Result>, ParseError> { +) -> Result>, ParseError> { let http_message = root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; @@ -57,7 +57,7 @@ pub fn parse_cubestore_ws_result( if column.is_empty() { return Err(ParseError::ColumnNameNotDefined); } - columns.push(column.to_string()); + columns.push(column); } let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; @@ -69,7 +69,7 @@ pub fn parse_cubestore_ws_result( for (i, val) in values.iter().enumerate() { let value = val.string_value().ok_or(ParseError::ColumnValueMissed)?; - row_obj.insert(columns[i].clone(), value.to_string()); + row_obj.insert(columns[i], value); } result.push(row_obj); From ab8f85aae86272e782546d9da9784d53e74808a9 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 18 Nov 2024 12:44:48 +0200 Subject: [PATCH 011/128] =?UTF-8?q?use=20cx.execute=5Fscoped=20for=C2=A0op?= =?UTF-8?q?timization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cubejs-backend-native/src/node_export.rs | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 5752949afb799..9fa8650c6d69b 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -513,16 +513,26 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { - let js_array = JsArray::new(&mut cx, result.len()); - for (i, row) in result.into_iter().enumerate() { - let js_row = JsObject::new(&mut cx); - for (key, value) in row.into_iter() { - let js_key = cx.string(key); - let js_value = cx.string(value); - js_row.set(&mut cx, js_key, js_value)?; + let js_array = cx.execute_scoped(|mut cx| { + let js_array = JsArray::new(&mut cx, result.len()); + + for (i, row) in result.into_iter().enumerate() { + let js_row = cx.execute_scoped(|mut cx| { + let js_row = JsObject::new(&mut cx); + for (key, value) in row.into_iter() { + let js_key = cx.string(key); + let js_value = cx.string(value); + js_row.set(&mut cx, js_key, js_value)?; + } + Ok(js_row) + })?; + + js_array.set(&mut cx, i as u32, js_row)?; } - js_array.set(&mut cx, i as u32, js_row)?; - } + + Ok(js_array) + })?; + Ok(js_array.upcast()) } Err(err) => cx.throw_error(err.to_string()), From 2424c65aa0150247f89edf4c8e3d9d013874fc98 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 18 Nov 2024 20:41:14 +0200 Subject: [PATCH 012/128] a bit more rust idiomatic code --- .../src/cubestore_message_parser.rs | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 99578f905b1e0..d9c3d77b30275 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -6,7 +6,6 @@ pub enum ParseError { UnsupportedCommand, EmptyResultSet, NullRow, - ColumnValueMissed, ColumnNameNotDefined, FlatBufferError, ErrorMessage(String), @@ -18,7 +17,6 @@ impl std::fmt::Display for ParseError { ParseError::UnsupportedCommand => write!(f, "Unsupported command"), ParseError::EmptyResultSet => write!(f, "Empty resultSet"), ParseError::NullRow => write!(f, "Null row"), - ParseError::ColumnValueMissed => write!(f, "Column value missed"), ParseError::ColumnNameNotDefined => write!(f, "Column name is not defined"), ParseError::FlatBufferError => write!(f, "FlatBuffer parsing error"), ParseError::ErrorMessage(msg) => write!(f, "Error: {}", msg), @@ -50,14 +48,9 @@ pub fn parse_cubestore_ws_result( .ok_or(ParseError::EmptyResultSet)?; let result_set_columns = result_set.columns().ok_or(ParseError::EmptyResultSet)?; - let columns_len = result_set_columns.len(); - let mut columns = Vec::with_capacity(columns_len); - for column in result_set_columns.iter() { - if column.is_empty() { - return Err(ParseError::ColumnNameNotDefined); - } - columns.push(column); + if result_set_columns.iter().any(|c| c.is_empty()) { + return Err(ParseError::ColumnNameNotDefined); } let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; @@ -65,12 +58,14 @@ pub fn parse_cubestore_ws_result( for row in result_set_rows.iter() { let values = row.values().ok_or(ParseError::NullRow)?; - let mut row_obj = HashMap::with_capacity(columns_len); - - for (i, val) in values.iter().enumerate() { - let value = val.string_value().ok_or(ParseError::ColumnValueMissed)?; - row_obj.insert(columns[i], value); - } + let row_obj: HashMap<_, _> = result_set_columns + .iter() + .zip(values.iter()) + .map(|(col, val)| { + let value = val.string_value().unwrap_or(""); + (col, value) + }) + .collect(); result.push(row_obj); } From 8ab592e03e436d64e647ad272c7e2bfec4491d22 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 20 Nov 2024 13:26:52 +0200 Subject: [PATCH 013/128] =?UTF-8?q?put=20native=20parseCubestoreResultMess?= =?UTF-8?q?age=20behind=20the=C2=A0flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-shared/src/env.ts | 3 + .../src/WebSocketConnection.ts | 59 +++++++++++++++++-- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/packages/cubejs-backend-shared/src/env.ts b/packages/cubejs-backend-shared/src/env.ts index 3d5a2c0e2e81c..e9bdf2acdbeea 100644 --- a/packages/cubejs-backend-shared/src/env.ts +++ b/packages/cubejs-backend-shared/src/env.ts @@ -193,6 +193,9 @@ const variables: Record any> = { .default('1') .asInt(), nativeSqlPlanner: () => get('CUBEJS_TESSERACT_SQL_PLANNER').asBool(), + nativeOrchestrator: () => get('CUBEJS_TESSERACT_ORCHESTRATOR') + .default('false') + .asBoolStrict(), /** **************************************************************** * Common db options * diff --git a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts index 646ebfd98560a..7095c0eda1aa7 100644 --- a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts +++ b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts @@ -6,8 +6,10 @@ import { getEnv } from '@cubejs-backend/shared'; import { parseCubestoreResultMessage } from '@cubejs-backend/native'; import { HttpCommand, + HttpError, HttpMessage, HttpQuery, + HttpResultSet, HttpTable } from '../codegen'; @@ -116,11 +118,58 @@ export class WebSocketConnection { throw new Error(`Cube Store missed message id: ${httpMessage.messageId()}`); // logging } - try { - const nativeResMsg = parseCubestoreResultMessage(msg); - resolvers.resolve(nativeResMsg); - } catch (e) { - resolvers.reject(e); + if (getEnv('nativeOrchestrator')) { + try { + const nativeResMsg = parseCubestoreResultMessage(msg); + resolvers.resolve(nativeResMsg); + } catch (e) { + resolvers.reject(e); + } + } else { + const commandType = httpMessage.commandType(); + + if (commandType === HttpCommand.HttpError) { + resolvers.reject(new Error(`${httpMessage.command(new HttpError())?.error()}`)); + } else if (commandType === HttpCommand.HttpResultSet) { + const resultSet = httpMessage.command(new HttpResultSet()); + + if (!resultSet) { + resolvers.reject(new Error('Empty resultSet')); + return; + } + + const columnsLen = resultSet.columnsLength(); + const columns: Array = []; + for (let i = 0; i < columnsLen; i++) { + const columnName = resultSet.columns(i); + if (!columnName) { + resolvers.reject(new Error('Column name is not defined')); + return; + } + columns.push(columnName); + } + + const rowLen = resultSet.rowsLength(); + const result: any[] = []; + for (let i = 0; i < rowLen; i++) { + const row = resultSet.rows(i); + if (!row) { + resolvers.reject(new Error('Null row')); + return; + } + const valueLen = row.valuesLength(); + const rowObj = {}; + for (let j = 0; j < valueLen; j++) { + const value = row.values(j); + rowObj[columns[j]] = value?.stringValue(); + } + result.push(rowObj); + } + + resolvers.resolve(result); + } else { + resolvers.reject(new Error('Unsupported command')); + } } }); }); From 85ef505751b7443dd624f7e336efc9e7967968e8 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 21 Nov 2024 12:33:22 +0200 Subject: [PATCH 014/128] tiny improvement --- packages/cubejs-backend-native/src/node_export.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 9fa8650c6d69b..6a1fc9f28245e 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -520,9 +520,8 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult Date: Mon, 25 Nov 2024 15:13:49 +0200 Subject: [PATCH 015/128] cargo fmt --- rust/cubenativeutils/src/wrappers/context.rs | 3 +-- .../src/wrappers/inner_types.rs | 10 ++++--- .../src/wrappers/neon/context.rs | 27 ++++++++++--------- .../src/wrappers/neon/inner_types.rs | 13 ++++----- .../src/wrappers/neon/object/mod.rs | 13 ++++----- .../src/wrappers/neon/object/neon_array.rs | 8 +++--- .../src/wrappers/neon/object/neon_function.rs | 8 +++--- .../src/wrappers/neon/object/neon_struct.rs | 8 +++--- rust/cubenativeutils/src/wrappers/object.rs | 3 +-- .../src/wrappers/object_handle.rs | 3 +-- .../src/wrappers/serializer/deserialize.rs | 7 ++--- .../src/wrappers/serializer/deserializer.rs | 17 ++++++------ .../src/wrappers/serializer/error.rs | 3 +-- .../src/wrappers/serializer/serialize.rs | 7 ++--- .../src/wrappers/serializer/serializer.rs | 7 ++--- 15 files changed, 75 insertions(+), 62 deletions(-) diff --git a/rust/cubenativeutils/src/wrappers/context.rs b/rust/cubenativeutils/src/wrappers/context.rs index ba880a17eff6a..98bb3ba6f7eb9 100644 --- a/rust/cubenativeutils/src/wrappers/context.rs +++ b/rust/cubenativeutils/src/wrappers/context.rs @@ -1,5 +1,4 @@ -use super::inner_types::InnerTypes; -use super::object_handle::NativeObjectHandle; +use super::{inner_types::InnerTypes, object_handle::NativeObjectHandle}; pub trait NativeContext: Clone { fn boolean(&self, v: bool) -> IT::Boolean; diff --git a/rust/cubenativeutils/src/wrappers/inner_types.rs b/rust/cubenativeutils/src/wrappers/inner_types.rs index 24586a56234a5..66bfbf136375c 100644 --- a/rust/cubenativeutils/src/wrappers/inner_types.rs +++ b/rust/cubenativeutils/src/wrappers/inner_types.rs @@ -1,7 +1,9 @@ -use super::context::NativeContext; -use super::object::{ - NativeArray, NativeBoolean, NativeFunction, NativeNumber, NativeObject, NativeString, - NativeStruct, +use super::{ + context::NativeContext, + object::{ + NativeArray, NativeBoolean, NativeFunction, NativeNumber, NativeObject, NativeString, + NativeStruct, + }, }; pub trait InnerTypes: Clone + 'static { type Object: NativeObject; diff --git a/rust/cubenativeutils/src/wrappers/neon/context.rs b/rust/cubenativeutils/src/wrappers/neon/context.rs index e641ab5c20296..96950e5e3aedb 100644 --- a/rust/cubenativeutils/src/wrappers/neon/context.rs +++ b/rust/cubenativeutils/src/wrappers/neon/context.rs @@ -1,18 +1,21 @@ //use super::object::NeonObject; -use super::inner_types::NeonInnerTypes; -use super::object::base_types::*; -use super::object::neon_array::NeonArray; -use super::object::neon_function::NeonFunction; -use super::object::neon_struct::NeonStruct; -use super::object::NeonObject; -use crate::wrappers::context::NativeContext; -use crate::wrappers::object::NativeObject; -use crate::wrappers::object_handle::NativeObjectHandle; +use super::{ + inner_types::NeonInnerTypes, + object::{ + base_types::*, neon_array::NeonArray, neon_function::NeonFunction, neon_struct::NeonStruct, + NeonObject, + }, +}; +use crate::wrappers::{ + context::NativeContext, object::NativeObject, object_handle::NativeObjectHandle, +}; use cubesql::CubeError; use neon::prelude::*; -use std::cell::{RefCell, RefMut}; -use std::marker::PhantomData; -use std::rc::{Rc, Weak}; +use std::{ + cell::{RefCell, RefMut}, + marker::PhantomData, + rc::{Rc, Weak}, +}; pub struct ContextWrapper<'cx, C: Context<'cx>> { cx: C, lifetime: PhantomData<&'cx ()>, diff --git a/rust/cubenativeutils/src/wrappers/neon/inner_types.rs b/rust/cubenativeutils/src/wrappers/neon/inner_types.rs index ebdfdf6f6279f..8bf32d0be843e 100644 --- a/rust/cubenativeutils/src/wrappers/neon/inner_types.rs +++ b/rust/cubenativeutils/src/wrappers/neon/inner_types.rs @@ -1,9 +1,10 @@ -use super::context::ContextHolder; -use super::object::base_types::*; -use super::object::neon_array::NeonArray; -use super::object::neon_function::NeonFunction; -use super::object::neon_struct::NeonStruct; -use super::object::NeonObject; +use super::{ + context::ContextHolder, + object::{ + base_types::*, neon_array::NeonArray, neon_function::NeonFunction, neon_struct::NeonStruct, + NeonObject, + }, +}; use crate::wrappers::inner_types::InnerTypes; use neon::prelude::*; use std::marker::PhantomData; diff --git a/rust/cubenativeutils/src/wrappers/neon/object/mod.rs b/rust/cubenativeutils/src/wrappers/neon/object/mod.rs index cb263bfeb6ea3..40763a228b97d 100644 --- a/rust/cubenativeutils/src/wrappers/neon/object/mod.rs +++ b/rust/cubenativeutils/src/wrappers/neon/object/mod.rs @@ -3,13 +3,14 @@ pub mod neon_array; pub mod neon_function; pub mod neon_struct; -use self::base_types::{NeonBoolean, NeonNumber, NeonString}; -use self::neon_array::NeonArray; -use self::neon_function::NeonFunction; -use self::neon_struct::NeonStruct; +use self::{ + base_types::{NeonBoolean, NeonNumber, NeonString}, + neon_array::NeonArray, + neon_function::NeonFunction, + neon_struct::NeonStruct, +}; use super::inner_types::NeonInnerTypes; -use crate::wrappers::neon::context::ContextHolder; -use crate::wrappers::object::NativeObject; +use crate::wrappers::{neon::context::ContextHolder, object::NativeObject}; use cubesql::CubeError; use neon::prelude::*; diff --git a/rust/cubenativeutils/src/wrappers/neon/object/neon_array.rs b/rust/cubenativeutils/src/wrappers/neon/object/neon_array.rs index 85bf544555b1a..dc06714227c61 100644 --- a/rust/cubenativeutils/src/wrappers/neon/object/neon_array.rs +++ b/rust/cubenativeutils/src/wrappers/neon/object/neon_array.rs @@ -1,7 +1,9 @@ use super::NeonObject; -use crate::wrappers::neon::inner_types::NeonInnerTypes; -use crate::wrappers::object::{NativeArray, NativeObject, NativeType}; -use crate::wrappers::object_handle::NativeObjectHandle; +use crate::wrappers::{ + neon::inner_types::NeonInnerTypes, + object::{NativeArray, NativeObject, NativeType}, + object_handle::NativeObjectHandle, +}; use cubesql::CubeError; use neon::prelude::*; diff --git a/rust/cubenativeutils/src/wrappers/neon/object/neon_function.rs b/rust/cubenativeutils/src/wrappers/neon/object/neon_function.rs index 78f663ff365a9..c8fc68d372d50 100644 --- a/rust/cubenativeutils/src/wrappers/neon/object/neon_function.rs +++ b/rust/cubenativeutils/src/wrappers/neon/object/neon_function.rs @@ -1,7 +1,9 @@ use super::NeonObject; -use crate::wrappers::neon::inner_types::NeonInnerTypes; -use crate::wrappers::object::{NativeFunction, NativeType}; -use crate::wrappers::object_handle::NativeObjectHandle; +use crate::wrappers::{ + neon::inner_types::NeonInnerTypes, + object::{NativeFunction, NativeType}, + object_handle::NativeObjectHandle, +}; use cubesql::CubeError; use lazy_static::lazy_static; use neon::prelude::*; diff --git a/rust/cubenativeutils/src/wrappers/neon/object/neon_struct.rs b/rust/cubenativeutils/src/wrappers/neon/object/neon_struct.rs index 7815a19f306f0..693c19aeb1da3 100644 --- a/rust/cubenativeutils/src/wrappers/neon/object/neon_struct.rs +++ b/rust/cubenativeutils/src/wrappers/neon/object/neon_struct.rs @@ -1,7 +1,9 @@ use super::NeonObject; -use crate::wrappers::neon::inner_types::NeonInnerTypes; -use crate::wrappers::object::{NativeStruct, NativeType}; -use crate::wrappers::object_handle::NativeObjectHandle; +use crate::wrappers::{ + neon::inner_types::NeonInnerTypes, + object::{NativeStruct, NativeType}, + object_handle::NativeObjectHandle, +}; use cubesql::CubeError; use neon::prelude::*; diff --git a/rust/cubenativeutils/src/wrappers/object.rs b/rust/cubenativeutils/src/wrappers/object.rs index f901ededed639..bee3275ea3aac 100644 --- a/rust/cubenativeutils/src/wrappers/object.rs +++ b/rust/cubenativeutils/src/wrappers/object.rs @@ -1,5 +1,4 @@ -use super::inner_types::InnerTypes; -use super::object_handle::NativeObjectHandle; +use super::{inner_types::InnerTypes, object_handle::NativeObjectHandle}; use cubesql::CubeError; pub trait NativeObject: Clone { diff --git a/rust/cubenativeutils/src/wrappers/object_handle.rs b/rust/cubenativeutils/src/wrappers/object_handle.rs index 7dffd313b8b96..501c16e356be8 100644 --- a/rust/cubenativeutils/src/wrappers/object_handle.rs +++ b/rust/cubenativeutils/src/wrappers/object_handle.rs @@ -1,5 +1,4 @@ -use super::inner_types::InnerTypes; -use super::object::NativeObject; +use super::{inner_types::InnerTypes, object::NativeObject}; use cubesql::CubeError; #[derive(Clone)] diff --git a/rust/cubenativeutils/src/wrappers/serializer/deserialize.rs b/rust/cubenativeutils/src/wrappers/serializer/deserialize.rs index 7576e9578e733..3f38afab3a592 100644 --- a/rust/cubenativeutils/src/wrappers/serializer/deserialize.rs +++ b/rust/cubenativeutils/src/wrappers/serializer/deserialize.rs @@ -1,7 +1,8 @@ use super::deserializer::NativeSerdeDeserializer; -use crate::wrappers::inner_types::InnerTypes; -use crate::wrappers::NativeObjectHandle; -use crate::CubeError; +use crate::{ + wrappers::{inner_types::InnerTypes, NativeObjectHandle}, + CubeError, +}; use serde::de::DeserializeOwned; pub trait NativeDeserialize: Sized { diff --git a/rust/cubenativeutils/src/wrappers/serializer/deserializer.rs b/rust/cubenativeutils/src/wrappers/serializer/deserializer.rs index d98984fa2412e..9f3cc78582723 100644 --- a/rust/cubenativeutils/src/wrappers/serializer/deserializer.rs +++ b/rust/cubenativeutils/src/wrappers/serializer/deserializer.rs @@ -1,13 +1,14 @@ use super::error::NativeObjSerializerError; -use crate::wrappers::inner_types::InnerTypes; -use crate::wrappers::object::{ - NativeArray, NativeBoolean, NativeNumber, NativeString, NativeStruct, +use crate::wrappers::{ + inner_types::InnerTypes, + object::{NativeArray, NativeBoolean, NativeNumber, NativeString, NativeStruct}, + object_handle::NativeObjectHandle, +}; +use serde::{ + self, + de::{DeserializeOwned, DeserializeSeed, MapAccess, SeqAccess, Visitor}, + forward_to_deserialize_any, Deserializer, }; -use crate::wrappers::object_handle::NativeObjectHandle; -use serde; -use serde::de::{DeserializeOwned, DeserializeSeed, MapAccess, SeqAccess, Visitor}; -use serde::forward_to_deserialize_any; -use serde::Deserializer; pub struct NativeSerdeDeserializer { input: NativeObjectHandle, diff --git a/rust/cubenativeutils/src/wrappers/serializer/error.rs b/rust/cubenativeutils/src/wrappers/serializer/error.rs index 219b219ca7050..50e55c88da9f4 100644 --- a/rust/cubenativeutils/src/wrappers/serializer/error.rs +++ b/rust/cubenativeutils/src/wrappers/serializer/error.rs @@ -1,6 +1,5 @@ use serde::{de, ser}; -use std::fmt; -use std::fmt::Display; +use std::{fmt, fmt::Display}; #[derive(Debug)] pub enum NativeObjSerializerError { Message(String), diff --git a/rust/cubenativeutils/src/wrappers/serializer/serialize.rs b/rust/cubenativeutils/src/wrappers/serializer/serialize.rs index 1dce7a117d432..e08ef8284053f 100644 --- a/rust/cubenativeutils/src/wrappers/serializer/serialize.rs +++ b/rust/cubenativeutils/src/wrappers/serializer/serialize.rs @@ -1,7 +1,8 @@ use super::serializer::NativeSerdeSerializer; -use crate::wrappers::inner_types::InnerTypes; -use crate::wrappers::{NativeContextHolder, NativeObjectHandle}; -use crate::CubeError; +use crate::{ + wrappers::{inner_types::InnerTypes, NativeContextHolder, NativeObjectHandle}, + CubeError, +}; use serde::Serialize; pub trait NativeSerialize { diff --git a/rust/cubenativeutils/src/wrappers/serializer/serializer.rs b/rust/cubenativeutils/src/wrappers/serializer/serializer.rs index a1e04657f977c..21463875cddd2 100644 --- a/rust/cubenativeutils/src/wrappers/serializer/serializer.rs +++ b/rust/cubenativeutils/src/wrappers/serializer/serializer.rs @@ -1,7 +1,8 @@ use super::error::NativeObjSerializerError; -use crate::wrappers::inner_types::InnerTypes; -use crate::wrappers::NativeContextHolder; -use crate::wrappers::{NativeArray, NativeObjectHandle, NativeString, NativeStruct, NativeType}; +use crate::wrappers::{ + inner_types::InnerTypes, NativeArray, NativeContextHolder, NativeObjectHandle, NativeString, + NativeStruct, NativeType, +}; use serde::{ser, Serialize}; pub struct NativeSerdeSerializer { From 1692bc4cc383fd1b9cef81781417f2b2239be2f3 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 25 Nov 2024 15:14:18 +0200 Subject: [PATCH 016/128] cargo fmt --- rust/cubeorchestrator/src/cubestore_message_parser.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index d9c3d77b30275..1a764c21fec84 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -26,11 +26,8 @@ impl std::fmt::Display for ParseError { impl std::error::Error for ParseError {} -pub fn parse_cubestore_ws_result( - msg_data: &[u8], -) -> Result>, ParseError> { - let http_message = - root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; +pub fn parse_cubestore_ws_result(msg_data: &[u8]) -> Result>, ParseError> { + let http_message = root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; let command_type = http_message.command_type(); From e7f564b25367c607954506104a67f7346032a353 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 25 Nov 2024 16:35:24 +0200 Subject: [PATCH 017/128] cargo clippy fix --- packages/cubejs-backend-native/src/node_export.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 6a1fc9f28245e..b2434fcd6e5ee 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -511,7 +511,7 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { let msg = cx.argument::(0)?; let msg_data = msg.as_slice(&cx).to_vec(); - match parse_cubestore_ws_result(&*msg_data) { + match parse_cubestore_ws_result(&msg_data) { Ok(result) => { let js_array = cx.execute_scoped(|mut cx| { let js_array = JsArray::new(&mut cx, result.len()); From 993345908ce31b23b0dbc55566b10606d37c3b70 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 25 Nov 2024 17:09:11 +0200 Subject: [PATCH 018/128] update cubestore Dockerfile --- .github/workflows/publish.yml | 2 +- .github/workflows/rust-cubestore.yml | 2 +- rust/cubestore/Dockerfile | 25 ++++++++++++++----------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 92d896a6421bd..3c3d0e70a329f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }} diff --git a/.github/workflows/rust-cubestore.yml b/.github/workflows/rust-cubestore.yml index 3b4a2eb6182c3..05f443a705cc5 100644 --- a/.github/workflows/rust-cubestore.yml +++ b/.github/workflows/rust-cubestore.yml @@ -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 }} diff --git a/rust/cubestore/Dockerfile b/rust/cubestore/Dockerfile index f522c4ef8e23f..db2ec1ec76cd1 100644 --- a/rust/cubestore/Dockerfile +++ b/rust/cubestore/Dockerfile @@ -1,15 +1,18 @@ FROM cubejs/rust-builder:bookworm-llvm-18 AS builder WORKDIR /build/cubestore -COPY Cargo.toml . -COPY Cargo.lock . -COPY cuberockstore cuberockstore -COPY cubehll cubehll -COPY cubezetasketch cubezetasketch -COPY cubedatasketches cubedatasketches -COPY cuberpc cuberpc -COPY cubestore-sql-tests cubestore-sql-tests -COPY cubestore/Cargo.toml cubestore/Cargo.toml + +COPY cubeshared /build/cubeshared + +COPY cubestore/Cargo.toml . +COPY cubestore/Cargo.lock . +COPY cubestore/cuberockstore cuberockstore +COPY cubestore/cubehll cubehll +COPY cubestore/cubezetasketch cubezetasketch +COPY cubestore/cubedatasketches cubedatasketches +COPY cubestore/cuberpc cuberpc +COPY cubestore/cubestore-sql-tests cubestore-sql-tests +COPY cubestore/cubestore/Cargo.toml cubestore/Cargo.toml RUN mkdir -p cubestore/src/bin && \ echo "fn main() {print!(\"Dummy main\");} // dummy file" > cubestore/src/bin/cubestored.rs @@ -18,8 +21,8 @@ RUN [ "$WITH_AVX2" -eq "1" ] && export RUSTFLAGS="-C target-feature=+avx2"; \ cargo build --release -p cubestore # Cube Store get version from his own package -COPY package.json package.json -COPY cubestore cubestore +COPY cubestore/package.json package.json +COPY cubestore/cubestore cubestore RUN [ "$WITH_AVX2" -eq "1" ] && export RUSTFLAGS="-C target-feature=+avx2"; \ cargo build --release -p cubestore From 7edca8c5b52a7fec7b3a630aaa2df682397b0efa Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 25 Nov 2024 17:14:21 +0200 Subject: [PATCH 019/128] cargo fmt --- rust/cubestore/cubestore/src/http/mod.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rust/cubestore/cubestore/src/http/mod.rs b/rust/cubestore/cubestore/src/http/mod.rs index 69dc028a570ff..e03fe51d0b425 100644 --- a/rust/cubestore/cubestore/src/http/mod.rs +++ b/rust/cubestore/cubestore/src/http/mod.rs @@ -4,11 +4,6 @@ use std::sync::Arc; use warp::{Filter, Rejection, Reply}; -use cubeshared::codegen::{ - root_as_http_message, HttpColumnValue, HttpColumnValueArgs, HttpError, HttpErrorArgs, - HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpResultSet, HttpResultSetArgs, HttpRow, - HttpRowArgs, -}; use crate::metastore::{Column, ColumnType, ImportFormat}; use crate::mysql::SqlAuthService; use crate::sql::{InlineTable, InlineTables, SqlQueryContext, SqlService}; @@ -17,6 +12,11 @@ use crate::table::{Row, TableValue}; use crate::util::WorkerLoop; use crate::CubeError; use async_std::fs::File; +use cubeshared::codegen::{ + root_as_http_message, HttpColumnValue, HttpColumnValueArgs, HttpError, HttpErrorArgs, + HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpResultSet, HttpResultSetArgs, HttpRow, + HttpRowArgs, +}; use datafusion::cube_ext; use flatbuffers::{FlatBufferBuilder, ForwardsUOffset, Vector, WIPOffset}; use futures::{AsyncWriteExt, SinkExt, Stream, StreamExt}; @@ -857,7 +857,6 @@ impl HttpMessage { #[cfg(test)] mod tests { - use cubeshared::codegen::{HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpTable, HttpTableArgs}; use crate::config::{init_test_logger, Config}; use crate::http::{HttpCommand, HttpMessage, HttpServer}; use crate::metastore::{Column, ColumnType}; @@ -867,6 +866,9 @@ mod tests { use crate::table::{Row, TableValue}; use crate::CubeError; use async_trait::async_trait; + use cubeshared::codegen::{ + HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpTable, HttpTableArgs, + }; use datafusion::cube_ext; use flatbuffers::{FlatBufferBuilder, ForwardsUOffset, Vector, WIPOffset}; use futures_util::{SinkExt, StreamExt}; From f2b08d15ae8d9b445e53e5d5a153bb66d08bdcc0 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 25 Nov 2024 17:32:56 +0200 Subject: [PATCH 020/128] update cubestore Docker builds --- .github/workflows/rust-cubestore-master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-cubestore-master.yml b/.github/workflows/rust-cubestore-master.yml index 29211f7c24a83..eb72e456f30ea 100644 --- a/.github/workflows/rust-cubestore-master.yml +++ b/.github/workflows/rust-cubestore-master.yml @@ -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 }} From 10ff7d03a62c8604529a3831251490d22fa7235b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 27 Nov 2024 14:31:23 +0200 Subject: [PATCH 021/128] introduce CubeStoreResult struct --- .../cubejs-backend-native/src/node_export.rs | 10 ++++---- .../src/cubestore_message_parser.rs | 23 +++++++++++-------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index b2434fcd6e5ee..95070d51d7f80 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -514,14 +514,14 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { let js_array = cx.execute_scoped(|mut cx| { - let js_array = JsArray::new(&mut cx, result.len()); + let js_array = JsArray::new(&mut cx, result.rows.len()); - for (i, row) in result.into_iter().enumerate() { + for (i, row) in result.rows.iter().enumerate() { let js_row = cx.execute_scoped(|mut cx| { let js_row = JsObject::new(&mut cx); - for (key, value) in row.into_iter() { - let js_value = cx.string(value); - js_row.set(&mut cx, key, js_value)?; + for (key, value) in result.columns.iter().zip(row.into_iter()) { + let js_value = cx.string(*value); + js_row.set(&mut cx, *key, js_value)?; } Ok(js_row) })?; diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 1a764c21fec84..b735b04faae8b 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,5 +1,4 @@ use cubeshared::codegen::{root_as_http_message, HttpCommand}; -use std::collections::HashMap; #[derive(Debug)] pub enum ParseError { @@ -24,9 +23,14 @@ impl std::fmt::Display for ParseError { } } +pub struct CubeStoreResult<'a> { + pub columns: Vec<&'a str>, + pub rows: Vec>, +} + impl std::error::Error for ParseError {} -pub fn parse_cubestore_ws_result(msg_data: &[u8]) -> Result>, ParseError> { +pub fn parse_cubestore_ws_result(msg_data: &[u8]) -> Result { let http_message = root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; let command_type = http_message.command_type(); @@ -51,20 +55,19 @@ pub fn parse_cubestore_ws_result(msg_data: &[u8]) -> Result = result_set_columns + let row_obj: Vec<_> = values .iter() - .zip(values.iter()) - .map(|(col, val)| { - let value = val.string_value().unwrap_or(""); - (col, value) - }) + .map(|val| val.string_value().unwrap_or("")) .collect(); - result.push(row_obj); + result.rows.push(row_obj); } Ok(result) From aa5aebdeaf191336d4e55e970f3ede3cea027b7d Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 29 Nov 2024 20:03:30 +0200 Subject: [PATCH 022/128] =?UTF-8?q?create=20CubeStoreResultWrapper=20class?= =?UTF-8?q?=20and=C2=A0switch=20to=C2=A0lazy=20evaluation=20of=C2=A0result?= =?UTF-8?q?s=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/Cargo.lock | 1 + .../js/CubeStoreResultWrapper.ts | 77 +++++++++++++++++ packages/cubejs-backend-native/js/index.ts | 14 +++- .../cubejs-backend-native/src/node_export.rs | 54 +++++++----- .../src/cubestore_message_parser.rs | 83 ++++++++++--------- 5 files changed, 166 insertions(+), 63 deletions(-) create mode 100644 packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index 64736453ec854..fa860e7105bdb 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -784,6 +784,7 @@ dependencies = [ name = "cubeorchestrator" version = "0.1.0" dependencies = [ + "bytes", "cubeshared", "neon", ] diff --git a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts new file mode 100644 index 0000000000000..4e30dc6921110 --- /dev/null +++ b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts @@ -0,0 +1,77 @@ +import { getCubestoreResult, ResultRow } from './index'; + +export class CubeStoreResultWrapper { + private readonly proxy: any; + + private cache: any; + + public constructor(private readonly nativeReference: any) { + this.proxy = new Proxy(this, { + get: (target, prop: string | symbol) => { + // intercept indexes + if (typeof prop === 'string' && !Number.isNaN(Number(prop))) { + const array = this.getArray(); + return array[Number(prop)]; + } + + // intercept array methods + if (typeof prop === 'string' && prop in Array.prototype) { + const arrayMethod = (Array.prototype as any)[prop]; + if (typeof arrayMethod === 'function') { + return (...args: any[]) => this.invokeArrayMethod(prop, ...args); + } + } + + // intercept isNative + if (prop === 'isNative') { + return true; + } + + // intercept array length + if (prop === 'length') { + return this.getArray().length; + } + + // intercept JSON.stringify or toJSON() + if (prop === 'toJSON') { + return () => this.getArray(); + } + + return (target as any)[prop]; + }, + + // intercept array length + getOwnPropertyDescriptor: (target, prop) => { + if (prop === 'length') { + const array = this.getArray(); + return { + configurable: true, + enumerable: true, + value: array.length, + writable: false + }; + } + return Object.getOwnPropertyDescriptor(target, prop); + }, + + ownKeys: (target) => { + const array = this.getArray(); + return [...Object.keys(target), ...Object.keys(array), 'length', 'isNative']; + } + }); + + return this.proxy; + } + + private getArray(): ResultRow[] { + if (!this.cache) { + this.cache = getCubestoreResult(this.nativeReference); + } + return this.cache; + } + + private invokeArrayMethod(method: string, ...args: any[]): any { + const array = this.getArray(); + return (array as any)[method](...args); + } +} diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index fb120be7c99a5..e76425175c236 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -3,6 +3,9 @@ import fs from 'fs'; import path from 'path'; import { Writable } from 'stream'; import type { Request as ExpressRequest } from 'express'; +import { CubeStoreResultWrapper } from './CubeStoreResultWrapper'; + +export * from './CubeStoreResultWrapper'; export interface BaseMeta { // postgres or mysql @@ -350,10 +353,17 @@ export const buildSqlAndParams = (cubeEvaluator: any): String => { export type ResultRow = Record; -export const parseCubestoreResultMessage = (message: ArrayBuffer): ResultRow[] => { +export const parseCubestoreResultMessage = (message: ArrayBuffer): CubeStoreResultWrapper => { + const native = loadNative(); + + const msg = native.parseCubestoreResultMessage(message); + return new CubeStoreResultWrapper(msg); +}; + +export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => { const native = loadNative(); - return native.parseCubestoreResultMessage(message); + return native.getCubestoreResult(ref); }; export interface PyConfiguration { diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 95070d51d7f80..321a06e63c64a 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -32,7 +32,7 @@ use cubenativeutils::wrappers::NativeContextHolder; use cubesqlplanner::cube_bridge::base_query_options::NativeBaseQueryOptions; use cubesqlplanner::planner::base_query::BaseQuery; -use cubeorchestrator::cubestore_message_parser::parse_cubestore_ws_result; +use cubeorchestrator::cubestore_message_parser::CubeStoreResult; use cubesql::{telemetry::ReportingLogger, CubeError}; @@ -508,34 +508,41 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { //============ sql orchestrator =================== -fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { +fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult> { let msg = cx.argument::(0)?; - let msg_data = msg.as_slice(&cx).to_vec(); - match parse_cubestore_ws_result(&msg_data) { + let msg_data = msg.as_slice(&cx); + match CubeStoreResult::new(msg_data) { Ok(result) => { - let js_array = cx.execute_scoped(|mut cx| { - let js_array = JsArray::new(&mut cx, result.rows.len()); - - for (i, row) in result.rows.iter().enumerate() { - let js_row = cx.execute_scoped(|mut cx| { - let js_row = JsObject::new(&mut cx); - for (key, value) in result.columns.iter().zip(row.into_iter()) { - let js_value = cx.string(*value); - js_row.set(&mut cx, *key, js_value)?; - } - Ok(js_row) - })?; - - js_array.set(&mut cx, i as u32, js_row)?; - } + Ok(cx.boxed(result)) + } + Err(err) => cx.throw_error(err.to_string()), + } +} - Ok(js_array) +fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { + let result = cx.argument::>(0)?; + + let js_array = cx.execute_scoped(|mut cx| { + let js_array = JsArray::new(&mut cx, result.rows.len()); + + for (i, row) in result.rows.iter().enumerate() { + let js_row = cx.execute_scoped(|mut cx| { + let js_row = JsObject::new(&mut cx); + for (key, value) in result.columns.iter().zip(row.into_iter()) { + let js_key = cx.string(key); + let js_value = cx.string(value); + js_row.set(&mut cx, js_key, js_value)?; + } + Ok(js_row) })?; - Ok(js_array.upcast()) + js_array.set(&mut cx, i as u32, js_row)?; } - Err(err) => cx.throw_error(err.to_string()), - } + + Ok(js_array) + })?; + + Ok(js_array.upcast()) } pub fn register_module_exports( @@ -556,6 +563,7 @@ pub fn register_module_exports( "parseCubestoreResultMessage", parse_cubestore_ws_result_message, )?; + cx.export_function("getCubestoreResult", get_cubestore_result)?; crate::template::template_register_module(&mut cx)?; diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index b735b04faae8b..fd23db56a7fbf 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,3 +1,4 @@ +use neon::prelude::Finalize; use cubeshared::codegen::{root_as_http_message, HttpCommand}; #[derive(Debug)] @@ -23,55 +24,61 @@ impl std::fmt::Display for ParseError { } } -pub struct CubeStoreResult<'a> { - pub columns: Vec<&'a str>, - pub rows: Vec>, -} - impl std::error::Error for ParseError {} -pub fn parse_cubestore_ws_result(msg_data: &[u8]) -> Result { - let http_message = root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; +pub struct CubeStoreResult { + pub columns: Vec, + pub rows: Vec>, +} - let command_type = http_message.command_type(); +impl Finalize for CubeStoreResult {} - match command_type { - HttpCommand::HttpError => { - let http_error = http_message - .command_as_http_error() - .ok_or(ParseError::FlatBufferError)?; - let error_message = http_error.error().unwrap_or("Unknown error").to_string(); - Err(ParseError::ErrorMessage(error_message)) - } - HttpCommand::HttpResultSet => { - let result_set = http_message - .command_as_http_result_set() - .ok_or(ParseError::EmptyResultSet)?; +impl CubeStoreResult { + pub fn new(msg_data: &[u8]) -> Result { + let mut result = CubeStoreResult { + columns: vec![], + rows: vec![], + }; - let result_set_columns = result_set.columns().ok_or(ParseError::EmptyResultSet)?; + let http_message = root_as_http_message(msg_data) + .map_err(|_| ParseError::FlatBufferError)?; - if result_set_columns.iter().any(|c| c.is_empty()) { - return Err(ParseError::ColumnNameNotDefined); + match http_message.command_type() { + HttpCommand::HttpError => { + let http_error = http_message + .command_as_http_error() + .ok_or(ParseError::FlatBufferError)?; + let error_message = http_error.error().unwrap_or("Unknown error").to_string(); + Err(ParseError::ErrorMessage(error_message)) } + HttpCommand::HttpResultSet => { + let result_set = http_message + .command_as_http_result_set() + .ok_or(ParseError::EmptyResultSet)?; - let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; - let mut result = CubeStoreResult{ - columns: result_set_columns.iter().collect(), - rows: Vec::with_capacity(result_set_rows.len()) - }; + let result_set_columns = result_set.columns().ok_or(ParseError::EmptyResultSet)?; - for row in result_set_rows.iter() { - let values = row.values().ok_or(ParseError::NullRow)?; - let row_obj: Vec<_> = values - .iter() - .map(|val| val.string_value().unwrap_or("")) - .collect(); + if result_set_columns.iter().any(|c| c.is_empty()) { + return Err(ParseError::ColumnNameNotDefined); + } - result.rows.push(row_obj); - } + result.columns = result_set_columns.iter().map(|val| val.to_owned()).collect(); + let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; + result.rows = Vec::with_capacity(result_set_rows.len()); + + for row in result_set_rows.iter() { + let values = row.values().ok_or(ParseError::NullRow)?; + let row_obj: Vec<_> = values + .iter() + .map(|val| val.string_value().unwrap_or("").to_owned()) + .collect(); + + result.rows.push(row_obj); + } - Ok(result) + Ok(result) + }, + _ => Err(ParseError::UnsupportedCommand), } - _ => Err(ParseError::UnsupportedCommand), } } From 626bd8a5441d7b25feb9fba2af0f6b76c0bcc97f Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 29 Nov 2024 20:03:48 +0200 Subject: [PATCH 023/128] add resToRawResultFn in API GW --- packages/cubejs-api-gateway/src/gateway.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 006db77b91d3b..669434cb575fc 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -2017,6 +2017,17 @@ class ApiGateway { return (message, { status }: { status?: number } = {}) => (status ? res.status(status).json(message) : res.json(message)); } + protected resToRawResultFn(res: ExpressResponse) { + return (jsonBuffer: ArrayBuffer, { status }: { status?: number } = {}) => { + if (status) { + res.status(status); + } + + res.set('Content-Type', 'application/json'); + res.send(jsonBuffer); + }; + } + protected parseQueryParam(query): Query | Query[] { if (!query || query === 'undefined') { throw new UserError('Query param is required'); From 4efb3450016c941fd5c4cb74debad126bf08029c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 29 Nov 2024 20:05:24 +0200 Subject: [PATCH 024/128] cargo fmt --- packages/cubejs-backend-native/src/node_export.rs | 6 ++---- .../src/cubestore_message_parser.rs | 13 ++++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 321a06e63c64a..20ef7e3e8ad9f 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -512,16 +512,14 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult(0)?; let msg_data = msg.as_slice(&cx); match CubeStoreResult::new(msg_data) { - Ok(result) => { - Ok(cx.boxed(result)) - } + Ok(result) => Ok(cx.boxed(result)), Err(err) => cx.throw_error(err.to_string()), } } fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { let result = cx.argument::>(0)?; - + let js_array = cx.execute_scoped(|mut cx| { let js_array = JsArray::new(&mut cx, result.rows.len()); diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index fd23db56a7fbf..3815956fed600 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,5 +1,5 @@ -use neon::prelude::Finalize; use cubeshared::codegen::{root_as_http_message, HttpCommand}; +use neon::prelude::Finalize; #[derive(Debug)] pub enum ParseError { @@ -40,8 +40,8 @@ impl CubeStoreResult { rows: vec![], }; - let http_message = root_as_http_message(msg_data) - .map_err(|_| ParseError::FlatBufferError)?; + let http_message = + root_as_http_message(msg_data).map_err(|_| ParseError::FlatBufferError)?; match http_message.command_type() { HttpCommand::HttpError => { @@ -62,7 +62,10 @@ impl CubeStoreResult { return Err(ParseError::ColumnNameNotDefined); } - result.columns = result_set_columns.iter().map(|val| val.to_owned()).collect(); + result.columns = result_set_columns + .iter() + .map(|val| val.to_owned()) + .collect(); let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; result.rows = Vec::with_capacity(result_set_rows.len()); @@ -77,7 +80,7 @@ impl CubeStoreResult { } Ok(result) - }, + } _ => Err(ParseError::UnsupportedCommand), } } From a5fb65dabe6b480e01906b42224f7613e657ef63 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 29 Nov 2024 20:18:24 +0200 Subject: [PATCH 025/128] update resToResultFn --- packages/cubejs-api-gateway/src/gateway.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 669434cb575fc..747287ec4fc29 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -2014,17 +2014,17 @@ class ApiGateway { } protected resToResultFn(res: ExpressResponse) { - return (message, { status }: { status?: number } = {}) => (status ? res.status(status).json(message) : res.json(message)); - } - - protected resToRawResultFn(res: ExpressResponse) { - return (jsonBuffer: ArrayBuffer, { status }: { status?: number } = {}) => { + return (message, { status }: { status?: number } = {}) => { if (status) { res.status(status); } - res.set('Content-Type', 'application/json'); - res.send(jsonBuffer); + if (message instanceof ArrayBuffer) { + res.set('Content-Type', 'application/json'); + res.send(message); + } + + res.json(message); }; } From 583df2c517a027cc3b0079e5f06c0306494f4fd4 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 29 Nov 2024 20:48:06 +0200 Subject: [PATCH 026/128] call prepareAnnotation later --- packages/cubejs-api-gateway/src/gateway.ts | 8 ++++---- packages/cubejs-api-gateway/src/helpers/transformData.ts | 2 +- packages/cubejs-api-gateway/src/helpers/transformValue.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 747287ec4fc29..322b91d1b32d0 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1749,16 +1749,16 @@ class ApiGateway { slowQuery = slowQuery || Boolean(sqlQueries[index].slowQuery); - const annotation = prepareAnnotation( - metaConfigResult, normalizedQuery - ); - const response = await this.getSqlResponseInternal( context, normalizedQuery, sqlQueries[index], ); + const annotation = prepareAnnotation( + metaConfigResult, normalizedQuery + ); + return this.getResultInternal( context, queryType, diff --git a/packages/cubejs-api-gateway/src/helpers/transformData.ts b/packages/cubejs-api-gateway/src/helpers/transformData.ts index a9c4f4b9a294e..2e260bd7a99af 100644 --- a/packages/cubejs-api-gateway/src/helpers/transformData.ts +++ b/packages/cubejs-api-gateway/src/helpers/transformData.ts @@ -216,7 +216,7 @@ function getCompactRow( } /** - * Convert DB response object to the vanila output format. + * Convert DB response object to the vanilla output format. * @todo rewrite me please! * @internal */ diff --git a/packages/cubejs-api-gateway/src/helpers/transformValue.ts b/packages/cubejs-api-gateway/src/helpers/transformValue.ts index 78d80f16f15bc..f56ae637673ad 100644 --- a/packages/cubejs-api-gateway/src/helpers/transformValue.ts +++ b/packages/cubejs-api-gateway/src/helpers/transformValue.ts @@ -22,7 +22,7 @@ type DBResponseValue = { value: DBResponsePrimitive }; /** - * Transform cpecified `value` with specified `type` to the network + * Transform specified `value` with specified `type` to the network * protocol type. */ function transformValue( From a50f0e623bcfd199e668b0cb3a2c5da3f183c11f Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 2 Dec 2024 12:44:48 +0200 Subject: [PATCH 027/128] remove bytes --- packages/cubejs-backend-native/Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index fa860e7105bdb..64736453ec854 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -784,7 +784,6 @@ dependencies = [ name = "cubeorchestrator" version = "0.1.0" dependencies = [ - "bytes", "cubeshared", "neon", ] From b41f30f3f9a08337b640670946181635d142cdea Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 2 Dec 2024 12:45:08 +0200 Subject: [PATCH 028/128] =?UTF-8?q?add=20cached=20flag=20to=C2=A0CubeStore?= =?UTF-8?q?ResultWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts index 4e30dc6921110..8e1db1b1e7f30 100644 --- a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts +++ b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts @@ -5,6 +5,8 @@ export class CubeStoreResultWrapper { private cache: any; + public cached: Boolean = false; + public constructor(private readonly nativeReference: any) { this.proxy = new Proxy(this, { get: (target, prop: string | symbol) => { @@ -66,6 +68,7 @@ export class CubeStoreResultWrapper { private getArray(): ResultRow[] { if (!this.cache) { this.cache = getCubestoreResult(this.nativeReference); + this.cached = true; } return this.cache; } From 15e2cb8127c14c80fc943fd3c57200093a69f54c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 2 Dec 2024 14:23:26 +0200 Subject: [PATCH 029/128] convert core data types from api gateway --- rust/cubeorchestrator/Cargo.lock | 208 ++++++++++++++- rust/cubeorchestrator/Cargo.toml | 3 + .../src/cubestore_result_transform.rs | 15 ++ rust/cubeorchestrator/src/lib.rs | 2 + rust/cubeorchestrator/src/types.rs | 252 ++++++++++++++++++ 5 files changed, 476 insertions(+), 4 deletions(-) create mode 100644 rust/cubeorchestrator/src/cubestore_result_transform.rs create mode 100644 rust/cubeorchestrator/src/types.rs diff --git a/rust/cubeorchestrator/Cargo.lock b/rust/cubeorchestrator/Cargo.lock index 00c71b742b35a..67eeb2f75371f 100644 --- a/rust/cubeorchestrator/Cargo.lock +++ b/rust/cubeorchestrator/Cargo.lock @@ -17,6 +17,21 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "autocfg" version = "1.0.1" @@ -44,6 +59,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + [[package]] name = "cc" version = "1.0.94" @@ -56,12 +77,35 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cubeorchestrator" version = "0.1.0" dependencies = [ + "chrono", "cubeshared", "neon", + "serde", + "serde_json", ] [[package]] @@ -87,6 +131,45 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "itoa" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" + +[[package]] +name = "js-sys" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + [[package]] name = "libc" version = "0.2.153" @@ -103,6 +186,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + [[package]] name = "memchr" version = "2.4.0" @@ -145,6 +234,15 @@ dependencies = [ "syn-mid", ] +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "object" version = "0.26.0" @@ -168,9 +266,9 @@ checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -199,6 +297,12 @@ dependencies = [ "semver", ] +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + [[package]] name = "semver" version = "1.0.23" @@ -211,6 +315,38 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" +[[package]] +name = "serde" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -219,9 +355,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.58" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -255,6 +391,70 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +[[package]] +name = "wasm-bindgen" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.4" diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml index 3a6fbdf5e1484..2680426fe97dc 100644 --- a/rust/cubeorchestrator/Cargo.toml +++ b/rust/cubeorchestrator/Cargo.toml @@ -4,7 +4,10 @@ version = "0.1.0" edition = "2021" [dependencies] +chrono = "0.4.38" cubeshared = { path = "../cubeshared" } +serde = { version = "1.0.215", features = ["derive"] } +serde_json = "1.0.133" [dependencies.neon] version = "=1" diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs new file mode 100644 index 0000000000000..7b19ea62dcc1e --- /dev/null +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -0,0 +1,15 @@ +use chrono::SecondsFormat; +use crate::types::{DBResponsePrimitive, DBResponseValue}; + +pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { + match value { + DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { + let formatted = dt.to_rfc3339_opts(SecondsFormat::Millis, true); + DBResponsePrimitive::String(formatted) + } + DBResponseValue::Primitive(p) => p, + DBResponseValue::Object { value } => value, + _ => DBResponsePrimitive::Null, + } +} + diff --git a/rust/cubeorchestrator/src/lib.rs b/rust/cubeorchestrator/src/lib.rs index 252a6a548c360..f445d3cfcead5 100644 --- a/rust/cubeorchestrator/src/lib.rs +++ b/rust/cubeorchestrator/src/lib.rs @@ -1 +1,3 @@ pub mod cubestore_message_parser; +pub mod cubestore_result_transform; +pub mod types; diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs new file mode 100644 index 0000000000000..d1b30cc51fb59 --- /dev/null +++ b/rust/cubeorchestrator/src/types.rs @@ -0,0 +1,252 @@ +use std::collections::HashMap; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use chrono::{DateTime, Utc}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum DBResponsePrimitive { + Null, + Boolean(bool), + Number(f64), + String(String), +} + +#[derive(Debug, Clone)] +pub enum DBResponseValue { + DateTime(DateTime), + Primitive(DBResponsePrimitive), + // TODO: Is this variant still used? + Object { value: DBResponsePrimitive }, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum ResultType { + #[serde(rename = "default")] + Default, + #[serde(rename = "compact")] + Compact, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum QueryType { + #[serde(rename = "regularQuery")] + RegularQuery, + #[serde(rename = "compareDateRangeQuery")] + CompareDateRangeQuery, + #[serde(rename = "blendingQuery")] + BlendingQuery, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum MemberType { + #[serde(rename = "measures")] + Measures, + #[serde(rename = "dimensions")] + Dimensions, + #[serde(rename = "segments")] + Segments, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum FilterOperator { + #[serde(rename = "equals")] + Equals, + #[serde(rename = "notEquals")] + NotEquals, + #[serde(rename = "contains")] + Contains, + #[serde(rename = "notContains")] + NotContains, + #[serde(rename = "in")] + In, + #[serde(rename = "notIn")] + NotIn, + #[serde(rename = "gt")] + Gt, + #[serde(rename = "gte")] + Gte, + #[serde(rename = "lt")] + Lt, + #[serde(rename = "lte")] + Lte, + #[serde(rename = "set")] + Set, + #[serde(rename = "notSet")] + NotSet, + #[serde(rename = "inDateRange")] + InDateRange, + #[serde(rename = "notInDateRange")] + NotInDateRange, + #[serde(rename = "onTheDate")] + OnTheDate, + #[serde(rename = "beforeDate")] + BeforeDate, + #[serde(rename = "beforeOrOnDate")] + BeforeOrOnDate, + #[serde(rename = "afterDate")] + AfterDate, + #[serde(rename = "afterOrOnDate")] + AfterOrOnDate, + #[serde(rename = "measureFilter")] + MeasureFilter, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct QueryFilter { + pub member: String, + pub operator: FilterOperator, + pub values: Option>, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct GroupingSet { + pub group_type: String, + pub id: u32, + pub sub_id: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct ParsedMemberExpression { + pub expression: Vec, + #[serde(rename = "cubeName")] + pub cube_name: String, + pub name: String, + #[serde(rename = "expressionName")] + pub expression_name: String, + pub definition: String, + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "groupingSet")] + pub grouping_set: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct QueryTimeDimension { + pub dimension: String, + pub date_range: Option>, + pub compare_date_range: Option>, + pub granularity: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct AliasToMemberMap { + pub map: HashMap, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct GranularityMeta { + pub name: String, + pub title: String, + pub interval: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub offset: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub origin: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct ConfigItem { + pub title: String, + pub short_title: String, + pub description: String, + #[serde(rename = "type")] + pub member_type: String, + pub format: String, + pub meta: serde_json::Value, + #[serde(skip_serializing_if = "Option::is_none")] + pub drill_members: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub drill_members_grouped: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub granularities: Option>, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct Order { + pub id: String, + pub desc: bool, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct NormalizedQueryFilter { + pub member: String, + pub operator: FilterOperator, + pub values: Option>, + pub dimension: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum MemberOrMemberExpression { + Member(String), + MemberExpression(ParsedMemberExpression), +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct LogicalAndFilter { + pub and: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct LogicalOrFilter { + pub or: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub enum QueryFilterOrLogicalFilter { + QueryFilter(QueryFilter), + LogicalAndFilter(LogicalAndFilter), + LogicalOrFilter(LogicalOrFilter), +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LogicalFilter { + QueryFilter(QueryFilter), + LogicalAndFilter(LogicalAndFilter), + LogicalOrFilter(LogicalOrFilter), +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct Query { + pub measures: Vec, + pub dimensions: Option>, + pub filters: Option>, + #[serde(rename = "timeDimensions")] + pub time_dimensions: Option>, + pub segments: Option>, + pub limit: Option, + pub offset: Option, + pub total: Option, + #[serde(rename = "totalQuery")] + pub total_query: Option, + pub order: Option, + pub timezone: Option, + #[serde(rename = "renewQuery")] + pub renew_query: Option, + pub ungrouped: Option, + #[serde(rename = "responseFormat")] + pub response_format: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct NormalizedQuery { + pub measures: Vec, + pub dimensions: Option>, + #[serde(rename = "timeDimensions")] + pub time_dimensions: Option>, + pub segments: Option>, + pub limit: Option, + pub offset: Option, + pub total: Option, + #[serde(rename = "totalQuery")] + pub total_query: Option, + pub timezone: Option, + #[serde(rename = "renewQuery")] + pub renew_query: Option, + pub ungrouped: Option, + #[serde(rename = "responseFormat")] + pub response_format: Option, + pub filters: Option>, + #[serde(rename = "rowLimit")] + pub row_limit: Option, + pub order: Option>, +} From 1673b018a0d9a5dbb7fbf730279888472475ef71 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 2 Dec 2024 23:44:05 +0200 Subject: [PATCH 030/128] =?UTF-8?q?implement=20transformData=20and=C2=A0re?= =?UTF-8?q?lated=20helpers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust/cubeorchestrator/Cargo.lock | 7 + rust/cubeorchestrator/Cargo.toml | 1 + .../src/cubestore_result_transform.rs | 315 +++++++++++++++++- rust/cubeorchestrator/src/types.rs | 52 ++- 4 files changed, 361 insertions(+), 14 deletions(-) diff --git a/rust/cubeorchestrator/Cargo.lock b/rust/cubeorchestrator/Cargo.lock index 67eeb2f75371f..c1d61bb12c13b 100644 --- a/rust/cubeorchestrator/Cargo.lock +++ b/rust/cubeorchestrator/Cargo.lock @@ -32,6 +32,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + [[package]] name = "autocfg" version = "1.0.1" @@ -101,6 +107,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" name = "cubeorchestrator" version = "0.1.0" dependencies = [ + "anyhow", "chrono", "cubeshared", "neon", diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml index 2680426fe97dc..58675e86c7cde 100644 --- a/rust/cubeorchestrator/Cargo.toml +++ b/rust/cubeorchestrator/Cargo.toml @@ -8,6 +8,7 @@ chrono = "0.4.38" cubeshared = { path = "../cubeshared" } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" +anyhow = "1.0" [dependencies.neon] version = "=1" diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 7b19ea62dcc1e..9eb757b701445 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -1,6 +1,14 @@ +use crate::types::{ + ConfigItem, DBResponsePrimitive, DBResponseValue, MemberOrMemberExpression, MembersMap, + NormalizedQuery, QueryTimeDimension, QueryType, ResultType, TransformedData, + BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, + COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, +}; +use anyhow::{bail, Context, Result}; use chrono::SecondsFormat; -use crate::types::{DBResponsePrimitive, DBResponseValue}; +use std::collections::HashMap; +/// Transform specified `value` with specified `type` to the network protocol type. pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { match value { DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { @@ -13,3 +21,308 @@ pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimiti } } +/// Parse date range value from time dimension. +pub fn get_date_range_value(time_dimensions: Option<&Vec>) -> Result { + let time_dimensions = match time_dimensions { + Some(time_dimensions) => time_dimensions, + None => bail!("QueryTimeDimension should be specified for the compare date range query."), + }; + + let dim = match time_dimensions.get(0) { + Some(dim) => dim, + None => bail!("No time dimension provided."), + }; + + let date_range: &Vec = match &dim.date_range { + Some(date_range) => date_range.as_ref(), + None => bail!("Inconsistent QueryTimeDimension configuration: dateRange required."), + }; + + if date_range.len() == 1 { + bail!( + "Inconsistent dateRange configuration for the compare date range query: {}", + date_range[0] + ); + } + + Ok(date_range.join(COMPARE_DATE_RANGE_SEPARATOR)) +} + +/// Parse blending query key from time dimension for query. +pub fn get_blending_query_key(time_dimensions: Option<&Vec>) -> Result { + let dim = time_dimensions + .and_then(|dims| dims.first().cloned()) + .context("QueryTimeDimension should be specified for the blending query.")?; + + let granularity = dim + .granularity.clone() + .context(format!( + "Inconsistent QueryTimeDimension configuration for the blending query, granularity required: {:?}", + dim + ))?; + + Ok(format!("{}{}", BLENDING_QUERY_KEY_PREFIX, granularity)) +} + +/// Parse blending query key from time dimension for response. +pub fn get_blending_response_key( + time_dimensions: Option<&Vec>, +) -> Result { + let dim = time_dimensions + .and_then(|dims| dims.first().cloned()) + .context("QueryTimeDimension should be specified for the blending query.")?; + + let granularity = dim + .granularity.clone() + .context(format!( + "Inconsistent QueryTimeDimension configuration for the blending query, granularity required: {:?}", + dim + ))?; + + let dimension = dim.dimension.clone(); + + Ok(format!( + "{}{}{}", + dimension, BLENDING_QUERY_RES_SEPARATOR, granularity + )) +} + +/// Parse member names from request/response. +pub fn get_members( + query_type: &QueryType, + query: &NormalizedQuery, + db_data: &Vec>, + alias_to_member_name_map: &HashMap, + annotation: &HashMap, +) -> Result { + let mut members: MembersMap = HashMap::new(); + + if db_data.is_empty() { + return Ok(members); + } + + let columns = db_data[0].keys().collect::>(); + + for column in columns { + let member_name = alias_to_member_name_map + .get(column) + .context(format!("Member name not found for alias: '{}'", column))?; + + if !annotation.contains_key(member_name) { + bail!( + concat!( + "You requested hidden member: '{}'. Please make it visible using `shown: true`. ", + "Please note primaryKey fields are `shown: false` by default: ", + "https://cube.dev/docs/schema/reference/joins#setting-a-primary-key." + ), + column + ); + } + + members.insert(member_name.clone(), column.clone()); + + let path = member_name.split(MEMBER_SEPARATOR).collect::>(); + let calc_member = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); + + if path.len() == 3 + && query.dimensions.as_ref().map_or(true, |dims| { + !dims.iter().any(|dim| match dim { + MemberOrMemberExpression::Member(name) => *name == calc_member, + MemberOrMemberExpression::MemberExpression(expr) => expr.name == calc_member, + }) + }) + { + members.insert(calc_member, column.clone()); + } + } + + match query_type { + QueryType::CompareDateRangeQuery => { + members.insert( + COMPARE_DATE_RANGE_FIELD.to_string(), + QueryType::CompareDateRangeQuery.to_string(), + ); + } + QueryType::BlendingQuery => { + let blending_key = get_blending_query_key(query.time_dimensions.as_ref()) + .context("Failed to generate blending query key")?; + if let Some(dim) = query.time_dimensions.as_ref().and_then(|dims| dims.first().cloned()) { + members.insert(blending_key, dim.dimension.clone()); + } + } + _ => {} + } + + Ok(members) +} + +/// Convert DB response object to the compact output format. +pub fn get_compact_row( + members_to_alias_map: &HashMap, + annotation: &HashMap, + query_type: &QueryType, + members: &[String], + time_dimensions: Option<&Vec>, + db_row: &HashMap, +) -> Result> { + let mut row: Vec = Vec::with_capacity(members.len()); + + for m in members { + if let Some(annotation_item) = annotation.get(m) { + if let Some(alias) = members_to_alias_map.get(m) { + if let Some(value) = db_row.get(alias) { + row.push(transform_value(value.clone(), &annotation_item.member_type)); + } + } + } + } + + match query_type { + QueryType::CompareDateRangeQuery => { + row.push(DBResponsePrimitive::String(get_date_range_value( + time_dimensions, + )?)); + } + QueryType::BlendingQuery => { + let blending_key = get_blending_response_key(time_dimensions)?; + + if let Some(alias) = members_to_alias_map.get(&blending_key) { + if let Some(value) = db_row.get(alias) { + let member_type = annotation + .get(alias) + .map_or("", |annotation_item| &annotation_item.member_type); + + row.push(transform_value(value.clone(), member_type)); + } + } + } + _ => {} + } + + Ok(row) +} + +/// Convert DB response object to the vanilla output format. +pub fn get_vanilla_row( + alias_to_member_name_map: &HashMap, + annotation: &HashMap, + query_type: &QueryType, + query: &NormalizedQuery, + db_row: &HashMap, +) -> Result> { + let mut row = HashMap::new(); + + for (alias, value) in db_row { + let member_name = match alias_to_member_name_map.get(alias) { + Some(m) => m, + None => { + bail!("Missing member name for alias: {}", alias); + } + }; + + let annotation_for_member = match annotation.get(member_name) { + Some(am) => am, + None => { + bail!( + concat!( + "You requested hidden member: '{}'. Please make it visible using `shown: true`. ", + "Please note primaryKey fields are `shown: false` by default: ", + "https://cube.dev/docs/schema/reference/joins#setting-a-primary-key." + ), + alias + ) + } + }; + + let transformed_value = transform_value(value.clone(), &annotation_for_member.member_type); + + // Handle deprecated time dimensions without granularity + let path: Vec<&str> = member_name.split(MEMBER_SEPARATOR).collect(); + let member_name_without_granularity = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); + if path.len() == 3 + && query.dimensions.as_ref().map_or(true, |dims| { + !dims.iter().any(|dim| match dim { + MemberOrMemberExpression::Member(name) => { + *name == member_name_without_granularity + } + MemberOrMemberExpression::MemberExpression(expr) => { + expr.name == member_name_without_granularity + } + }) + }) + { + row.insert(member_name_without_granularity, transformed_value); + } else { + row.insert(member_name.clone(), transformed_value); + } + } + + match query_type { + QueryType::CompareDateRangeQuery => { + let date_range_value = get_date_range_value(query.time_dimensions.as_ref())?; + row.insert( + "compareDateRange".to_string(), + DBResponsePrimitive::String(date_range_value), + ); + } + QueryType::BlendingQuery => { + let blending_key = get_blending_query_key(query.time_dimensions.as_ref())?; + let response_key = get_blending_response_key(query.time_dimensions.as_ref())?; + + if let Some(value) = row.get(&response_key) { + row.insert(blending_key, value.clone()); + } + } + _ => {} + } + + Ok(row) +} + +/// Transforms queried data array to the output format. +pub fn transform_data( + alias_to_member_name_map: &HashMap, + annotation: &HashMap, + data: Vec>, + query: &NormalizedQuery, + query_type: &QueryType, + res_type: Option, +) -> Result { + let members_to_alias_map = get_members( + query_type, + query, + &data, + alias_to_member_name_map, + annotation, + )?; + let members: Vec = members_to_alias_map.keys().cloned().collect(); + + match res_type { + Some(ResultType::Compact) => { + let dataset: Vec<_> = data + .into_iter() + .map(|row| get_compact_row( + &members_to_alias_map, + annotation, + query_type, + &members, + query.time_dimensions.as_ref(), + &row)) + .collect::>>()?; + Ok(TransformedData::Compact { members, dataset }) + } + _ => { + let dataset: Vec<_> = data + .into_iter() + .map(|row| get_vanilla_row( + alias_to_member_name_map, + annotation, + query_type, + query, + &row, + )) + .collect::>>()?; + Ok(TransformedData::Vanilla(dataset)) + } + } +} diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index d1b30cc51fb59..fce899d7c1fb7 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -1,7 +1,13 @@ -use std::collections::HashMap; +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use serde_json::Value; -use chrono::{DateTime, Utc}; +use std::{collections::HashMap, fmt::Display}; + +pub const COMPARE_DATE_RANGE_FIELD: &str = "compareDateRange"; +pub const COMPARE_DATE_RANGE_SEPARATOR: &str = " - "; +pub const BLENDING_QUERY_KEY_PREFIX: &str = "time."; +pub const BLENDING_QUERY_RES_SEPARATOR: &str = "."; +pub const MEMBER_SEPARATOR: &str = "."; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum DBResponsePrimitive { @@ -37,6 +43,17 @@ pub enum QueryType { BlendingQuery, } +impl Display for QueryType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = serde_json::to_value(self) + .unwrap() + .as_str() + .unwrap() + .to_string(); + write!(f, "{}", str) + } +} + #[derive(Debug, Serialize, Deserialize)] pub enum MemberType { #[serde(rename = "measures")] @@ -98,14 +115,14 @@ pub struct QueryFilter { pub values: Option>, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct GroupingSet { pub group_type: String, pub id: u32, pub sub_id: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct ParsedMemberExpression { pub expression: Vec, #[serde(rename = "cubeName")] @@ -119,7 +136,7 @@ pub struct ParsedMemberExpression { pub grouping_set: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct QueryTimeDimension { pub dimension: String, pub date_range: Option>, @@ -127,10 +144,9 @@ pub struct QueryTimeDimension { pub granularity: Option, } -#[derive(Debug, Serialize, Deserialize)] -pub struct AliasToMemberMap { - pub map: HashMap, -} +pub type AliasToMemberMap = HashMap; + +pub type MembersMap = HashMap; #[derive(Debug, Serialize, Deserialize)] pub struct GranularityMeta { @@ -151,11 +167,11 @@ pub struct ConfigItem { #[serde(rename = "type")] pub member_type: String, pub format: String, - pub meta: serde_json::Value, + pub meta: Value, #[serde(skip_serializing_if = "Option::is_none")] - pub drill_members: Option>, + pub drill_members: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub drill_members_grouped: Option, + pub drill_members_grouped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub granularities: Option>, } @@ -174,7 +190,8 @@ pub struct NormalizedQueryFilter { pub dimension: Option, } -#[derive(Debug, Serialize, Deserialize)] +// XXX: Omitted function variant +#[derive(Debug, Serialize, Deserialize, PartialEq)] pub enum MemberOrMemberExpression { Member(String), MemberExpression(ParsedMemberExpression), @@ -250,3 +267,12 @@ pub struct NormalizedQuery { pub row_limit: Option, pub order: Option>, } + +#[derive(Debug, Serialize, Deserialize)] +pub enum TransformedData { + Compact { + members: Vec, + dataset: Vec>, + }, + Vanilla(Vec>), +} From 47afe85b27da8298115a421c60e2866aec88ed3a Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 2 Dec 2024 23:50:47 +0200 Subject: [PATCH 031/128] cargo fmt --- .../src/cubestore_result_transform.rs | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 9eb757b701445..5573fc7e3e272 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -146,7 +146,11 @@ pub fn get_members( QueryType::BlendingQuery => { let blending_key = get_blending_query_key(query.time_dimensions.as_ref()) .context("Failed to generate blending query key")?; - if let Some(dim) = query.time_dimensions.as_ref().and_then(|dims| dims.first().cloned()) { + if let Some(dim) = query + .time_dimensions + .as_ref() + .and_then(|dims| dims.first().cloned()) + { members.insert(blending_key, dim.dimension.clone()); } } @@ -301,26 +305,31 @@ pub fn transform_data( Some(ResultType::Compact) => { let dataset: Vec<_> = data .into_iter() - .map(|row| get_compact_row( + .map(|row| { + get_compact_row( &members_to_alias_map, annotation, query_type, &members, query.time_dimensions.as_ref(), - &row)) + &row, + ) + }) .collect::>>()?; Ok(TransformedData::Compact { members, dataset }) } _ => { let dataset: Vec<_> = data .into_iter() - .map(|row| get_vanilla_row( - alias_to_member_name_map, - annotation, - query_type, - query, - &row, - )) + .map(|row| { + get_vanilla_row( + alias_to_member_name_map, + annotation, + query_type, + query, + &row, + ) + }) .collect::>>()?; Ok(TransformedData::Vanilla(dataset)) } From f7230f1aa19085eab445900cb343b4347df0e109 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 2 Dec 2024 23:52:49 +0200 Subject: [PATCH 032/128] =?UTF-8?q?down=20chrono=20to=C2=A0same=20version?= =?UTF-8?q?=20as=C2=A0in=C2=A0cubesql=20(0.4.31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust/cubeorchestrator/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml index 58675e86c7cde..db54af9d3e912 100644 --- a/rust/cubeorchestrator/Cargo.toml +++ b/rust/cubeorchestrator/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -chrono = "0.4.38" +chrono = "0.4.31" cubeshared = { path = "../cubeshared" } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" From 1dd449dc527a3966e4bb1b16de8d13fbb3693b4b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 3 Dec 2024 00:13:59 +0200 Subject: [PATCH 033/128] =?UTF-8?q?fail=20fast=20in=C2=A0api=20gw=20load()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 322b91d1b32d0..8cfe1ce397b00 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1590,7 +1590,7 @@ class ApiGateway { } /** - * Convert adapter's result and other request paramters to a final + * Convert adapter's result and other request parameters to a final * result object. * @internal */ @@ -1733,6 +1733,17 @@ class ApiGateway { const [queryType, normalizedQueries] = await this.getNormalizedQueries(query, context); + if ( + queryType !== QueryTypeEnum.REGULAR_QUERY && + props.queryType == null + ) { + throw new UserError( + `'${queryType + }' query type is not supported by the client.` + + 'Please update the client.' + ); + } + let metaConfigResult = await (await this .getCompilerApi(context)).metaConfig(request.context, { requestId: context.requestId @@ -1794,17 +1805,6 @@ class ApiGateway { context, ); - if ( - queryType !== QueryTypeEnum.REGULAR_QUERY && - props.queryType == null - ) { - throw new UserError( - `'${queryType - }' query type is not supported by the client.` + - 'Please update the client.' - ); - } - if (props.queryType === 'multi') { res({ queryType, From 8d7e403c07b1946efaf166b5cbd76a9da9a95992 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 3 Dec 2024 00:14:46 +0200 Subject: [PATCH 034/128] update cargo.lock (syn crate) --- packages/cubejs-backend-native/Cargo.lock | 62 ++++++++++++----------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index 64736453ec854..a7f19f80fdd43 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -176,7 +176,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -187,7 +187,7 @@ checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -395,7 +395,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", "syn_derive", ] @@ -784,8 +784,12 @@ dependencies = [ name = "cubeorchestrator" version = "0.1.0" dependencies = [ + "anyhow", + "chrono", "cubeshared", "neon", + "serde", + "serde_json", ] [[package]] @@ -1226,7 +1230,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -1957,7 +1961,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" dependencies = [ "quote", - "syn 2.0.76", + "syn 2.0.90", "syn-mid", ] @@ -2197,7 +2201,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -2280,7 +2284,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -2414,9 +2418,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2512,7 +2516,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -2524,7 +2528,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -2923,29 +2927,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "indexmap 2.4.0", "itoa", @@ -3135,7 +3139,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -3174,9 +3178,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -3191,7 +3195,7 @@ checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -3203,7 +3207,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -3282,7 +3286,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -3360,7 +3364,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -3503,7 +3507,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] @@ -3762,7 +3766,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", "wasm-bindgen-shared", ] @@ -3796,7 +3800,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4053,7 +4057,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.90", ] [[package]] From e50ace540a870ee71239ef5cfe2d984a0296c35c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 3 Dec 2024 15:21:10 +0200 Subject: [PATCH 035/128] linter fix --- packages/cubejs-backend-native/src/node_export.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 20ef7e3e8ad9f..0e2f9c7224bf8 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -526,7 +526,7 @@ fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { for (i, row) in result.rows.iter().enumerate() { let js_row = cx.execute_scoped(|mut cx| { let js_row = JsObject::new(&mut cx); - for (key, value) in result.columns.iter().zip(row.into_iter()) { + for (key, value) in result.columns.iter().zip(row.iter()) { let js_key = cx.string(key); let js_value = cx.string(value); js_row.set(&mut cx, js_key, js_value)?; From c95b9a0b3344450ca21b343beb93df04bbdb2eba Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 9 Dec 2024 21:20:41 +0200 Subject: [PATCH 036/128] implement get_query_granularities & get_pivot_query --- .../src/cubestore_result_transform.rs | 71 ++++++++++++++++++- rust/cubeorchestrator/src/types.rs | 20 +++--- 2 files changed, 81 insertions(+), 10 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 5573fc7e3e272..1db4a7e6f7807 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -6,7 +6,7 @@ use crate::types::{ }; use anyhow::{bail, Context, Result}; use chrono::SecondsFormat; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; /// Transform specified `value` with specified `type` to the network protocol type. pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { @@ -335,3 +335,72 @@ pub fn transform_data( } } } + +/// Helper to get a list if unique granularities from normalized queries +pub fn get_query_granularities(queries: &[NormalizedQuery]) -> Vec { + queries + .iter() + .filter_map(|query| { + query + .time_dimensions + .as_ref() + .and_then(|tds| tds.get(0)) + .and_then(|td| td.granularity.clone()) + }) + .collect::>() + .into_iter() + .collect() +} + +/// Get Pivot Query for a list of queries +pub fn get_pivot_query(query_type: QueryType, queries: &[NormalizedQuery]) -> Result { + let mut pivot_query = queries + .first() + .cloned() + .ok_or_else(|| anyhow::anyhow!("Queries list cannot be empty"))?; + + match query_type { + QueryType::BlendingQuery => { + // Merge and deduplicate measures and dimensions across all queries + let mut merged_measures = HashSet::new(); + let mut merged_dimensions = HashSet::new(); + + for query in queries { + merged_measures.extend(query.measures.iter().cloned()); + if let Some(dimensions) = &query.dimensions { + merged_dimensions.extend(dimensions.iter().cloned()); + } + } + + pivot_query.measures = merged_measures.into_iter().collect(); + pivot_query.dimensions = if !merged_dimensions.is_empty() { + Some(merged_dimensions.into_iter().collect()) + } else { + None + }; + + // Add time dimensions + let granularities = get_query_granularities(queries); + if !granularities.is_empty() { + pivot_query.time_dimensions = Some(vec![QueryTimeDimension { + dimension: "time".to_string(), + date_range: None, + compare_date_range: None, + granularity: granularities.get(0).cloned(), + }]); + } + } + QueryType::CompareDateRangeQuery => { + let mut dimensions = vec![MemberOrMemberExpression::Member("compareDateRange".to_string())]; + if let Some(dims) = pivot_query.dimensions { + dimensions.extend(dims.clone()); + } + pivot_query.dimensions = Option::from(dimensions); + } + _ => {} + } + + pivot_query.query_type = query_type; + + Ok(pivot_query) +} diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index fce899d7c1fb7..18fa668967563 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -25,7 +25,7 @@ pub enum DBResponseValue { Object { value: DBResponsePrimitive }, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub enum ResultType { #[serde(rename = "default")] Default, @@ -33,7 +33,7 @@ pub enum ResultType { Compact, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub enum QueryType { #[serde(rename = "regularQuery")] RegularQuery, @@ -64,7 +64,7 @@ pub enum MemberType { Segments, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub enum FilterOperator { #[serde(rename = "equals")] Equals, @@ -115,14 +115,14 @@ pub struct QueryFilter { pub values: Option>, } -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] pub struct GroupingSet { pub group_type: String, pub id: u32, pub sub_id: Option, } -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] pub struct ParsedMemberExpression { pub expression: Vec, #[serde(rename = "cubeName")] @@ -176,13 +176,13 @@ pub struct ConfigItem { pub granularities: Option>, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct Order { pub id: String, pub desc: bool, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct NormalizedQueryFilter { pub member: String, pub operator: FilterOperator, @@ -191,7 +191,7 @@ pub struct NormalizedQueryFilter { } // XXX: Omitted function variant -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] pub enum MemberOrMemberExpression { Member(String), MemberExpression(ParsedMemberExpression), @@ -244,7 +244,7 @@ pub struct Query { pub response_format: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct NormalizedQuery { pub measures: Vec, pub dimensions: Option>, @@ -266,6 +266,8 @@ pub struct NormalizedQuery { #[serde(rename = "rowLimit")] pub row_limit: Option, pub order: Option>, + #[serde(rename = "queryType")] + pub query_type: QueryType, } #[derive(Debug, Serialize, Deserialize)] From 7adb813ec5ce1553425a0896ac389166bd9f5389 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 9 Dec 2024 23:46:40 +0200 Subject: [PATCH 037/128] prepare transformQueryData native wrapper --- packages/cubejs-backend-native/Cargo.lock | 1 + .../cubejs-backend-native/src/node_export.rs | 54 +++++++++++++++++++ rust/cubeorchestrator/Cargo.lock | 1 + rust/cubeorchestrator/Cargo.toml | 2 +- rust/cubeorchestrator/src/types.rs | 19 +++++-- 5 files changed, 73 insertions(+), 4 deletions(-) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index a7f19f80fdd43..a94b256a9b2ba 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -508,6 +508,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.48.5", ] diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 0e2f9c7224bf8..597bee525247d 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -38,6 +38,9 @@ use cubesql::{telemetry::ReportingLogger, CubeError}; use neon::prelude::*; use neon::types::buffer::TypedArray; +use serde::Deserialize; +use cubeorchestrator::cubestore_result_transform::transform_data; +use cubeorchestrator::types::{TransformDataRequest}; struct SQLInterface { services: Arc, @@ -543,6 +546,56 @@ fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(js_array.upcast()) } +fn js_object_to_struct(cx: &mut FunctionContext) -> Result +where + T: for<'de> Deserialize<'de>, +{ + let json_str = cx + .argument::(0)? + .value(cx); + + let result: Result = serde_json::from_str(&json_str); + match result { + Ok(value) => Ok(value), + Err(err) => cx.throw_error(err.to_string()), + } +} + +fn transform_query_data(mut cx: FunctionContext) -> JsResult { + let request_data: TransformDataRequest = js_object_to_struct(&mut cx)?; + + let alias_to_member_name_map = &request_data.alias_to_member_name_map; + let annotation = &request_data.annotation; + let data = &request_data.data; + let query = &request_data.query; + let query_type = &request_data.query_type; + let res_type = &request_data.res_type; + + let transformed = match transform_data( + alias_to_member_name_map, + annotation, + data.clone(), + query, + query_type, + res_type.clone(), + ) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()) + }; + + let json_data = match serde_json::to_string(&transformed) { + Ok(data) => data, + Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), + }; + + let js_string = cx.string(json_data); + + let js_result = cx.empty_object(); + js_result.set(&mut cx, "result", js_string)?; + + Ok(js_result) +} + pub fn register_module_exports( mut cx: ModuleContext, ) -> NeonResult<()> { @@ -562,6 +615,7 @@ pub fn register_module_exports( parse_cubestore_ws_result_message, )?; cx.export_function("getCubestoreResult", get_cubestore_result)?; + cx.export_function("transformQueryData", transform_query_data)?; crate::template::template_register_module(&mut cx)?; diff --git a/rust/cubeorchestrator/Cargo.lock b/rust/cubeorchestrator/Cargo.lock index c1d61bb12c13b..08d4c1cb73a26 100644 --- a/rust/cubeorchestrator/Cargo.lock +++ b/rust/cubeorchestrator/Cargo.lock @@ -93,6 +93,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets", ] diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml index db54af9d3e912..04d2a81fee755 100644 --- a/rust/cubeorchestrator/Cargo.toml +++ b/rust/cubeorchestrator/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -chrono = "0.4.31" +chrono = { version = "0.4.31", features = ["serde"] } cubeshared = { path = "../cubeshared" } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index 18fa668967563..a822bde81fa8e 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -17,7 +17,7 @@ pub enum DBResponsePrimitive { String(String), } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Deserialize)] pub enum DBResponseValue { DateTime(DateTime), Primitive(DBResponsePrimitive), @@ -148,7 +148,7 @@ pub type AliasToMemberMap = HashMap; pub type MembersMap = HashMap; -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct GranularityMeta { pub name: String, pub title: String, @@ -159,7 +159,7 @@ pub struct GranularityMeta { pub origin: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConfigItem { pub title: String, pub short_title: String, @@ -278,3 +278,16 @@ pub enum TransformedData { }, Vanilla(Vec>), } + +#[derive(Debug, Clone, Deserialize)] +pub struct TransformDataRequest { + #[serde(rename = "aliasToMemberNameMap")] + pub alias_to_member_name_map: HashMap, + pub annotation: HashMap, + pub data: Vec>, + pub query: NormalizedQuery, + #[serde(rename = "queryType")] + pub query_type: QueryType, + #[serde(rename = "resType")] + pub res_type: Option, +} From a9c9e7b8d92b2edc0d5e2f44a537cb5d460f6ddc Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 10 Dec 2024 12:28:08 +0200 Subject: [PATCH 038/128] =?UTF-8?q?small=20optimization:=20do=20not=20use?= =?UTF-8?q?=20native=20parsing=20for=C2=A0short=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-cubestore-driver/src/WebSocketConnection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts index 7095c0eda1aa7..40d37d516ad98 100644 --- a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts +++ b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts @@ -118,7 +118,7 @@ export class WebSocketConnection { throw new Error(`Cube Store missed message id: ${httpMessage.messageId()}`); // logging } - if (getEnv('nativeOrchestrator')) { + if (getEnv('nativeOrchestrator') && msg.length > 1000) { try { const nativeResMsg = parseCubestoreResultMessage(msg); resolvers.resolve(nativeResMsg); From e75133064e0a6d26722261204e69749bcc074d66 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 10 Dec 2024 12:44:56 +0200 Subject: [PATCH 039/128] =?UTF-8?q?refactor=20transformValue=20and=C2=A0re?= =?UTF-8?q?lated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/helpers/transformData.ts | 42 +++++++++------- .../src/helpers/transformValue.ts | 48 ------------------- .../cubejs-api-gateway/src/types/responses.ts | 20 ++++++++ .../test/helpers/transformData.test.ts | 6 +-- .../test/helpers/transformValue.test.ts | 12 +---- 5 files changed, 49 insertions(+), 79 deletions(-) delete mode 100644 packages/cubejs-api-gateway/src/helpers/transformValue.ts create mode 100644 packages/cubejs-api-gateway/src/types/responses.ts diff --git a/packages/cubejs-api-gateway/src/helpers/transformData.ts b/packages/cubejs-api-gateway/src/helpers/transformData.ts index 2e260bd7a99af..d3ab5e14dcfcd 100644 --- a/packages/cubejs-api-gateway/src/helpers/transformData.ts +++ b/packages/cubejs-api-gateway/src/helpers/transformData.ts @@ -6,25 +6,13 @@ */ import R from 'ramda'; +import moment, { MomentInput } from 'moment'; import { UserError } from '../UserError'; import { ConfigItem } from './prepareAnnotation'; -import { - DBResponsePrimitive, - DBResponseValue, - transformValue, -} from './transformValue'; -import { - NormalizedQuery, - QueryTimeDimension -} from '../types/query'; -import { - ResultType, - QueryType, -} from '../types/strings'; -import { - ResultType as ResultTypeEnum, - QueryType as QueryTypeEnum, -} from '../types/enums'; +import { NormalizedQuery, QueryTimeDimension } from '../types/query'; +import { QueryType, ResultType, } from '../types/strings'; +import { QueryType as QueryTypeEnum, ResultType as ResultTypeEnum, } from '../types/enums'; +import { DBResponsePrimitive, DBResponseValue } from '../types/responses'; const COMPARE_DATE_RANGE_FIELD = 'compareDateRange'; const COMPARE_DATE_RANGE_SEPARATOR = ' - '; @@ -175,6 +163,25 @@ function getMembers( return members; } +/** + * Transform specified `value` with specified `type` to the network + * protocol type. + */ +function transformValue( + value: DBResponseValue, + type: string +): DBResponsePrimitive { + // TODO: support for max time + if (value && (type === 'time' || value instanceof Date)) { + return ( + value instanceof Date + ? moment(value) + : moment.utc(value as MomentInput) + ).format(moment.HTML5_FMT.DATETIME_LOCAL_MS); + } + return value as DBResponsePrimitive; +} + /** * Convert DB response object to the compact output format. * @internal @@ -370,4 +377,5 @@ export { getCompactRow, getVanilaRow, transformData, + transformValue, }; diff --git a/packages/cubejs-api-gateway/src/helpers/transformValue.ts b/packages/cubejs-api-gateway/src/helpers/transformValue.ts deleted file mode 100644 index f56ae637673ad..0000000000000 --- a/packages/cubejs-api-gateway/src/helpers/transformValue.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @license Apache-2.0 - * @copyright Cube Dev, Inc. - * @fileoverview - * transformValue function and related types definition. - */ - -import moment, { MomentInput } from 'moment'; - -/** - * Query 'or'-filters type definition. - */ -type DBResponsePrimitive = - null | - boolean | - number | - string; - -type DBResponseValue = - Date | - DBResponsePrimitive | - { value: DBResponsePrimitive }; - -/** - * Transform specified `value` with specified `type` to the network - * protocol type. - */ -function transformValue( - value: DBResponseValue, - type: string -): DBResponsePrimitive { - // TODO: support for max time - if (value && (type === 'time' || value instanceof Date)) { - return ( - value instanceof Date - ? moment(value) - : moment.utc(value as MomentInput) - ).format(moment.HTML5_FMT.DATETIME_LOCAL_MS); - } - return value as DBResponsePrimitive; -} - -export default transformValue; -export { - DBResponsePrimitive, - DBResponseValue, - transformValue, -}; diff --git a/packages/cubejs-api-gateway/src/types/responses.ts b/packages/cubejs-api-gateway/src/types/responses.ts new file mode 100644 index 0000000000000..5a7cb1387eb93 --- /dev/null +++ b/packages/cubejs-api-gateway/src/types/responses.ts @@ -0,0 +1,20 @@ +/** + * Query 'or'-filters type definition. + */ +export type DBResponsePrimitive = + null | + boolean | + number | + string; + +export type DBResponseValue = + Date | + DBResponsePrimitive | + { value: DBResponsePrimitive }; + +export type TransformDataResponse = { + members: string[], + dataset: DBResponsePrimitive[][] +} | { + [member: string]: DBResponsePrimitive +}[]; diff --git a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts index 8936bd3d44418..48c210b7711e1 100644 --- a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts +++ b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts @@ -16,9 +16,6 @@ import { QueryType as QueryTypeEnum, ResultType as ResultTypeEnum, } from '../../src/types/enums'; -import { - DBResponseValue, -} from '../../src/helpers/transformValue'; import { ConfigItem, } from '../../src/helpers/prepareAnnotation'; @@ -41,6 +38,7 @@ import { import { QueryType, } from '../../src/types/strings'; +import { DBResponseValue } from '../../src/types/responses'; const mockData = { regular_discount_by_city: { @@ -792,7 +790,7 @@ describe('transformData helpers', () => { .timeDimensions ) ) as QueryTimeDimension[]; - + expect(() => { getBlendingResponseKey(); }).toThrow( diff --git a/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts b/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts index 54101c9fcb131..20637e2fe8dcd 100644 --- a/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts +++ b/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts @@ -5,19 +5,11 @@ */ /* globals describe,test,expect */ -/* eslint-disable import/no-duplicates */ -/* eslint-disable @typescript-eslint/no-duplicate-imports */ - import moment from 'moment'; -import transformValueDef from '../../src/helpers/transformValue'; -import { transformValue } from '../../src/helpers/transformValue'; + +import { transformValue } from '../../src/helpers/transformData'; describe('transformValue helper', () => { - test('export looks as expected', () => { - expect(transformValueDef).toBeDefined(); - expect(transformValue).toBeDefined(); - expect(transformValue).toEqual(transformValueDef); - }); test('object with the time value', () => { const date = Date(); expect(transformValue(date, 'time')).toBe( From e2744c91fe08c600b911b85a331e5771e406a8c9 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 10 Dec 2024 13:07:12 +0200 Subject: [PATCH 040/128] types restructure --- .../src/helpers/prepareAnnotation.ts | 1 + .../src/helpers/transformData.ts | 15 ++----------- packages/cubejs-api-gateway/src/index.ts | 1 + packages/cubejs-api-gateway/src/interfaces.ts | 16 ++++++++++++++ .../cubejs-api-gateway/src/types/responses.ts | 21 ++++++++++++++++--- packages/cubejs-backend-native/js/index.ts | 7 +++++++ 6 files changed, 45 insertions(+), 16 deletions(-) diff --git a/packages/cubejs-api-gateway/src/helpers/prepareAnnotation.ts b/packages/cubejs-api-gateway/src/helpers/prepareAnnotation.ts index 268e354279e0e..db0385e7248d4 100644 --- a/packages/cubejs-api-gateway/src/helpers/prepareAnnotation.ts +++ b/packages/cubejs-api-gateway/src/helpers/prepareAnnotation.ts @@ -154,6 +154,7 @@ function prepareAnnotation(metaConfig: MetaConfig[], query: any) { export default prepareAnnotation; export { ConfigItem, + GranularityMeta, annotation, prepareAnnotation, }; diff --git a/packages/cubejs-api-gateway/src/helpers/transformData.ts b/packages/cubejs-api-gateway/src/helpers/transformData.ts index d3ab5e14dcfcd..4ac6d86b01d49 100644 --- a/packages/cubejs-api-gateway/src/helpers/transformData.ts +++ b/packages/cubejs-api-gateway/src/helpers/transformData.ts @@ -12,7 +12,7 @@ import { ConfigItem } from './prepareAnnotation'; import { NormalizedQuery, QueryTimeDimension } from '../types/query'; import { QueryType, ResultType, } from '../types/strings'; import { QueryType as QueryTypeEnum, ResultType as ResultTypeEnum, } from '../types/enums'; -import { DBResponsePrimitive, DBResponseValue } from '../types/responses'; +import { AliasToMemberMap, DBResponsePrimitive, DBResponseValue, TransformDataResponse } from '../types/responses'; const COMPARE_DATE_RANGE_FIELD = 'compareDateRange'; const COMPARE_DATE_RANGE_SEPARATOR = ' - '; @@ -20,11 +20,6 @@ const BLENDING_QUERY_KEY_PREFIX = 'time.'; const BLENDING_QUERY_RES_SEPARATOR = '.'; const MEMBER_SEPARATOR = '.'; -/** - * SQL aliases to cube properties hash map. - */ -type AliasToMemberMap = { [alias: string]: string }; - /** * Parse date range value from time dimension. * @internal @@ -311,12 +306,7 @@ function transformData( query: NormalizedQuery, queryType: QueryType, resType?: ResultType -): { - members: string[], - dataset: DBResponsePrimitive[][] -} | { - [member: string]: DBResponsePrimitive -}[] { +): TransformDataResponse { const d = data as { [sqlAlias: string]: DBResponseValue }[]; const membersToAliasMap = getMembers( queryType, @@ -364,7 +354,6 @@ function transformData( export default transformData; export { - AliasToMemberMap, COMPARE_DATE_RANGE_FIELD, COMPARE_DATE_RANGE_SEPARATOR, BLENDING_QUERY_KEY_PREFIX, diff --git a/packages/cubejs-api-gateway/src/index.ts b/packages/cubejs-api-gateway/src/index.ts index ced6087014c9c..a990e663bf6e8 100644 --- a/packages/cubejs-api-gateway/src/index.ts +++ b/packages/cubejs-api-gateway/src/index.ts @@ -4,3 +4,4 @@ export * from './interfaces'; export * from './CubejsHandlerError'; export * from './UserError'; export { getRequestIdFromRequest } from './requestParser'; +export { TransformDataRequest } from './types/responses'; diff --git a/packages/cubejs-api-gateway/src/interfaces.ts b/packages/cubejs-api-gateway/src/interfaces.ts index aad8f106e3e85..681fa4507228c 100644 --- a/packages/cubejs-api-gateway/src/interfaces.ts +++ b/packages/cubejs-api-gateway/src/interfaces.ts @@ -10,6 +10,7 @@ import { import { QueryType, + ResultType, } from './types/enums'; import { @@ -43,9 +44,24 @@ import { QueryRequest } from './types/request'; +import { + AliasToMemberMap, + TransformDataResponse +} from './types/responses'; + +import { + ConfigItem, + GranularityMeta +} from './helpers/prepareAnnotation'; + export { + AliasToMemberMap, + TransformDataResponse, + ConfigItem, + GranularityMeta, QueryTimeDimensionGranularity, QueryType, + ResultType, QueryFilter, LogicalAndFilter, LogicalOrFilter, diff --git a/packages/cubejs-api-gateway/src/types/responses.ts b/packages/cubejs-api-gateway/src/types/responses.ts index 5a7cb1387eb93..6b9574aded535 100644 --- a/packages/cubejs-api-gateway/src/types/responses.ts +++ b/packages/cubejs-api-gateway/src/types/responses.ts @@ -1,6 +1,7 @@ -/** - * Query 'or'-filters type definition. - */ +import type { ConfigItem } from '../helpers/prepareAnnotation'; +import type { NormalizedQuery } from './query'; +import type { QueryType, ResultType } from './enums'; + export type DBResponsePrimitive = null | boolean | @@ -18,3 +19,17 @@ export type TransformDataResponse = { } | { [member: string]: DBResponsePrimitive }[]; + +/** + * SQL aliases to cube properties hash map. + */ +export type AliasToMemberMap = { [alias: string]: string }; + +export type TransformDataRequest = { + aliasToMemberNameMap: { [alias: string]: string }, + annotation: { [member: string]: ConfigItem }, + data: { [sqlAlias: string]: unknown }[], + query: NormalizedQuery, + queryType: QueryType, + resType?: ResultType +}; diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index e76425175c236..273863f33adbd 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -3,6 +3,7 @@ import fs from 'fs'; import path from 'path'; import { Writable } from 'stream'; import type { Request as ExpressRequest } from 'express'; +import type { TransformDataRequest, TransformDataResponse, } from '@cubejs-backend/api-gateway'; import { CubeStoreResultWrapper } from './CubeStoreResultWrapper'; export * from './CubeStoreResultWrapper'; @@ -366,6 +367,12 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; +export const transformData = (data: TransformDataRequest): TransformDataResponse => { + const native = loadNative(); + + return native.transformQueryData(data); +}; + export interface PyConfiguration { repositoryFactory?: (ctx: unknown) => Promise, logger?: (msg: string, params: Record) => void, From 8abdb6c66202ba5451f1bd21d09905b1130dbd0a Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 10 Dec 2024 21:14:37 +0200 Subject: [PATCH 041/128] =?UTF-8?q?debug=20and=C2=A0fix=20native=20transfo?= =?UTF-8?q?rm=5Fdata()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 23 ++- .../cubejs-api-gateway/src/types/responses.ts | 2 +- .../js/CubeStoreResultWrapper.ts | 4 + packages/cubejs-backend-native/js/index.ts | 22 ++- .../cubejs-backend-native/src/node_export.rs | 29 ++-- .../src/cubestore_message_parser.rs | 14 +- .../src/cubestore_result_transform.rs | 144 +++++++++--------- rust/cubeorchestrator/src/types.rs | 45 ++++-- 8 files changed, 164 insertions(+), 119 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 8cfe1ce397b00..eedd5e94c3ba6 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -10,6 +10,7 @@ import { getRealType, QueryAlias, } from '@cubejs-backend/shared'; +import { transformData as transformDataNative, TransformDataResponse } from '@cubejs-backend/native'; import type { Application as ExpressApplication, ErrorRequestHandler, @@ -1616,9 +1617,20 @@ class ApiGateway { response: any, responseType?: ResultType, ) { - return { - query: normalizedQuery, - data: transformData( + const data = response.data.isNative ? + JSON.parse(transformDataNative(JSON.stringify({ + aliasToMemberNameMap: sqlQuery.aliasNameToMember, + annotation: { + ...annotation.measures, + ...annotation.dimensions, + ...annotation.timeDimensions + }, + query: normalizedQuery, + queryType, + resType: responseType, + }), response.data.getNativeRef()).result) as TransformDataResponse + : + transformData( sqlQuery.aliasNameToMember, { ...annotation.measures, @@ -1629,7 +1641,10 @@ class ApiGateway { normalizedQuery, queryType, responseType, - ), + ); + return { + query: normalizedQuery, + data, lastRefreshTime: response.lastRefreshTime?.toISOString(), ...( getEnv('devMode') || diff --git a/packages/cubejs-api-gateway/src/types/responses.ts b/packages/cubejs-api-gateway/src/types/responses.ts index 6b9574aded535..d5e1d8ea1e0aa 100644 --- a/packages/cubejs-api-gateway/src/types/responses.ts +++ b/packages/cubejs-api-gateway/src/types/responses.ts @@ -1,6 +1,6 @@ import type { ConfigItem } from '../helpers/prepareAnnotation'; import type { NormalizedQuery } from './query'; -import type { QueryType, ResultType } from './enums'; +import type { QueryType, ResultType } from './strings'; export type DBResponsePrimitive = null | diff --git a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts index 8e1db1b1e7f30..6693fb06c156b 100644 --- a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts +++ b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts @@ -77,4 +77,8 @@ export class CubeStoreResultWrapper { const array = this.getArray(); return (array as any)[method](...args); } + + public getNativeRef() { + return this.nativeReference; + } } diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 273863f33adbd..c841fd4628488 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -3,7 +3,6 @@ import fs from 'fs'; import path from 'path'; import { Writable } from 'stream'; import type { Request as ExpressRequest } from 'express'; -import type { TransformDataRequest, TransformDataResponse, } from '@cubejs-backend/api-gateway'; import { CubeStoreResultWrapper } from './CubeStoreResultWrapper'; export * from './CubeStoreResultWrapper'; @@ -102,6 +101,23 @@ export type SQLInterfaceOptions = { gatewayPort?: number, }; +export type DBResponsePrimitive = + null | + boolean | + number | + string; + +export type TransformDataResponse = { + members: string[], + dataset: DBResponsePrimitive[][] +} | { + [member: string]: DBResponsePrimitive +}[]; + +export type TransformDataResponseNative = { + result: string +}; + export function loadNative() { // Development version if (fs.existsSync(path.join(__dirname, '/../../index.node'))) { @@ -367,10 +383,10 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; -export const transformData = (data: TransformDataRequest): TransformDataResponse => { +export const transformData = (transformDataJson: string, rows: any): TransformDataResponseNative => { const native = loadNative(); - return native.transformQueryData(data); + return native.transformQueryData(transformDataJson, rows); }; export interface PyConfiguration { diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 597bee525247d..661f52fb4cb8c 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -38,7 +38,6 @@ use cubesql::{telemetry::ReportingLogger, CubeError}; use neon::prelude::*; use neon::types::buffer::TypedArray; -use serde::Deserialize; use cubeorchestrator::cubestore_result_transform::transform_data; use cubeorchestrator::types::{TransformDataRequest}; @@ -546,37 +545,29 @@ fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(js_array.upcast()) } -fn js_object_to_struct(cx: &mut FunctionContext) -> Result -where - T: for<'de> Deserialize<'de>, -{ +fn transform_query_data(mut cx: FunctionContext) -> JsResult { let json_str = cx .argument::(0)? - .value(cx); - - let result: Result = serde_json::from_str(&json_str); - match result { - Ok(value) => Ok(value), - Err(err) => cx.throw_error(err.to_string()), - } -} + .value(&mut cx); + let request_data = match serde_json::from_str::(&json_str) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; -fn transform_query_data(mut cx: FunctionContext) -> JsResult { - let request_data: TransformDataRequest = js_object_to_struct(&mut cx)?; + let cube_store_result = cx.argument::>(1)?; let alias_to_member_name_map = &request_data.alias_to_member_name_map; let annotation = &request_data.annotation; - let data = &request_data.data; let query = &request_data.query; - let query_type = &request_data.query_type; + let query_type = &request_data.query_type.unwrap_or_default(); let res_type = &request_data.res_type; let transformed = match transform_data( alias_to_member_name_map, annotation, - data.clone(), + &**cube_store_result, query, - query_type, + &query_type, res_type.clone(), ) { Ok(data) => data, diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 3815956fed600..8d9447e418836 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,3 +1,4 @@ +use std::collections::HashMap; use cubeshared::codegen::{root_as_http_message, HttpCommand}; use neon::prelude::Finalize; @@ -29,6 +30,7 @@ impl std::error::Error for ParseError {} pub struct CubeStoreResult { pub columns: Vec, pub rows: Vec>, + pub columns_pos: HashMap, } impl Finalize for CubeStoreResult {} @@ -38,6 +40,7 @@ impl CubeStoreResult { let mut result = CubeStoreResult { columns: vec![], rows: vec![], + columns_pos: HashMap::new(), }; let http_message = @@ -62,10 +65,15 @@ impl CubeStoreResult { return Err(ParseError::ColumnNameNotDefined); } - result.columns = result_set_columns + let (columns, columns_pos): (Vec<_>, HashMap<_, _>) = result_set_columns .iter() - .map(|val| val.to_owned()) - .collect(); + .enumerate() + .map(|(index, column_name)| (column_name.to_owned(), (column_name.to_owned(), index))) + .unzip(); + + result.columns = columns; + result.columns_pos = columns_pos; + let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; result.rows = Vec::with_capacity(result_set_rows.len()); diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 1db4a7e6f7807..c9c1296b99431 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -1,23 +1,22 @@ use crate::types::{ - ConfigItem, DBResponsePrimitive, DBResponseValue, MemberOrMemberExpression, MembersMap, + ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, ResultType, TransformedData, BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, }; use anyhow::{bail, Context, Result}; -use chrono::SecondsFormat; +use chrono::{DateTime, SecondsFormat}; use std::collections::{HashMap, HashSet}; +use crate::cubestore_message_parser::CubeStoreResult; /// Transform specified `value` with specified `type` to the network protocol type. -pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { - match value { - DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { - let formatted = dt.to_rfc3339_opts(SecondsFormat::Millis, true); - DBResponsePrimitive::String(formatted) - } - DBResponseValue::Primitive(p) => p, - DBResponseValue::Object { value } => value, - _ => DBResponsePrimitive::Null, +pub fn transform_value(value: String, type_: &str) -> String { + if type_ == "time" || type_.is_empty() { + DateTime::parse_from_rfc3339(&value) + .map(|dt| dt.to_rfc3339_opts(SecondsFormat::Millis, true)) + .unwrap_or_else(|_| value) + } else { + value } } @@ -91,19 +90,17 @@ pub fn get_blending_response_key( pub fn get_members( query_type: &QueryType, query: &NormalizedQuery, - db_data: &Vec>, + db_data: &CubeStoreResult, alias_to_member_name_map: &HashMap, annotation: &HashMap, ) -> Result { let mut members: MembersMap = HashMap::new(); - if db_data.is_empty() { + if db_data.columns.is_empty() { return Ok(members); } - let columns = db_data[0].keys().collect::>(); - - for column in columns { + for column in db_data.columns.iter() { let member_name = alias_to_member_name_map .get(column) .context(format!("Member name not found for alias: '{}'", column))?; @@ -126,10 +123,7 @@ pub fn get_members( if path.len() == 3 && query.dimensions.as_ref().map_or(true, |dims| { - !dims.iter().any(|dim| match dim { - MemberOrMemberExpression::Member(name) => *name == calc_member, - MemberOrMemberExpression::MemberExpression(expr) => expr.name == calc_member, - }) + !dims.iter().any(|dim| *dim == calc_member) }) { members.insert(calc_member, column.clone()); @@ -167,15 +161,18 @@ pub fn get_compact_row( query_type: &QueryType, members: &[String], time_dimensions: Option<&Vec>, - db_row: &HashMap, -) -> Result> { - let mut row: Vec = Vec::with_capacity(members.len()); + db_row: &Vec, + columns_pos: &HashMap, +) -> Result> { + let mut row: Vec = Vec::with_capacity(members.len()); for m in members { if let Some(annotation_item) = annotation.get(m) { if let Some(alias) = members_to_alias_map.get(m) { - if let Some(value) = db_row.get(alias) { - row.push(transform_value(value.clone(), &annotation_item.member_type)); + if let Some(key) = columns_pos.get(alias) { + if let Some(value) = db_row.get(*key) { + row.push(transform_value(value.clone(), &annotation_item.member_type)); + } } } } @@ -183,20 +180,20 @@ pub fn get_compact_row( match query_type { QueryType::CompareDateRangeQuery => { - row.push(DBResponsePrimitive::String(get_date_range_value( - time_dimensions, - )?)); + row.push(get_date_range_value(time_dimensions)?); } QueryType::BlendingQuery => { let blending_key = get_blending_response_key(time_dimensions)?; if let Some(alias) = members_to_alias_map.get(&blending_key) { - if let Some(value) = db_row.get(alias) { - let member_type = annotation - .get(alias) - .map_or("", |annotation_item| &annotation_item.member_type); + if let Some(key) = columns_pos.get(alias) { + if let Some(value) = db_row.get(*key) { + let member_type = annotation + .get(alias) + .map_or("", |annotation_item| &annotation_item.member_type); - row.push(transform_value(value.clone(), member_type)); + row.push(transform_value(value.clone(), member_type)); + } } } } @@ -212,22 +209,25 @@ pub fn get_vanilla_row( annotation: &HashMap, query_type: &QueryType, query: &NormalizedQuery, - db_row: &HashMap, -) -> Result> { + db_row: &Vec, + columns_pos: &HashMap, +) -> Result> { let mut row = HashMap::new(); - for (alias, value) in db_row { - let member_name = match alias_to_member_name_map.get(alias) { - Some(m) => m, - None => { - bail!("Missing member name for alias: {}", alias); - } - }; + for (alias, &index) in columns_pos { + if let Some(value) = db_row.get(index) { - let annotation_for_member = match annotation.get(member_name) { - Some(am) => am, - None => { - bail!( + let member_name = match alias_to_member_name_map.get(alias) { + Some(m) => m, + None => { + bail!("Missing member name for alias: {}", alias); + } + }; + + let annotation_for_member = match annotation.get(member_name) { + Some(am) => am, + None => { + bail!( concat!( "You requested hidden member: '{}'. Please make it visible using `shown: true`. ", "Please note primaryKey fields are `shown: false` by default: ", @@ -235,29 +235,23 @@ pub fn get_vanilla_row( ), alias ) - } - }; + } + }; - let transformed_value = transform_value(value.clone(), &annotation_for_member.member_type); + let transformed_value = transform_value(value.clone(), &annotation_for_member.member_type); - // Handle deprecated time dimensions without granularity - let path: Vec<&str> = member_name.split(MEMBER_SEPARATOR).collect(); - let member_name_without_granularity = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); - if path.len() == 3 - && query.dimensions.as_ref().map_or(true, |dims| { - !dims.iter().any(|dim| match dim { - MemberOrMemberExpression::Member(name) => { - *name == member_name_without_granularity - } - MemberOrMemberExpression::MemberExpression(expr) => { - expr.name == member_name_without_granularity - } - }) + // Handle deprecated time dimensions without granularity + let path: Vec<&str> = member_name.split(MEMBER_SEPARATOR).collect(); + let member_name_without_granularity = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); + if path.len() == 3 + && query.dimensions.as_ref().map_or(true, |dims| { + !dims.iter().any(|dim| *dim == member_name_without_granularity) }) - { - row.insert(member_name_without_granularity, transformed_value); - } else { - row.insert(member_name.clone(), transformed_value); + { + row.insert(member_name_without_granularity, transformed_value); + } else { + row.insert(member_name.clone(), transformed_value); + } } } @@ -266,7 +260,7 @@ pub fn get_vanilla_row( let date_range_value = get_date_range_value(query.time_dimensions.as_ref())?; row.insert( "compareDateRange".to_string(), - DBResponsePrimitive::String(date_range_value), + date_range_value, ); } QueryType::BlendingQuery => { @@ -287,7 +281,7 @@ pub fn get_vanilla_row( pub fn transform_data( alias_to_member_name_map: &HashMap, annotation: &HashMap, - data: Vec>, + data: &CubeStoreResult, query: &NormalizedQuery, query_type: &QueryType, res_type: Option, @@ -303,8 +297,8 @@ pub fn transform_data( match res_type { Some(ResultType::Compact) => { - let dataset: Vec<_> = data - .into_iter() + let dataset: Vec<_> = data.rows + .iter() .map(|row| { get_compact_row( &members_to_alias_map, @@ -313,14 +307,15 @@ pub fn transform_data( &members, query.time_dimensions.as_ref(), &row, + &data.columns_pos, ) }) .collect::>>()?; Ok(TransformedData::Compact { members, dataset }) } _ => { - let dataset: Vec<_> = data - .into_iter() + let dataset: Vec<_> = data.rows + .iter() .map(|row| { get_vanilla_row( alias_to_member_name_map, @@ -328,6 +323,7 @@ pub fn transform_data( query_type, query, &row, + &data.columns_pos, ) }) .collect::>>()?; @@ -391,7 +387,7 @@ pub fn get_pivot_query(query_type: QueryType, queries: &[NormalizedQuery]) -> Re } } QueryType::CompareDateRangeQuery => { - let mut dimensions = vec![MemberOrMemberExpression::Member("compareDateRange".to_string())]; + let mut dimensions = vec!["compareDateRange".to_string()]; if let Some(dims) = pivot_query.dimensions { dimensions.extend(dims.clone()); } @@ -400,7 +396,7 @@ pub fn get_pivot_query(query_type: QueryType, queries: &[NormalizedQuery]) -> Re _ => {} } - pivot_query.query_type = query_type; + pivot_query.query_type = Option::from(query_type); Ok(pivot_query) } diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index a822bde81fa8e..6e6f23bf74b05 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -9,6 +9,7 @@ pub const BLENDING_QUERY_KEY_PREFIX: &str = "time."; pub const BLENDING_QUERY_RES_SEPARATOR: &str = "."; pub const MEMBER_SEPARATOR: &str = "."; +// TODO: Seems to be unused #[derive(Debug, Clone, Serialize, Deserialize)] pub enum DBResponsePrimitive { Null, @@ -17,6 +18,7 @@ pub enum DBResponsePrimitive { String(String), } +// TODO: Seems to be unused #[derive(Debug, Clone, Deserialize)] pub enum DBResponseValue { DateTime(DateTime), @@ -54,6 +56,12 @@ impl Display for QueryType { } } +impl Default for QueryType { + fn default() -> Self { + QueryType::RegularQuery + } +} + #[derive(Debug, Serialize, Deserialize)] pub enum MemberType { #[serde(rename = "measures")] @@ -162,12 +170,12 @@ pub struct GranularityMeta { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConfigItem { pub title: String, - pub short_title: String, - pub description: String, + pub short_title: Option, + pub description: Option, #[serde(rename = "type")] pub member_type: String, - pub format: String, - pub meta: Value, + pub format: Option, + pub meta: Option, #[serde(skip_serializing_if = "Option::is_none")] pub drill_members: Option>, #[serde(skip_serializing_if = "Option::is_none")] @@ -190,6 +198,7 @@ pub struct NormalizedQueryFilter { pub dimension: Option, } +// TODO: Not used, as all members are made as Strings for now // XXX: Omitted function variant #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] pub enum MemberOrMemberExpression { @@ -224,12 +233,15 @@ pub enum LogicalFilter { #[derive(Debug, Serialize, Deserialize)] pub struct Query { - pub measures: Vec, - pub dimensions: Option>, + // pub measures: Vec, + pub measures: Vec, + // pub dimensions: Option>, + pub dimensions: Option>, pub filters: Option>, #[serde(rename = "timeDimensions")] pub time_dimensions: Option>, - pub segments: Option>, + // pub segments: Option>, + pub segments: Option>, pub limit: Option, pub offset: Option, pub total: Option, @@ -246,11 +258,14 @@ pub struct Query { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct NormalizedQuery { - pub measures: Vec, - pub dimensions: Option>, + // pub measures: Vec, + pub measures: Vec, + // pub dimensions: Option>, + pub dimensions: Option>, #[serde(rename = "timeDimensions")] pub time_dimensions: Option>, - pub segments: Option>, + // pub segments: Option>, + pub segments: Option>, pub limit: Option, pub offset: Option, pub total: Option, @@ -267,16 +282,17 @@ pub struct NormalizedQuery { pub row_limit: Option, pub order: Option>, #[serde(rename = "queryType")] - pub query_type: QueryType, + pub query_type: Option, } #[derive(Debug, Serialize, Deserialize)] +#[serde(untagged)] pub enum TransformedData { Compact { members: Vec, - dataset: Vec>, + dataset: Vec>, }, - Vanilla(Vec>), + Vanilla(Vec>), } #[derive(Debug, Clone, Deserialize)] @@ -284,10 +300,9 @@ pub struct TransformDataRequest { #[serde(rename = "aliasToMemberNameMap")] pub alias_to_member_name_map: HashMap, pub annotation: HashMap, - pub data: Vec>, pub query: NormalizedQuery, #[serde(rename = "queryType")] - pub query_type: QueryType, + pub query_type: Option, #[serde(rename = "resType")] pub res_type: Option, } From 626a89f2099cbc08470feccc4e0008204526402e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 10 Dec 2024 23:12:28 +0200 Subject: [PATCH 042/128] lazy transformData evaluation --- packages/cubejs-api-gateway/src/gateway.ts | 80 ++++--- .../src/helpers/transformData.ts | 23 +- .../cubejs-api-gateway/src/types/responses.ts | 2 + .../test/helpers/transformData.test.ts | 210 +++++++++--------- 4 files changed, 173 insertions(+), 142 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index eedd5e94c3ba6..28ee454c59478 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -92,6 +92,7 @@ import { transformJoins, transformPreAggregations, } from './helpers/transformMetaExtended'; +import { TransformDataResponseCb } from './types/responses'; type HandleErrorOptions = { e: any, @@ -1617,34 +1618,36 @@ class ApiGateway { response: any, responseType?: ResultType, ) { - const data = response.data.isNative ? - JSON.parse(transformDataNative(JSON.stringify({ - aliasToMemberNameMap: sqlQuery.aliasNameToMember, - annotation: { - ...annotation.measures, - ...annotation.dimensions, - ...annotation.timeDimensions - }, - query: normalizedQuery, - queryType, - resType: responseType, - }), response.data.getNativeRef()).result) as TransformDataResponse + const transformDataParams = { + aliasToMemberNameMap: sqlQuery.aliasNameToMember, + annotation: { + ...annotation.measures, + ...annotation.dimensions, + ...annotation.timeDimensions + } as { [member: string]: ConfigItem }, + query: normalizedQuery, + queryType, + resType: responseType, + }; + + // We postpone data transformation until the last minute + // in case when all responses are native - we process them in native part + const dataCb: TransformDataResponseCb = response.data.isNative ? + () => JSON.parse( + transformDataNative( + JSON.stringify(transformDataParams), response.data.getNativeRef() + ).result + ) as TransformDataResponse : - transformData( - sqlQuery.aliasNameToMember, - { - ...annotation.measures, - ...annotation.dimensions, - ...annotation.timeDimensions - } as { [member: string]: ConfigItem }, - response.data, - normalizedQuery, - queryType, - responseType, - ); + () => transformData({ + ...transformDataParams, + data: response.data, + }); + return { query: normalizedQuery, - data, + dataCb, + transformDataParams, lastRefreshTime: response.lastRefreshTime?.toISOString(), ...( getEnv('devMode') || @@ -1664,6 +1667,7 @@ class ApiGateway { external: response.external, slowQuery: Boolean(response.slowQuery), total: normalizedQuery.total ? response.total : null, + isNative: response.data.isNative }; } @@ -1813,22 +1817,40 @@ class ApiGateway { r.usedPreAggregations || {} ).length ).length, - queriesWithData: - results.filter((r: any) => r.data?.length).length, + // Have to omit because data could be processed natively + // so it is not known at this point + // queriesWithData: + // results.filter((r: any) => r.data?.length).length, dbType: results.map(r => r.dbType), }, context, ); + const allNative = results.every(r => r.isNative); + if (props.queryType === 'multi') { res({ queryType, - results, + results: results.map(r => { + const data = r.dataCb(); + return { + ...r, + data, + dataCb: undefined, + transformDataParams: undefined + }; + }), pivotQuery: getPivotQuery(queryType, normalizedQueries), slowQuery }); } else { - res(results[0]); + const data = results[0].dataCb(); + res({ + ...results[0], + data, + dataCb: undefined, + transformDataParams: undefined + }); } } catch (e: any) { this.handleError({ diff --git a/packages/cubejs-api-gateway/src/helpers/transformData.ts b/packages/cubejs-api-gateway/src/helpers/transformData.ts index 4ac6d86b01d49..f05e325a65c48 100644 --- a/packages/cubejs-api-gateway/src/helpers/transformData.ts +++ b/packages/cubejs-api-gateway/src/helpers/transformData.ts @@ -299,14 +299,21 @@ function getVanilaRow( /** * Transforms queried data array to the output format. */ -function transformData( - aliasToMemberNameMap: AliasToMemberMap, - annotation: { [member: string]: ConfigItem }, - data: { [sqlAlias: string]: unknown }[], - query: NormalizedQuery, - queryType: QueryType, - resType?: ResultType -): TransformDataResponse { +function transformData({ + aliasToMemberNameMap, + annotation, + data, + query, + queryType, + resType, +}: { + aliasToMemberNameMap: AliasToMemberMap; + annotation: { [member: string]: ConfigItem }; + data: { [sqlAlias: string]: unknown }[]; + query: NormalizedQuery; + queryType: QueryType; + resType?: ResultType; +}): TransformDataResponse { const d = data as { [sqlAlias: string]: DBResponseValue }[]; const membersToAliasMap = getMembers( queryType, diff --git a/packages/cubejs-api-gateway/src/types/responses.ts b/packages/cubejs-api-gateway/src/types/responses.ts index d5e1d8ea1e0aa..bdbc1ee63e4a4 100644 --- a/packages/cubejs-api-gateway/src/types/responses.ts +++ b/packages/cubejs-api-gateway/src/types/responses.ts @@ -33,3 +33,5 @@ export type TransformDataRequest = { queryType: QueryType, resType?: ResultType }; + +export type TransformDataResponseCb = () => TransformDataResponse; diff --git a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts index 48c210b7711e1..ddea9da955b4b 100644 --- a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts +++ b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts @@ -1133,25 +1133,25 @@ describe('transformData default mode', () => { JSON.stringify(mockData.regular_discount_by_city.data) ); delete data.aliasToMemberNameMap.e_commerce_records_us2021__avg_discount; - expect(() => transformData( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.data, - data.query as unknown as NormalizedQuery, - data.queryType as QueryType, - )).toThrow(); + expect(() => transformData({ + aliasToMemberNameMap: data.aliasToMemberNameMap, + annotation: data.annotation as unknown as { [member: string]: ConfigItem }, + data: data.data, + query: data.query as unknown as NormalizedQuery, + queryType: data.queryType as QueryType, + })).toThrow(); data = JSON.parse( JSON.stringify(mockData.regular_discount_by_city.data) ); expect( - transformData( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.data, - data.query as unknown as NormalizedQuery, - data.queryType as QueryType, - ) + transformData({ + aliasToMemberNameMap: data.aliasToMemberNameMap, + annotation: data.annotation as unknown as { [member: string]: ConfigItem }, + data: data.data, + query: data.query as unknown as NormalizedQuery, + queryType: data.queryType as QueryType, + }) ).toEqual(data.result_default); }); @@ -1160,13 +1160,13 @@ describe('transformData default mode', () => { JSON.stringify(mockData.regular_profit_by_postal_code.data) ); expect( - transformData( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.data, - data.query as unknown as NormalizedQuery, - data.queryType as QueryType, - ) + transformData({ + aliasToMemberNameMap: data.aliasToMemberNameMap, + annotation: data.annotation as unknown as { [member: string]: ConfigItem }, + data: data.data, + query: data.query as unknown as NormalizedQuery, + queryType: data.queryType as QueryType, + }) ).toEqual(data.result_default); }); @@ -1176,23 +1176,23 @@ describe('transformData default mode', () => { ); expect( - transformData( - data[0].aliasToMemberNameMap, - data[0].annotation as unknown as { [member: string]: ConfigItem }, - data[0].data, - data[0].query as unknown as NormalizedQuery, - data[0].queryType as QueryType, - ) + transformData({ + aliasToMemberNameMap: data[0].aliasToMemberNameMap, + annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, + data: data[0].data, + query: data[0].query as unknown as NormalizedQuery, + queryType: data[0].queryType as QueryType, + }) ).toEqual(data[0].result_default); expect( - transformData( - data[1].aliasToMemberNameMap, - data[1].annotation as unknown as { [member: string]: ConfigItem }, - data[1].data, - data[1].query as unknown as NormalizedQuery, - data[1].queryType as QueryType, - ) + transformData({ + aliasToMemberNameMap: data[1].aliasToMemberNameMap, + annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, + data: data[1].data, + query: data[1].query as unknown as NormalizedQuery, + queryType: data[1].queryType as QueryType, + }) ).toEqual(data[1].result_default); }); @@ -1206,23 +1206,23 @@ describe('transformData default mode', () => { ); expect( - transformData( - data[0].aliasToMemberNameMap, - data[0].annotation as unknown as { [member: string]: ConfigItem }, - data[0].data, - data[0].query as unknown as NormalizedQuery, - data[0].queryType as QueryType, - ) + transformData({ + aliasToMemberNameMap: data[0].aliasToMemberNameMap, + annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, + data: data[0].data, + query: data[0].query as unknown as NormalizedQuery, + queryType: data[0].queryType as QueryType, + }) ).toEqual(data[0].result_default); expect( - transformData( - data[1].aliasToMemberNameMap, - data[1].annotation as unknown as { [member: string]: ConfigItem }, - data[1].data, - data[1].query as unknown as NormalizedQuery, - data[1].queryType as QueryType, - ) + transformData({ + aliasToMemberNameMap: data[1].aliasToMemberNameMap, + annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, + data: data[1].data, + query: data[1].query as unknown as NormalizedQuery, + queryType: data[1].queryType as QueryType, + }) ).toEqual(data[1].result_default); }); }); @@ -1235,27 +1235,27 @@ describe('transformData compact mode', () => { JSON.stringify(mockData.regular_discount_by_city.data) ); delete data.aliasToMemberNameMap.e_commerce_records_us2021__avg_discount; - expect(() => transformData( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.data, - data.query as unknown as NormalizedQuery, - data.queryType as QueryType, - ResultTypeEnum.COMPACT, - )).toThrow(); + expect(() => transformData({ + aliasToMemberNameMap: data.aliasToMemberNameMap, + annotation: data.annotation as unknown as { [member: string]: ConfigItem }, + data: data.data, + query: data.query as unknown as NormalizedQuery, + queryType: data.queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + })).toThrow(); data = JSON.parse( JSON.stringify(mockData.regular_discount_by_city.data) ); expect( - transformData( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.data, - data.query as unknown as NormalizedQuery, - data.queryType as QueryType, - ResultTypeEnum.COMPACT, - ) + transformData({ + aliasToMemberNameMap: data.aliasToMemberNameMap, + annotation: data.annotation as unknown as { [member: string]: ConfigItem }, + data: data.data, + query: data.query as unknown as NormalizedQuery, + queryType: data.queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + }) ).toEqual(data.result_compact); }); @@ -1264,14 +1264,14 @@ describe('transformData compact mode', () => { JSON.stringify(mockData.regular_profit_by_postal_code.data) ); expect( - transformData( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.data, - data.query as unknown as NormalizedQuery, - data.queryType as QueryType, - ResultTypeEnum.COMPACT, - ) + transformData({ + aliasToMemberNameMap: data.aliasToMemberNameMap, + annotation: data.annotation as unknown as { [member: string]: ConfigItem }, + data: data.data, + query: data.query as unknown as NormalizedQuery, + queryType: data.queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + }) ).toEqual(data.result_compact); }); @@ -1281,25 +1281,25 @@ describe('transformData compact mode', () => { ); expect( - transformData( - data[0].aliasToMemberNameMap, - data[0].annotation as unknown as { [member: string]: ConfigItem }, - data[0].data, - data[0].query as unknown as NormalizedQuery, - data[0].queryType as QueryType, - ResultTypeEnum.COMPACT, - ) + transformData({ + aliasToMemberNameMap: data[0].aliasToMemberNameMap, + annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, + data: data[0].data, + query: data[0].query as unknown as NormalizedQuery, + queryType: data[0].queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + }) ).toEqual(data[0].result_compact); expect( - transformData( - data[1].aliasToMemberNameMap, - data[1].annotation as unknown as { [member: string]: ConfigItem }, - data[1].data, - data[1].query as unknown as NormalizedQuery, - data[1].queryType as QueryType, - ResultTypeEnum.COMPACT, - ) + transformData({ + aliasToMemberNameMap: data[1].aliasToMemberNameMap, + annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, + data: data[1].data, + query: data[1].query as unknown as NormalizedQuery, + queryType: data[1].queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + }) ).toEqual(data[1].result_compact); }); @@ -1313,25 +1313,25 @@ describe('transformData compact mode', () => { ); expect( - transformData( - data[0].aliasToMemberNameMap, - data[0].annotation as unknown as { [member: string]: ConfigItem }, - data[0].data, - data[0].query as unknown as NormalizedQuery, - data[0].queryType as QueryType, - ResultTypeEnum.COMPACT, - ) + transformData({ + aliasToMemberNameMap: data[0].aliasToMemberNameMap, + annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, + data: data[0].data, + query: data[0].query as unknown as NormalizedQuery, + queryType: data[0].queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + }) ).toEqual(data[0].result_compact); expect( - transformData( - data[1].aliasToMemberNameMap, - data[1].annotation as unknown as { [member: string]: ConfigItem }, - data[1].data, - data[1].query as unknown as NormalizedQuery, - data[1].queryType as QueryType, - ResultTypeEnum.COMPACT, - ) + transformData({ + aliasToMemberNameMap: data[1].aliasToMemberNameMap, + annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, + data: data[1].data, + query: data[1].query as unknown as NormalizedQuery, + queryType: data[1].queryType as QueryType, + resType: ResultTypeEnum.COMPACT, + }) ).toEqual(data[1].result_compact); }); }); From f0b1acf0bdb88bdc9c4ab81127d3152524a789a0 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 11 Dec 2024 14:30:35 +0200 Subject: [PATCH 043/128] =?UTF-8?q?omplement=20get=5Ffinal=5Fcubestore=5Fr?= =?UTF-8?q?esult=20&=20get=5Ffinal=5Fcubestore=5Fresult=5Fmulti=20in=C2=A0?= =?UTF-8?q?native?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 86 ++++++++++---- packages/cubejs-backend-native/Cargo.lock | 18 ++- packages/cubejs-backend-native/js/index.ts | 12 ++ .../cubejs-backend-native/src/node_export.rs | 106 +++++++++++++++++- rust/cubeorchestrator/Cargo.lock | 16 +++ rust/cubeorchestrator/Cargo.toml | 1 + .../src/cubestore_message_parser.rs | 6 +- .../src/cubestore_result_transform.rs | 104 +++++++++++++---- rust/cubeorchestrator/src/types.rs | 75 ++++++++++++- 9 files changed, 367 insertions(+), 57 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 28ee454c59478..4a97f3a013510 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -10,7 +10,11 @@ import { getRealType, QueryAlias, } from '@cubejs-backend/shared'; -import { transformData as transformDataNative, TransformDataResponse } from '@cubejs-backend/native'; +import { + getFinalCubestoreResult, getFinalCubestoreResultMulti, + transformData as transformDataNative, + TransformDataResponse +} from '@cubejs-backend/native'; import type { Application as ExpressApplication, ErrorRequestHandler, @@ -114,6 +118,16 @@ function systemAsyncHandler(handler: (req: Request & { context: ExtendedRequestC }; } +function cleanupResult(result) { + return { + ...result, + dataCb: undefined, + rawData: undefined, + transformDataParams: undefined, + isNative: undefined, + }; +} + // Prepared CheckAuthFn, default or from config: always async, returns nothing type PreparedCheckAuthFn = (ctx: any, authorization?: string) => Promise; @@ -1647,6 +1661,7 @@ class ApiGateway { return { query: normalizedQuery, dataCb, + rawData: response.data, transformDataParams, lastRefreshTime: response.lastRefreshTime?.toISOString(), ...( @@ -1829,27 +1844,56 @@ class ApiGateway { const allNative = results.every(r => r.isNative); if (props.queryType === 'multi') { - res({ - queryType, - results: results.map(r => { - const data = r.dataCb(); - return { - ...r, - data, - dataCb: undefined, - transformDataParams: undefined - }; - }), - pivotQuery: getPivotQuery(queryType, normalizedQueries), - slowQuery - }); + // If all query results are from Cubestore (are native) + // we prepare the final json result on native side + if (allNative) { + const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[string[], any[], string[]]>( + ([transformList, rawList, resultList], r) => { + transformList.push(JSON.stringify(r.transformDataParams)); + rawList.push(r.rawData.getNativeRef()); + resultList.push(cleanupResult(r)); + return [transformList, rawList, resultList]; + }, + [[], [], []] + ); + + const responseDataObj = { + queryType, + results: cleanResultList, + slowQuery + }; + const resultDataJson = JSON.stringify(responseDataObj); + + res(getFinalCubestoreResultMulti(transformDataJson, rawDataRef, resultDataJson)); + } else { + // if we have mixed query results (there are js and native) + // we prepare results separately: on js and native sides + // and serve final response from JS side + res({ + queryType, + results: results.map(r => { + const data = r.dataCb(); + return { + ...cleanupResult(r), + data, + }; + }), + pivotQuery: getPivotQuery(queryType, normalizedQueries), + slowQuery + }); + } + } else if (allNative) { + // We prepare the full final json result on native side + const r = results[0]; + const transformDataJson = JSON.stringify(r.transformDataParams); + const rawDataRef = r.rawData.getNativeRef(); + const resultDataJson = JSON.stringify(cleanupResult(r)); + res(getFinalCubestoreResult(transformDataJson, rawDataRef, resultDataJson)); } else { const data = results[0].dataCb(); res({ - ...results[0], + ...cleanupResult(results[0]), data, - dataCb: undefined, - transformDataParams: undefined }); } } catch (e: any) { @@ -2058,10 +2102,10 @@ class ApiGateway { if (message instanceof ArrayBuffer) { res.set('Content-Type', 'application/json'); - res.send(message); + res.send(Buffer.from(message)); + } else { + res.json(message); } - - res.json(message); }; } diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index a94b256a9b2ba..3b58feda8b8e1 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -788,6 +788,7 @@ dependencies = [ "anyhow", "chrono", "cubeshared", + "itertools 0.13.0", "neon", "serde", "serde_json", @@ -826,7 +827,7 @@ dependencies = [ "futures-util", "hashbrown 0.14.3", "indexmap 1.9.3", - "itertools", + "itertools 0.10.5", "log", "lru", "minijinja", @@ -863,7 +864,7 @@ dependencies = [ "cubeclient", "cubenativeutils", "datafusion", - "itertools", + "itertools 0.10.5", "lazy_static", "minijinja", "nativebridge", @@ -895,7 +896,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.3", - "itertools", + "itertools 0.10.5", "lazy_static", "log", "num_cpus", @@ -1617,6 +1618,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -1934,7 +1944,7 @@ dependencies = [ "Inflector", "async-trait", "byteorder", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index c841fd4628488..505a8dd7c6d62 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -389,6 +389,18 @@ export const transformData = (transformDataJson: string, rows: any): TransformDa return native.transformQueryData(transformDataJson, rows); }; +export const getFinalCubestoreResult = (transformDataJson: string, rows: any, resultData: string): ArrayBuffer => { + const native = loadNative(); + + return native.getFinalCubestoreResult(transformDataJson, rows, resultData); +}; + +export const getFinalCubestoreResultMulti = (transformDataJson: string[], rows: any[], responseData: string): ArrayBuffer => { + const native = loadNative(); + + return native.getFinalCubestoreResultMulti(transformDataJson, rows, responseData); +}; + export interface PyConfiguration { repositoryFactory?: (ctx: unknown) => Promise, logger?: (msg: string, params: Record) => void, diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 661f52fb4cb8c..ac0bc7b28d905 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -36,10 +36,12 @@ use cubeorchestrator::cubestore_message_parser::CubeStoreResult; use cubesql::{telemetry::ReportingLogger, CubeError}; +use cubeorchestrator::cubestore_result_transform::{ + get_final_cubestore_result, get_final_cubestore_result_multi, transform_data, +}; +use cubeorchestrator::types::{RequestResultData, RequestResultDataMulti, TransformDataRequest}; use neon::prelude::*; use neon::types::buffer::TypedArray; -use cubeorchestrator::cubestore_result_transform::transform_data; -use cubeorchestrator::types::{TransformDataRequest}; struct SQLInterface { services: Arc, @@ -546,9 +548,7 @@ fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { } fn transform_query_data(mut cx: FunctionContext) -> JsResult { - let json_str = cx - .argument::(0)? - .value(&mut cx); + let json_str = cx.argument::(0)?.value(&mut cx); let request_data = match serde_json::from_str::(&json_str) { Ok(data) => data, Err(err) => return cx.throw_error(err.to_string()), @@ -571,7 +571,7 @@ fn transform_query_data(mut cx: FunctionContext) -> JsResult { res_type.clone(), ) { Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()) + Err(err) => return cx.throw_error(err.to_string()), }; let json_data = match serde_json::to_string(&transformed) { @@ -587,6 +587,98 @@ fn transform_query_data(mut cx: FunctionContext) -> JsResult { Ok(js_result) } +fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { + let transform_data_str = cx.argument::(0)?.value(&mut cx); + let transform_request_data = + match serde_json::from_str::(&transform_data_str) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + let cube_store_result = cx.argument::>(1)?; + let result_data_str = cx.argument::(2)?.value(&mut cx); + let mut result_data = match serde_json::from_str::(&result_data_str) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + if let Err(err) = get_final_cubestore_result( + &transform_request_data, + &**cube_store_result, + &mut result_data, + ) { + return cx.throw_error(err.to_string()); + } + + let json_data = match serde_json::to_string(&result_data) { + Ok(data) => data, + Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), + }; + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + + Ok(js_buffer) +} + +fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { + let transform_data_array = cx.argument::(0)?; + let transform_requests: Vec = transform_data_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| { + let js_string = js_value + .downcast_or_throw::(&mut cx)? + .value(&mut cx); + + match serde_json::from_str::(&js_string) { + Ok(request) => Ok(request), + Err(err) => return cx.throw_error(err.to_string()), + } + }) + .collect::>()?; + + let cube_store_array = cx.argument::(1)?; + let cube_store_results_boxed: Vec>> = cube_store_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| js_value.downcast_or_throw::, _>(&mut cx)) + .collect::>()?; + let cube_store_results: Vec<&CubeStoreResult> = cube_store_results_boxed + .iter() + .map(|handle| &***handle) + .collect(); + + let result_data_str = cx.argument::(2)?.value(&mut cx); + let mut result_data = match serde_json::from_str::(&result_data_str) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + if let Err(err) = + get_final_cubestore_result_multi(&transform_requests, &cube_store_results, &mut result_data) + { + return cx.throw_error(err.to_string()); + } + + let json_data = match serde_json::to_string(&result_data) { + Ok(data) => data, + Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), + }; + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + + Ok(js_buffer) +} + pub fn register_module_exports( mut cx: ModuleContext, ) -> NeonResult<()> { @@ -607,6 +699,8 @@ pub fn register_module_exports( )?; cx.export_function("getCubestoreResult", get_cubestore_result)?; cx.export_function("transformQueryData", transform_query_data)?; + cx.export_function("getFinalCubestoreResult", final_cubestore_result)?; + cx.export_function("getFinalCubestoreResultMulti", final_cubestore_result_multi)?; crate::template::template_register_module(&mut cx)?; diff --git a/rust/cubeorchestrator/Cargo.lock b/rust/cubeorchestrator/Cargo.lock index 08d4c1cb73a26..f4a1156cfff88 100644 --- a/rust/cubeorchestrator/Cargo.lock +++ b/rust/cubeorchestrator/Cargo.lock @@ -111,6 +111,7 @@ dependencies = [ "anyhow", "chrono", "cubeshared", + "itertools", "neon", "serde", "serde_json", @@ -123,6 +124,12 @@ dependencies = [ "flatbuffers", ] +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + [[package]] name = "flatbuffers" version = "23.5.26" @@ -162,6 +169,15 @@ dependencies = [ "cc", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.14" diff --git a/rust/cubeorchestrator/Cargo.toml b/rust/cubeorchestrator/Cargo.toml index 04d2a81fee755..0605d4608ae08 100644 --- a/rust/cubeorchestrator/Cargo.toml +++ b/rust/cubeorchestrator/Cargo.toml @@ -9,6 +9,7 @@ cubeshared = { path = "../cubeshared" } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" anyhow = "1.0" +itertools = "0.13.0" [dependencies.neon] version = "=1" diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 8d9447e418836..4f768bd3fb51b 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,6 +1,6 @@ -use std::collections::HashMap; use cubeshared::codegen::{root_as_http_message, HttpCommand}; use neon::prelude::Finalize; +use std::collections::HashMap; #[derive(Debug)] pub enum ParseError { @@ -68,7 +68,9 @@ impl CubeStoreResult { let (columns, columns_pos): (Vec<_>, HashMap<_, _>) = result_set_columns .iter() .enumerate() - .map(|(index, column_name)| (column_name.to_owned(), (column_name.to_owned(), index))) + .map(|(index, column_name)| { + (column_name.to_owned(), (column_name.to_owned(), index)) + }) .unzip(); result.columns = columns; diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index c9c1296b99431..292a4860e2a26 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -1,13 +1,16 @@ -use crate::types::{ - ConfigItem, MembersMap, - NormalizedQuery, QueryTimeDimension, QueryType, ResultType, TransformedData, - BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, - COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, +use crate::{ + cubestore_message_parser::CubeStoreResult, + types::{ + ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, RequestResultData, + RequestResultDataMulti, ResultType, TransformDataRequest, TransformedData, + BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, + COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, + }, }; use anyhow::{bail, Context, Result}; use chrono::{DateTime, SecondsFormat}; +use itertools::multizip; use std::collections::{HashMap, HashSet}; -use crate::cubestore_message_parser::CubeStoreResult; /// Transform specified `value` with specified `type` to the network protocol type. pub fn transform_value(value: String, type_: &str) -> String { @@ -122,9 +125,10 @@ pub fn get_members( let calc_member = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); if path.len() == 3 - && query.dimensions.as_ref().map_or(true, |dims| { - !dims.iter().any(|dim| *dim == calc_member) - }) + && query + .dimensions + .as_ref() + .map_or(true, |dims| !dims.iter().any(|dim| *dim == calc_member)) { members.insert(calc_member, column.clone()); } @@ -216,7 +220,6 @@ pub fn get_vanilla_row( for (alias, &index) in columns_pos { if let Some(value) = db_row.get(index) { - let member_name = match alias_to_member_name_map.get(alias) { Some(m) => m, None => { @@ -238,15 +241,19 @@ pub fn get_vanilla_row( } }; - let transformed_value = transform_value(value.clone(), &annotation_for_member.member_type); + let transformed_value = + transform_value(value.clone(), &annotation_for_member.member_type); // Handle deprecated time dimensions without granularity let path: Vec<&str> = member_name.split(MEMBER_SEPARATOR).collect(); - let member_name_without_granularity = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); + let member_name_without_granularity = + format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); if path.len() == 3 && query.dimensions.as_ref().map_or(true, |dims| { - !dims.iter().any(|dim| *dim == member_name_without_granularity) - }) + !dims + .iter() + .any(|dim| *dim == member_name_without_granularity) + }) { row.insert(member_name_without_granularity, transformed_value); } else { @@ -258,10 +265,7 @@ pub fn get_vanilla_row( match query_type { QueryType::CompareDateRangeQuery => { let date_range_value = get_date_range_value(query.time_dimensions.as_ref())?; - row.insert( - "compareDateRange".to_string(), - date_range_value, - ); + row.insert("compareDateRange".to_string(), date_range_value); } QueryType::BlendingQuery => { let blending_key = get_blending_query_key(query.time_dimensions.as_ref())?; @@ -297,7 +301,8 @@ pub fn transform_data( match res_type { Some(ResultType::Compact) => { - let dataset: Vec<_> = data.rows + let dataset: Vec<_> = data + .rows .iter() .map(|row| { get_compact_row( @@ -314,7 +319,8 @@ pub fn transform_data( Ok(TransformedData::Compact { members, dataset }) } _ => { - let dataset: Vec<_> = data.rows + let dataset: Vec<_> = data + .rows .iter() .map(|row| { get_vanilla_row( @@ -333,7 +339,7 @@ pub fn transform_data( } /// Helper to get a list if unique granularities from normalized queries -pub fn get_query_granularities(queries: &[NormalizedQuery]) -> Vec { +pub fn get_query_granularities(queries: &Vec<&NormalizedQuery>) -> Vec { queries .iter() .filter_map(|query| { @@ -349,9 +355,13 @@ pub fn get_query_granularities(queries: &[NormalizedQuery]) -> Vec { } /// Get Pivot Query for a list of queries -pub fn get_pivot_query(query_type: QueryType, queries: &[NormalizedQuery]) -> Result { +pub fn get_pivot_query( + query_type: &QueryType, + queries: &Vec<&NormalizedQuery>, +) -> Result { let mut pivot_query = queries .first() + .map(|q| *q) .cloned() .ok_or_else(|| anyhow::anyhow!("Queries list cannot be empty"))?; @@ -396,7 +406,55 @@ pub fn get_pivot_query(query_type: QueryType, queries: &[NormalizedQuery]) -> Re _ => {} } - pivot_query.query_type = Option::from(query_type); + pivot_query.query_type = Option::from(query_type.clone()); Ok(pivot_query) } + +pub fn get_final_cubestore_result( + request_data: &TransformDataRequest, + cube_store_result: &CubeStoreResult, + result_data: &mut RequestResultData, +) -> Result<()> { + let alias_to_member_name_map = &request_data.alias_to_member_name_map; + let annotation = &request_data.annotation; + let query = &request_data.query; + let query_type = &request_data.query_type.clone().unwrap_or_default(); + let res_type = &request_data.res_type; + + let transformed = transform_data( + alias_to_member_name_map, + annotation, + cube_store_result, + query, + &query_type, + res_type.clone(), + )?; + + result_data.data = Some(transformed); + + Ok(()) +} + +pub fn get_final_cubestore_result_multi( + request_data: &Vec, + cube_store_result: &Vec<&CubeStoreResult>, + result_data: &mut RequestResultDataMulti, +) -> Result<()> { + for (transform_data, cube_store_result, result) in multizip(( + request_data.iter(), + cube_store_result.iter(), + result_data.results.iter_mut(), + )) { + get_final_cubestore_result(transform_data, *cube_store_result, result)?; + } + + let normalized_queries = result_data.results + .iter() + .map(|result| &result.query) + .collect::>(); + + result_data.pivot_query = Option::from(get_pivot_query(&result_data.query_type, &normalized_queries)?); + + Ok(()) +} diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index 6e6f23bf74b05..9113d901aa960 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -170,15 +170,21 @@ pub struct GranularityMeta { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConfigItem { pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] pub short_title: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "type")] pub member_type: String, + #[serde(skip_serializing_if = "Option::is_none")] pub format: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub meta: Option, #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "drillMembers")] pub drill_members: Option>, #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "drillMembersGrouped")] pub drill_members_grouped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub granularities: Option>, @@ -194,7 +200,9 @@ pub struct Order { pub struct NormalizedQueryFilter { pub member: String, pub operator: FilterOperator, + #[serde(skip_serializing_if = "Option::is_none")] pub values: Option>, + #[serde(skip_serializing_if = "Option::is_none")] pub dimension: Option, } @@ -235,23 +243,36 @@ pub enum LogicalFilter { pub struct Query { // pub measures: Vec, pub measures: Vec, + #[serde(skip_serializing_if = "Option::is_none")] // pub dimensions: Option>, pub dimensions: Option>, + #[serde(skip_serializing_if = "Option::is_none")] pub filters: Option>, #[serde(rename = "timeDimensions")] + #[serde(skip_serializing_if = "Option::is_none")] pub time_dimensions: Option>, + #[serde(skip_serializing_if = "Option::is_none")] // pub segments: Option>, pub segments: Option>, + #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub offset: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub total: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "totalQuery")] pub total_query: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub timezone: Option, #[serde(rename = "renewQuery")] + #[serde(skip_serializing_if = "Option::is_none")] pub renew_query: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub ungrouped: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "responseFormat")] pub response_format: Option, } @@ -260,32 +281,46 @@ pub struct Query { pub struct NormalizedQuery { // pub measures: Vec, pub measures: Vec, + #[serde(skip_serializing_if = "Option::is_none")] // pub dimensions: Option>, pub dimensions: Option>, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "timeDimensions")] pub time_dimensions: Option>, // pub segments: Option>, + #[serde(skip_serializing_if = "Option::is_none")] pub segments: Option>, + #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub offset: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub total: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "totalQuery")] pub total_query: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub timezone: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "renewQuery")] pub renew_query: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub ungrouped: Option, #[serde(rename = "responseFormat")] pub response_format: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub filters: Option>, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "rowLimit")] pub row_limit: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub order: Option>, + #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "queryType")] pub query_type: Option, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum TransformedData { Compact { @@ -306,3 +341,41 @@ pub struct TransformDataRequest { #[serde(rename = "resType")] pub res_type: Option, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RequestResultData { + pub query: NormalizedQuery, + #[serde(rename = "lastRefreshTime")] + pub last_refresh_time: Option, + #[serde(rename = "refreshKeyValues")] + pub refresh_key_values: Option, + #[serde(rename = "usedPreAggregations")] + pub used_pre_aggregations: Option, + #[serde(rename = "transformedQuery")] + pub transformed_query: Option, + #[serde(rename = "requestId")] + pub request_id: Option, + pub annotation: HashMap>, + #[serde(rename = "dataSource")] + pub data_source: String, + #[serde(rename = "dbType")] + pub db_type: String, + #[serde(rename = "extDbType")] + pub ext_db_type: Option, + pub external: bool, + #[serde(rename = "slowQuery")] + pub slow_query: bool, + pub total: Option, + pub data: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RequestResultDataMulti { + #[serde(rename = "queryType")] + pub query_type: QueryType, + pub results: Vec, + #[serde(rename = "pivotQuery")] + pub pivot_query: Option, + #[serde(rename = "slowQuery")] + pub slow_query: bool, +} From 01859e19c91efc4844d44938d69f80944c38bc7b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 11 Dec 2024 14:40:07 +0200 Subject: [PATCH 044/128] cargo fmt --- rust/cubeorchestrator/src/cubestore_result_transform.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 292a4860e2a26..a9be2d4ade265 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -449,12 +449,16 @@ pub fn get_final_cubestore_result_multi( get_final_cubestore_result(transform_data, *cube_store_result, result)?; } - let normalized_queries = result_data.results + let normalized_queries = result_data + .results .iter() .map(|result| &result.query) .collect::>(); - result_data.pivot_query = Option::from(get_pivot_query(&result_data.query_type, &normalized_queries)?); + result_data.pivot_query = Option::from(get_pivot_query( + &result_data.query_type, + &normalized_queries, + )?); Ok(()) } From 43ea91c3c31bd9a63f6be3c5313984eb05fe453e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 11 Dec 2024 15:03:11 +0200 Subject: [PATCH 045/128] cargo clippy fix --- .../cubejs-backend-native/src/node_export.rs | 8 ++--- .../src/cubestore_result_transform.rs | 30 +++++++++---------- rust/cubeorchestrator/src/types.rs | 9 ++---- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index ac0bc7b28d905..6a09727289815 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -565,9 +565,9 @@ fn transform_query_data(mut cx: FunctionContext) -> JsResult { let transformed = match transform_data( alias_to_member_name_map, annotation, - &**cube_store_result, + &cube_store_result, query, - &query_type, + query_type, res_type.clone(), ) { Ok(data) => data, @@ -603,7 +603,7 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { if let Err(err) = get_final_cubestore_result( &transform_request_data, - &**cube_store_result, + &cube_store_result, &mut result_data, ) { return cx.throw_error(err.to_string()); @@ -636,7 +636,7 @@ fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult(&js_string) { Ok(request) => Ok(request), - Err(err) => return cx.throw_error(err.to_string()), + Err(err) => cx.throw_error(err.to_string()), } }) .collect::>()?; diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index a9be2d4ade265..15e766e09300a 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -30,13 +30,13 @@ pub fn get_date_range_value(time_dimensions: Option<&Vec>) - None => bail!("QueryTimeDimension should be specified for the compare date range query."), }; - let dim = match time_dimensions.get(0) { + let dim = match time_dimensions.first() { Some(dim) => dim, None => bail!("No time dimension provided."), }; let date_range: &Vec = match &dim.date_range { - Some(date_range) => date_range.as_ref(), + Some(date_range) => date_range, None => bail!("Inconsistent QueryTimeDimension configuration: dateRange required."), }; @@ -165,7 +165,7 @@ pub fn get_compact_row( query_type: &QueryType, members: &[String], time_dimensions: Option<&Vec>, - db_row: &Vec, + db_row: &[String], columns_pos: &HashMap, ) -> Result> { let mut row: Vec = Vec::with_capacity(members.len()); @@ -213,7 +213,7 @@ pub fn get_vanilla_row( annotation: &HashMap, query_type: &QueryType, query: &NormalizedQuery, - db_row: &Vec, + db_row: &[String], columns_pos: &HashMap, ) -> Result> { let mut row = HashMap::new(); @@ -293,7 +293,7 @@ pub fn transform_data( let members_to_alias_map = get_members( query_type, query, - &data, + data, alias_to_member_name_map, annotation, )?; @@ -311,7 +311,7 @@ pub fn transform_data( query_type, &members, query.time_dimensions.as_ref(), - &row, + row, &data.columns_pos, ) }) @@ -328,7 +328,7 @@ pub fn transform_data( annotation, query_type, query, - &row, + row, &data.columns_pos, ) }) @@ -339,14 +339,14 @@ pub fn transform_data( } /// Helper to get a list if unique granularities from normalized queries -pub fn get_query_granularities(queries: &Vec<&NormalizedQuery>) -> Vec { +pub fn get_query_granularities(queries: &[&NormalizedQuery]) -> Vec { queries .iter() .filter_map(|query| { query .time_dimensions .as_ref() - .and_then(|tds| tds.get(0)) + .and_then(|tds| tds.first()) .and_then(|td| td.granularity.clone()) }) .collect::>() @@ -361,7 +361,7 @@ pub fn get_pivot_query( ) -> Result { let mut pivot_query = queries .first() - .map(|q| *q) + .copied() .cloned() .ok_or_else(|| anyhow::anyhow!("Queries list cannot be empty"))?; @@ -392,7 +392,7 @@ pub fn get_pivot_query( dimension: "time".to_string(), date_range: None, compare_date_range: None, - granularity: granularities.get(0).cloned(), + granularity: granularities.first().cloned(), }]); } } @@ -427,7 +427,7 @@ pub fn get_final_cubestore_result( annotation, cube_store_result, query, - &query_type, + query_type, res_type.clone(), )?; @@ -437,8 +437,8 @@ pub fn get_final_cubestore_result( } pub fn get_final_cubestore_result_multi( - request_data: &Vec, - cube_store_result: &Vec<&CubeStoreResult>, + request_data: &[TransformDataRequest], + cube_store_result: &[&CubeStoreResult], result_data: &mut RequestResultDataMulti, ) -> Result<()> { for (transform_data, cube_store_result, result) in multizip(( @@ -446,7 +446,7 @@ pub fn get_final_cubestore_result_multi( cube_store_result.iter(), result_data.results.iter_mut(), )) { - get_final_cubestore_result(transform_data, *cube_store_result, result)?; + get_final_cubestore_result(transform_data, cube_store_result, result)?; } let normalized_queries = result_data diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index 9113d901aa960..83954050d7e67 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -35,9 +35,10 @@ pub enum ResultType { Compact, } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Default, Debug, Clone, Serialize, Deserialize)] pub enum QueryType { #[serde(rename = "regularQuery")] + #[default] RegularQuery, #[serde(rename = "compareDateRangeQuery")] CompareDateRangeQuery, @@ -56,12 +57,6 @@ impl Display for QueryType { } } -impl Default for QueryType { - fn default() -> Self { - QueryType::RegularQuery - } -} - #[derive(Debug, Serialize, Deserialize)] pub enum MemberType { #[serde(rename = "measures")] From d5f2760847c87da13560b6db7ca8ba44f82801a1 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 11 Dec 2024 16:48:57 +0200 Subject: [PATCH 046/128] refactor getVanillaRow --- .../src/helpers/transformData.ts | 76 ++++++++----------- .../test/helpers/transformData.test.ts | 6 +- 2 files changed, 33 insertions(+), 49 deletions(-) diff --git a/packages/cubejs-api-gateway/src/helpers/transformData.ts b/packages/cubejs-api-gateway/src/helpers/transformData.ts index f05e325a65c48..5e2a49752a462 100644 --- a/packages/cubejs-api-gateway/src/helpers/transformData.ts +++ b/packages/cubejs-api-gateway/src/helpers/transformData.ts @@ -52,7 +52,7 @@ function getDateRangeValue( } /** - * Parse blending query key from time time dimension. + * Parse blending query key from time dimension granularity. * @internal */ function getBlendingQueryKey( @@ -77,7 +77,7 @@ function getBlendingQueryKey( } /** - * Parse blending response key from time time dimension. + * Parse blending response key from time dimension and granularity. * @internal */ function getBlendingResponseKey( @@ -219,80 +219,64 @@ function getCompactRow( /** * Convert DB response object to the vanilla output format. - * @todo rewrite me please! * @internal */ -function getVanilaRow( +function getVanillaRow( aliasToMemberNameMap: AliasToMemberMap, annotation: { [member: string]: ConfigItem }, queryType: QueryType, query: NormalizedQuery, dbRow: { [sqlAlias: string]: DBResponseValue }, ): { [member: string]: DBResponsePrimitive } { - const row = R.pipe( - R.toPairs, - R.map(p => { - const memberName = aliasToMemberNameMap[p[0]]; + const row = Object + .entries(dbRow) + .reduce((acc, [sqlAlias, value]) => { + const memberName = aliasToMemberNameMap[sqlAlias]; const annotationForMember = annotation[memberName]; + if (!annotationForMember) { throw new UserError( - `You requested hidden member: '${ - p[0] - }'. Please make it visible using \`shown: true\`. ` + - 'Please note primaryKey fields are `shown: false` by ' + - 'default: https://cube.dev/docs/schema/reference/joins#' + - 'setting-a-primary-key.' + `You requested hidden member: '${sqlAlias}'. ` + + 'Please make it visible using `shown: true`. ' + + 'Please note primaryKey fields are `shown: false` by default: ' + + 'https://cube.dev/docs/schema/reference/joins#setting-a-primary-key.' ); } - const transformResult = [ - memberName, - transformValue( - p[1] as DBResponseValue, - annotationForMember.type - ) - ]; + + const transformedValue = transformValue(value as DBResponseValue, annotationForMember.type); const path = memberName.split(MEMBER_SEPARATOR); + acc[memberName] = transformedValue; + /** - * Time dimensions without granularity. + * Handle time dimensions without granularity * @deprecated * @todo backward compatibility for referencing */ - const memberNameWithoutGranularity = - [path[0], path[1]].join(MEMBER_SEPARATOR); - if ( - path.length === 3 && - (query.dimensions || []) - .indexOf(memberNameWithoutGranularity) === -1 - ) { - return [ - transformResult, - [ - memberNameWithoutGranularity, - transformResult[1] - ] - ]; + const memberNameWithoutGranularity = [path[0], path[1]].join(MEMBER_SEPARATOR); + if (path.length === 3 && + (query.dimensions || []).indexOf(memberNameWithoutGranularity) === -1) { + acc[memberNameWithoutGranularity] = transformedValue; } - return [transformResult]; - }), - // @ts-ignore - R.unnest, - R.fromPairs - // @ts-ignore - )(dbRow); + return acc; + }, {} as { [member: string]: DBResponsePrimitive }); + if (queryType === QueryTypeEnum.COMPARE_DATE_RANGE_QUERY) { return { ...row, compareDateRange: getDateRangeValue(query.timeDimensions) }; - } else if (queryType === QueryTypeEnum.BLENDING_QUERY) { + } + + if (queryType === QueryTypeEnum.BLENDING_QUERY) { return { ...row, [getBlendingQueryKey(query.timeDimensions)]: row[getBlendingResponseKey(query.timeDimensions)] }; } + return row as { [member: string]: DBResponsePrimitive; }; } @@ -337,7 +321,7 @@ function transformData({ query.timeDimensions, r, ) - : getVanilaRow( + : getVanillaRow( aliasToMemberNameMap, annotation, queryType, @@ -371,7 +355,7 @@ export { getBlendingResponseKey, getMembers, getCompactRow, - getVanilaRow, + getVanillaRow, transformData, transformValue, }; diff --git a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts index ddea9da955b4b..52d637817bf7d 100644 --- a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts +++ b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts @@ -32,7 +32,7 @@ import { getBlendingResponseKey, getMembers, getCompactRow, - getVanilaRow, + getVanillaRow, transformData, } from '../../src/helpers/transformData'; import { @@ -691,7 +691,7 @@ describe('transformData helpers', () => { expect(getBlendingResponseKey).toBeDefined(); expect(getMembers).toBeDefined(); expect(getCompactRow).toBeDefined(); - expect(getVanilaRow).toBeDefined(); + expect(getVanillaRow).toBeDefined(); expect(transformData).toBeDefined(); expect(transformData).toEqual(transformDataDefault); }); @@ -1110,7 +1110,7 @@ describe('transformData helpers', () => { JSON.stringify(mockData.regular_discount_by_city.data) ); delete data.aliasToMemberNameMap.e_commerce_records_us2021__avg_discount; - expect(() => getVanilaRow( + expect(() => getVanillaRow( data.aliasToMemberNameMap, data.annotation as unknown as { [member: string]: ConfigItem }, data.queryType as QueryType, From d5f4f1c9f29482a23d70259c603098617ad73b2e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 11 Dec 2024 18:04:02 +0200 Subject: [PATCH 047/128] implement get_final_cubestore_result_array() native --- packages/cubejs-api-gateway/src/gateway.ts | 50 +++++++++++-- packages/cubejs-backend-native/js/index.ts | 6 ++ .../cubejs-backend-native/src/node_export.rs | 71 ++++++++++++++++++- .../src/cubestore_result_transform.rs | 16 +++++ 4 files changed, 136 insertions(+), 7 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 4a97f3a013510..a6442c8c506ed 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -11,7 +11,9 @@ import { QueryAlias, } from '@cubejs-backend/shared'; import { - getFinalCubestoreResult, getFinalCubestoreResultMulti, + getFinalCubestoreResult, + getFinalCubestoreResultArray, + getFinalCubestoreResultMulti, transformData as transformDataNative, TransformDataResponse } from '@cubejs-backend/native'; @@ -1847,7 +1849,7 @@ class ApiGateway { // If all query results are from Cubestore (are native) // we prepare the final json result on native side if (allNative) { - const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[string[], any[], string[]]>( + const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[string[], any[], any[]]>( ([transformList, rawList, resultList], r) => { transformList.push(JSON.stringify(r.transformDataParams)); rawList.push(r.rawData.getNativeRef()); @@ -1990,6 +1992,8 @@ class ApiGateway { annotation }]; } + + res(request.streaming ? results[0] : { results }); } else { results = await Promise.all( normalizedQueries.map(async (normalizedQuery, index) => { @@ -2021,11 +2025,45 @@ class ApiGateway { ); }) ); - } - res(request.streaming ? results[0] : { - results, - }); + const allNative = results.every(r => r.isNative); + + if (!request.streaming) { + // If all query results are from Cubestore (are native) + // we prepare the final json result on native side + if (allNative) { + const [transformDataJson, rawDataRef, resultDataJson] = (results as { + transformDataParams: any; + rawData: { getNativeRef: () => any }; + }[]).reduce<[string[], any[], string[]]>( + ([transformList, rawList, resultList], r) => { + transformList.push(JSON.stringify(r.transformDataParams)); + rawList.push(r.rawData.getNativeRef()); + resultList.push(JSON.stringify(cleanupResult(r))); + return [transformList, rawList, resultList]; + }, + [[], [], []] + ); + + res(getFinalCubestoreResultArray(transformDataJson, rawDataRef, resultDataJson)); + } else { + // if we have mixed query results (there are js and native) + // we prepare results separately: on js and native sides + // and serve final response from JS side + res({ + results: results.map(r => { + const data = r.dataCb(); + return { + ...cleanupResult(r), + data, + }; + }), + }); + } + } else { + res(results[0]); + } + } } catch (e: any) { this.handleError({ e, context, query, res, requestStarted diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 505a8dd7c6d62..4465cc23bb3e0 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -395,6 +395,12 @@ export const getFinalCubestoreResult = (transformDataJson: string, rows: any, re return native.getFinalCubestoreResult(transformDataJson, rows, resultData); }; +export const getFinalCubestoreResultArray = (transformDataJson: string[], rows: any[], resultDataJson: string[]): ArrayBuffer => { + const native = loadNative(); + + return native.getFinalCubestoreResultArray(transformDataJson, rows, resultDataJson); +}; + export const getFinalCubestoreResultMulti = (transformDataJson: string[], rows: any[], responseData: string): ArrayBuffer => { const native = loadNative(); diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 6a09727289815..14dc610956b62 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -37,7 +37,8 @@ use cubeorchestrator::cubestore_message_parser::CubeStoreResult; use cubesql::{telemetry::ReportingLogger, CubeError}; use cubeorchestrator::cubestore_result_transform::{ - get_final_cubestore_result, get_final_cubestore_result_multi, transform_data, + get_final_cubestore_result, get_final_cubestore_result_array, get_final_cubestore_result_multi, + transform_data, }; use cubeorchestrator::types::{RequestResultData, RequestResultDataMulti, TransformDataRequest}; use neon::prelude::*; @@ -624,6 +625,73 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(js_buffer) } +fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { + let transform_data_array = cx.argument::(0)?; + let transform_requests: Vec = transform_data_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| { + let js_string = js_value + .downcast_or_throw::(&mut cx)? + .value(&mut cx); + + match serde_json::from_str::(&js_string) { + Ok(request) => Ok(request), + Err(err) => cx.throw_error(err.to_string()), + } + }) + .collect::>()?; + + let cube_store_array = cx.argument::(1)?; + let cube_store_results_boxed: Vec>> = cube_store_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| js_value.downcast_or_throw::, _>(&mut cx)) + .collect::>()?; + let cube_store_results: Vec<&CubeStoreResult> = cube_store_results_boxed + .iter() + .map(|handle| &***handle) + .collect(); + + let results_data_array = cx.argument::(2)?; + let mut request_results: Vec = results_data_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| { + let js_string = js_value + .downcast_or_throw::(&mut cx)? + .value(&mut cx); + + match serde_json::from_str::(&js_string) { + Ok(request) => Ok(request), + Err(err) => cx.throw_error(err.to_string()), + } + }) + .collect::>()?; + + if let Err(err) = get_final_cubestore_result_array( + &transform_requests, + &cube_store_results, + &mut request_results, + ) { + return cx.throw_error(err.to_string()); + } + + let json_data = match serde_json::to_string(&request_results) { + Ok(data) => data, + Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), + }; + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + + Ok(js_buffer) +} + fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { let transform_data_array = cx.argument::(0)?; let transform_requests: Vec = transform_data_array @@ -701,6 +769,7 @@ pub fn register_module_exports( cx.export_function("transformQueryData", transform_query_data)?; cx.export_function("getFinalCubestoreResult", final_cubestore_result)?; cx.export_function("getFinalCubestoreResultMulti", final_cubestore_result_multi)?; + cx.export_function("getFinalCubestoreResultArray", final_cubestore_result_array)?; crate::template::template_register_module(&mut cx)?; diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 15e766e09300a..e03448d0551fc 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -436,6 +436,22 @@ pub fn get_final_cubestore_result( Ok(()) } +pub fn get_final_cubestore_result_array( + transform_requests: &[TransformDataRequest], + cube_store_results: &[&CubeStoreResult], + result_data: &mut [RequestResultData], +) -> Result<()> { + for (transform_data, cube_store_result, result) in multizip(( + transform_requests.iter(), + cube_store_results.iter(), + result_data.iter_mut(), + )) { + get_final_cubestore_result(transform_data, cube_store_result, result)?; + } + + Ok(()) +} + pub fn get_final_cubestore_result_multi( request_data: &[TransformDataRequest], cube_store_result: &[&CubeStoreResult], From 29770bf97e4f1fd3849df2981a1ea14720bcad78 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 12 Dec 2024 17:38:56 +0200 Subject: [PATCH 048/128] =?UTF-8?q?fix=20native=20response=20flow=20for?= =?UTF-8?q?=C2=A0sqlApiLoad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/sql-server.ts | 7 ++++++- packages/cubejs-backend-native/src/node_export.rs | 10 ++++++++-- rust/cubeorchestrator/src/types.rs | 5 +++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/cubejs-api-gateway/src/sql-server.ts b/packages/cubejs-api-gateway/src/sql-server.ts index 32e7d37e1e19c..49a404706fe43 100644 --- a/packages/cubejs-api-gateway/src/sql-server.ts +++ b/packages/cubejs-api-gateway/src/sql-server.ts @@ -193,7 +193,12 @@ export class SQLServer { return; } - resolve(response); + if (response instanceof ArrayBuffer) { + const json = JSON.parse(new TextDecoder().decode(response)); + resolve(json); + } else { + resolve(response); + } }, apiType: 'sql', }); diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 14dc610956b62..0cee1c3d65c47 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -40,7 +40,9 @@ use cubeorchestrator::cubestore_result_transform::{ get_final_cubestore_result, get_final_cubestore_result_array, get_final_cubestore_result_multi, transform_data, }; -use cubeorchestrator::types::{RequestResultData, RequestResultDataMulti, TransformDataRequest}; +use cubeorchestrator::types::{ + RequestResultArray, RequestResultData, RequestResultDataMulti, TransformDataRequest, +}; use neon::prelude::*; use neon::types::buffer::TypedArray; @@ -677,7 +679,11 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult data, Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), }; diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/types.rs index 83954050d7e67..eeeada3e3b7ce 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/types.rs @@ -374,3 +374,8 @@ pub struct RequestResultDataMulti { #[serde(rename = "slowQuery")] pub slow_query: bool, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RequestResultArray { + pub results: Vec, +} From c5a02a84577e39b54d4b196cd6d5bd7fe33a10cc Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 12 Dec 2024 17:44:06 +0200 Subject: [PATCH 049/128] add postgres with native cubestore results driver tests --- .github/workflows/drivers-tests.yml | 1 + .../fixtures/postgres.json | 9 + packages/cubejs-testing-drivers/package.json | 1 + ...ative-cubestore-response-full.test.ts.snap | 16219 ++++++++++++++++ ...res-native-cubestore-response-full.test.ts | 5 + 5 files changed, 16235 insertions(+) create mode 100644 packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap create mode 100644 packages/cubejs-testing-drivers/test/postgres-native-cubestore-response-full.test.ts diff --git a/.github/workflows/drivers-tests.yml b/.github/workflows/drivers-tests.yml index 1ab0154df375b..122f05de50668 100644 --- a/.github/workflows/drivers-tests.yml +++ b/.github/workflows/drivers-tests.yml @@ -225,6 +225,7 @@ jobs: - mssql - mysql - postgres + - postgres-native-cubestore-response - redshift - redshift-export-bucket-s3 - snowflake diff --git a/packages/cubejs-testing-drivers/fixtures/postgres.json b/packages/cubejs-testing-drivers/fixtures/postgres.json index df16d61ecc11f..c6054b858b2a9 100644 --- a/packages/cubejs-testing-drivers/fixtures/postgres.json +++ b/packages/cubejs-testing-drivers/fixtures/postgres.json @@ -1,4 +1,13 @@ { + "extendedEnvs": { + "native-cubestore-response": { + "cube": { + "environment": { + "CUBEJS_TESSERACT_ORCHESTRATOR": "true" + } + } + } + }, "cube": { "environment": { "CUBEJS_API_SECRET": "mysupersecret", diff --git a/packages/cubejs-testing-drivers/package.json b/packages/cubejs-testing-drivers/package.json index dd0cae70839ab..2e71027cdae20 100644 --- a/packages/cubejs-testing-drivers/package.json +++ b/packages/cubejs-testing-drivers/package.json @@ -39,6 +39,7 @@ "postgres-driver": "yarn test-driver -i dist/test/postgres-driver.test.js", "postgres-core": "yarn test-driver -i dist/test/postgres-core.test.js", "postgres-full": "yarn test-driver -i dist/test/postgres-full.test.js", + "postgres-native-cubestore-response-full": "yarn test-driver -i dist/test/postgres-native-cubestore-response-full.test.js", "snowflake-driver": "yarn test-driver -i dist/test/snowflake-driver.test.js", "snowflake-core": "yarn test-driver -i dist/test/snowflake-core.test.js", "snowflake-full": "yarn test-driver -i dist/test/snowflake-full.test.js", diff --git a/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap b/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap new file mode 100644 index 0000000000000..0c15db38f231c --- /dev/null +++ b/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap @@ -0,0 +1,16219 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Complex Rollup: complex_rollup 1`] = ` +Array [ + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": "CA-2017-145142", + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": "CA-2017-145142", + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": null, + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": null, + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": "CA-2017-107503", + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": "CA-2017-107503", + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": null, + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": null, + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": "CA-2017-118437", + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": "CA-2017-118437", + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": null, + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": null, + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": "CA-2017-139661", + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": "CA-2017-139661", + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": null, + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": null, + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-133648", + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-133648", + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": "CA-2017-138422", + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": "CA-2017-138422", + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": null, + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": null, + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": "CA-2017-140949", + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": "CA-2017-140949", + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": null, + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": null, + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": "CA-2017-149048", + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": "CA-2017-149048", + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": null, + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": null, + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-112515", + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-112515", + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": "CA-2017-123372", + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": "CA-2017-123372", + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": null, + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": null, + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": "CA-2017-134915", + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": "CA-2017-134915", + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": null, + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": null, + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": null, + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": null, + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": null, + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": null, + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": "US-2017-132297", + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": "US-2017-132297", + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": null, + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": null, + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": "CA-2017-102554", + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": "CA-2017-102554", + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": null, + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": null, + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": "CA-2017-144568", + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": "CA-2017-144568", + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": null, + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": null, + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": "CA-2017-123001", + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": "CA-2017-123001", + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": null, + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": null, + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": "CA-2017-100811", + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": "CA-2017-100811", + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": null, + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": null, + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": "CA-2017-124296", + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": "CA-2017-124296", + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": null, + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": null, + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "CA-2017-115546", + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "CA-2017-115546", + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": "CA-2017-120327", + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": "CA-2017-120327", + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": null, + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": null, + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": "CA-2017-143567", + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": "CA-2017-143567", + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": null, + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": null, + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": "CA-2017-145653", + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": "CA-2017-145653", + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": null, + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": null, + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-147333", + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-147333", + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": null, + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": null, + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": "CA-2017-145772", + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": "CA-2017-145772", + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": null, + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": null, + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": "CA-2017-145660", + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": "CA-2017-145660", + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": null, + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": null, + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": "CA-2017-102379", + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": "CA-2017-102379", + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": null, + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": null, + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "US-2017-133361", + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "US-2017-133361", + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": "US-2017-124779", + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": "US-2017-124779", + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": null, + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": null, + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": "US-2017-141677", + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": "US-2017-141677", + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": null, + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": null, + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": "CA-2017-109183", + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": "CA-2017-109183", + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": null, + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": null, + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": "CA-2017-112172", + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": "CA-2017-112172", + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": null, + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": null, + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": "CA-2017-135069", + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": "CA-2017-135069", + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": null, + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": null, + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-151799", + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-151799", + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": null, + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": null, + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": "CA-2017-150091", + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": "CA-2017-150091", + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": null, + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": null, + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": "US-2017-119319", + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": "US-2017-119319", + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": null, + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": null, + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": "CA-2017-163265", + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": "CA-2017-163265", + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": null, + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": null, + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": "CA-2017-119284", + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": "CA-2017-119284", + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": null, + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": null, + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-126928", + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-126928", + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": "CA-2017-105620", + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": "CA-2017-105620", + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": null, + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": null, + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": "CA-2017-102925", + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": "CA-2017-102925", + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": null, + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": null, + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-116127", + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-116127", + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": "San Francisco", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": "Columbus", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": null, + "rowId": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Extended nested Rollup over asterisk: extended_nested_rollup_over_asterisk 1`] = ` +Array [ + Object { + "SUM(a.count)": "1", + "order": "CA-2017-100811", + "row": 4012, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-102379", + "row": 6272, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-102554", + "row": 3448, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-102925", + "row": 9473, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-105620", + "row": 8958, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-107503", + "row": 849, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-109183", + "row": 7293, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-112172", + "row": 7310, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-112515", + "row": 2655, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-115546", + "row": 4161, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-116127", + "row": 9584, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-118437", + "row": 1013, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-119284", + "row": 8697, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-120327", + "row": 4227, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-123001", + "row": 3934, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-123372", + "row": 2661, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-124296", + "row": 4031, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-126928", + "row": 8878, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-131492", + "row": 3060, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-131492", + "row": 3059, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-133648", + "row": 1995, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-134915", + "row": 2952, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-135069", + "row": 7425, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-138422", + "row": 2329, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-139661", + "row": 1494, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-140949", + "row": 2455, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-143567", + "row": 4882, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-144568", + "row": 3717, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145142", + "row": 523, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145653", + "row": 5220, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145660", + "row": 6205, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-145772", + "row": 6125, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-147333", + "row": 5277, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-149048", + "row": 2595, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-150091", + "row": 8425, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-151799", + "row": 7698, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-160633", + "row": 9619, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-160633", + "row": 9618, + }, + Object { + "SUM(a.count)": "1", + "order": "CA-2017-163265", + "row": 8673, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-119319", + "row": 8621, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-124779", + "row": 6651, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-132297", + "row": 3083, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-133361", + "row": 6459, + }, + Object { + "SUM(a.count)": "1", + "order": "US-2017-141677", + "row": 7174, + }, + Object { + "SUM(a.count)": "44", + "order": null, + "row": null, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 9619, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 9618, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 9584, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 9473, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 8958, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 8878, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 8697, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 8673, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 8621, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 8425, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 7698, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 7425, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 7310, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 7293, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 7174, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 6651, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 6459, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 6272, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 6205, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 6125, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 5277, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 5220, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 4882, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 4227, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 4161, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 4031, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 4012, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 3934, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 3717, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 3448, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 3083, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 3060, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 3059, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 2952, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 2661, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 2655, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 2595, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 2455, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 2329, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 1995, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 1494, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 1013, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 849, + }, + Object { + "SUM(a.count)": "1", + "order": null, + "row": 523, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = ` +Array [ + Object { + "category": null, + }, + Object { + "category": "Office Supplies", + }, + Object { + "category": "Technology", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup over asterisk: nested_rollup_over_asterisk 1`] = ` +Array [ + Object { + "SUM(a.count)": "1", + "date": 2020-01-23T00:00:00.000Z, + "order": "CA-2017-145142", + "row": 523, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-145142", + "row": 523, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 523, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-01-01T00:00:00.000Z, + "order": "CA-2017-107503", + "row": 849, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-107503", + "row": 849, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 849, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-17T00:00:00.000Z, + "order": "CA-2017-118437", + "row": 1013, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-118437", + "row": 1013, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 1013, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-10-30T00:00:00.000Z, + "order": "CA-2017-139661", + "row": 1494, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-139661", + "row": 1494, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 1494, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-25T00:00:00.000Z, + "order": "CA-2017-133648", + "row": 1995, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-133648", + "row": 1995, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 1995, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-09-23T00:00:00.000Z, + "order": "CA-2017-138422", + "row": 2329, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-138422", + "row": 2329, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 2329, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-03-17T00:00:00.000Z, + "order": "CA-2017-140949", + "row": 2455, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-140949", + "row": 2455, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 2455, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-05-13T00:00:00.000Z, + "order": "CA-2017-149048", + "row": 2595, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-149048", + "row": 2595, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 2595, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-09-17T00:00:00.000Z, + "order": "CA-2017-112515", + "row": 2655, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-112515", + "row": 2655, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 2655, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-28T00:00:00.000Z, + "order": "CA-2017-123372", + "row": 2661, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-123372", + "row": 2661, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 2661, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-12T00:00:00.000Z, + "order": "CA-2017-134915", + "row": 2952, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-134915", + "row": 2952, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 2952, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-10-19T00:00:00.000Z, + "order": "CA-2017-131492", + "row": 3059, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-131492", + "row": 3059, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 3059, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-10-19T00:00:00.000Z, + "order": "CA-2017-131492", + "row": 3060, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-131492", + "row": 3060, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 3060, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-05-27T00:00:00.000Z, + "order": "US-2017-132297", + "row": 3083, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "US-2017-132297", + "row": 3083, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 3083, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-11T00:00:00.000Z, + "order": "CA-2017-102554", + "row": 3448, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-102554", + "row": 3448, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 3448, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-05-29T00:00:00.000Z, + "order": "CA-2017-144568", + "row": 3717, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-144568", + "row": 3717, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 3717, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-09-02T00:00:00.000Z, + "order": "CA-2017-123001", + "row": 3934, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-123001", + "row": 3934, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 3934, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-21T00:00:00.000Z, + "order": "CA-2017-100811", + "row": 4012, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-100811", + "row": 4012, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 4012, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-24T00:00:00.000Z, + "order": "CA-2017-124296", + "row": 4031, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-124296", + "row": 4031, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 4031, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-05-14T00:00:00.000Z, + "order": "CA-2017-115546", + "row": 4161, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-115546", + "row": 4161, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 4161, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-11T00:00:00.000Z, + "order": "CA-2017-120327", + "row": 4227, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-120327", + "row": 4227, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 4227, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-02T00:00:00.000Z, + "order": "CA-2017-143567", + "row": 4882, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-143567", + "row": 4882, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 4882, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-09-01T00:00:00.000Z, + "order": "CA-2017-145653", + "row": 5220, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-145653", + "row": 5220, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 5220, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-14T00:00:00.000Z, + "order": "CA-2017-147333", + "row": 5277, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-147333", + "row": 5277, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 5277, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-03T00:00:00.000Z, + "order": "CA-2017-145772", + "row": 6125, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-145772", + "row": 6125, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 6125, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-01T00:00:00.000Z, + "order": "CA-2017-145660", + "row": 6205, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-145660", + "row": 6205, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 6205, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-02T00:00:00.000Z, + "order": "CA-2017-102379", + "row": 6272, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-102379", + "row": 6272, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 6272, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-05-14T00:00:00.000Z, + "order": "US-2017-133361", + "row": 6459, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "US-2017-133361", + "row": 6459, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 6459, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-09-08T00:00:00.000Z, + "order": "US-2017-124779", + "row": 6651, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "US-2017-124779", + "row": 6651, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 6651, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-03-26T00:00:00.000Z, + "order": "US-2017-141677", + "row": 7174, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "US-2017-141677", + "row": 7174, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 7174, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-04T00:00:00.000Z, + "order": "CA-2017-109183", + "row": 7293, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-109183", + "row": 7293, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 7293, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-10T00:00:00.000Z, + "order": "CA-2017-112172", + "row": 7310, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-112172", + "row": 7310, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 7310, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-04-10T00:00:00.000Z, + "order": "CA-2017-135069", + "row": 7425, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-135069", + "row": 7425, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 7425, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-14T00:00:00.000Z, + "order": "CA-2017-151799", + "row": 7698, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-151799", + "row": 7698, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 7698, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-10-12T00:00:00.000Z, + "order": "CA-2017-150091", + "row": 8425, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-150091", + "row": 8425, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 8425, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-06T00:00:00.000Z, + "order": "US-2017-119319", + "row": 8621, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "US-2017-119319", + "row": 8621, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 8621, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-02-16T00:00:00.000Z, + "order": "CA-2017-163265", + "row": 8673, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-163265", + "row": 8673, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 8673, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-15T00:00:00.000Z, + "order": "CA-2017-119284", + "row": 8697, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-119284", + "row": 8697, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 8697, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-09-17T00:00:00.000Z, + "order": "CA-2017-126928", + "row": 8878, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-126928", + "row": 8878, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 8878, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-12-25T00:00:00.000Z, + "order": "CA-2017-105620", + "row": 8958, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-105620", + "row": 8958, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 8958, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-05T00:00:00.000Z, + "order": "CA-2017-102925", + "row": 9473, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-102925", + "row": 9473, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 9473, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-06-25T00:00:00.000Z, + "order": "CA-2017-116127", + "row": 9584, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-116127", + "row": 9584, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 9584, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-16T00:00:00.000Z, + "order": "CA-2017-160633", + "row": 9618, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-160633", + "row": 9618, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 9618, + }, + Object { + "SUM(a.count)": "1", + "date": 2020-11-16T00:00:00.000Z, + "order": "CA-2017-160633", + "row": 9619, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": "CA-2017-160633", + "row": 9619, + }, + Object { + "SUM(a.count)": "1", + "date": null, + "order": null, + "row": 9619, + }, + Object { + "SUM(a.count)": "44", + "date": null, + "order": null, + "row": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup with aliases: nested_rollup_with_aliases 1`] = ` +Array [ + Object { + "SUM(a.cnt)": "1", + "date": 2020-01-23T00:00:00.000Z, + "order": "CA-2017-145142", + "row": 523, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-145142", + "row": 523, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 523, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-01-01T00:00:00.000Z, + "order": "CA-2017-107503", + "row": 849, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-107503", + "row": 849, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 849, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-17T00:00:00.000Z, + "order": "CA-2017-118437", + "row": 1013, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-118437", + "row": 1013, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 1013, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-10-30T00:00:00.000Z, + "order": "CA-2017-139661", + "row": 1494, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-139661", + "row": 1494, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 1494, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-25T00:00:00.000Z, + "order": "CA-2017-133648", + "row": 1995, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-133648", + "row": 1995, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 1995, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-09-23T00:00:00.000Z, + "order": "CA-2017-138422", + "row": 2329, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-138422", + "row": 2329, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 2329, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-03-17T00:00:00.000Z, + "order": "CA-2017-140949", + "row": 2455, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-140949", + "row": 2455, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 2455, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-05-13T00:00:00.000Z, + "order": "CA-2017-149048", + "row": 2595, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-149048", + "row": 2595, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 2595, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-09-17T00:00:00.000Z, + "order": "CA-2017-112515", + "row": 2655, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-112515", + "row": 2655, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 2655, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-28T00:00:00.000Z, + "order": "CA-2017-123372", + "row": 2661, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-123372", + "row": 2661, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 2661, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-12T00:00:00.000Z, + "order": "CA-2017-134915", + "row": 2952, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-134915", + "row": 2952, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 2952, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-10-19T00:00:00.000Z, + "order": "CA-2017-131492", + "row": 3059, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-131492", + "row": 3059, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 3059, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-10-19T00:00:00.000Z, + "order": "CA-2017-131492", + "row": 3060, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-131492", + "row": 3060, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 3060, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-05-27T00:00:00.000Z, + "order": "US-2017-132297", + "row": 3083, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "US-2017-132297", + "row": 3083, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 3083, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-11T00:00:00.000Z, + "order": "CA-2017-102554", + "row": 3448, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-102554", + "row": 3448, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 3448, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-05-29T00:00:00.000Z, + "order": "CA-2017-144568", + "row": 3717, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-144568", + "row": 3717, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 3717, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-09-02T00:00:00.000Z, + "order": "CA-2017-123001", + "row": 3934, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-123001", + "row": 3934, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 3934, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-21T00:00:00.000Z, + "order": "CA-2017-100811", + "row": 4012, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-100811", + "row": 4012, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 4012, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-24T00:00:00.000Z, + "order": "CA-2017-124296", + "row": 4031, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-124296", + "row": 4031, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 4031, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-05-14T00:00:00.000Z, + "order": "CA-2017-115546", + "row": 4161, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-115546", + "row": 4161, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 4161, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-11T00:00:00.000Z, + "order": "CA-2017-120327", + "row": 4227, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-120327", + "row": 4227, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 4227, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-02T00:00:00.000Z, + "order": "CA-2017-143567", + "row": 4882, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-143567", + "row": 4882, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 4882, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-09-01T00:00:00.000Z, + "order": "CA-2017-145653", + "row": 5220, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-145653", + "row": 5220, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 5220, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-14T00:00:00.000Z, + "order": "CA-2017-147333", + "row": 5277, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-147333", + "row": 5277, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 5277, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-03T00:00:00.000Z, + "order": "CA-2017-145772", + "row": 6125, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-145772", + "row": 6125, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 6125, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-01T00:00:00.000Z, + "order": "CA-2017-145660", + "row": 6205, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-145660", + "row": 6205, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 6205, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-02T00:00:00.000Z, + "order": "CA-2017-102379", + "row": 6272, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-102379", + "row": 6272, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 6272, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-05-14T00:00:00.000Z, + "order": "US-2017-133361", + "row": 6459, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "US-2017-133361", + "row": 6459, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 6459, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-09-08T00:00:00.000Z, + "order": "US-2017-124779", + "row": 6651, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "US-2017-124779", + "row": 6651, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 6651, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-03-26T00:00:00.000Z, + "order": "US-2017-141677", + "row": 7174, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "US-2017-141677", + "row": 7174, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 7174, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-04T00:00:00.000Z, + "order": "CA-2017-109183", + "row": 7293, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-109183", + "row": 7293, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 7293, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-10T00:00:00.000Z, + "order": "CA-2017-112172", + "row": 7310, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-112172", + "row": 7310, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 7310, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-04-10T00:00:00.000Z, + "order": "CA-2017-135069", + "row": 7425, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-135069", + "row": 7425, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 7425, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-14T00:00:00.000Z, + "order": "CA-2017-151799", + "row": 7698, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-151799", + "row": 7698, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 7698, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-10-12T00:00:00.000Z, + "order": "CA-2017-150091", + "row": 8425, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-150091", + "row": 8425, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 8425, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-06T00:00:00.000Z, + "order": "US-2017-119319", + "row": 8621, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "US-2017-119319", + "row": 8621, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 8621, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-02-16T00:00:00.000Z, + "order": "CA-2017-163265", + "row": 8673, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-163265", + "row": 8673, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 8673, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-15T00:00:00.000Z, + "order": "CA-2017-119284", + "row": 8697, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-119284", + "row": 8697, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 8697, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-09-17T00:00:00.000Z, + "order": "CA-2017-126928", + "row": 8878, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-126928", + "row": 8878, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 8878, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-12-25T00:00:00.000Z, + "order": "CA-2017-105620", + "row": 8958, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-105620", + "row": 8958, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 8958, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-05T00:00:00.000Z, + "order": "CA-2017-102925", + "row": 9473, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-102925", + "row": 9473, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 9473, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-06-25T00:00:00.000Z, + "order": "CA-2017-116127", + "row": 9584, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-116127", + "row": 9584, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 9584, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-16T00:00:00.000Z, + "order": "CA-2017-160633", + "row": 9618, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-160633", + "row": 9618, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 9618, + }, + Object { + "SUM(a.cnt)": "1", + "date": 2020-11-16T00:00:00.000Z, + "order": "CA-2017-160633", + "row": 9619, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": "CA-2017-160633", + "row": 9619, + }, + Object { + "SUM(a.cnt)": "1", + "date": null, + "order": null, + "row": 9619, + }, + Object { + "SUM(a.cnt)": "44", + "date": null, + "order": null, + "row": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup: nested_rollup 1`] = ` +Array [ + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": "CA-2017-145142", + "rowId": 523, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-145142", + "rowId": 523, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 523, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": "CA-2017-107503", + "rowId": 849, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-107503", + "rowId": 849, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 849, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": "CA-2017-118437", + "rowId": 1013, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-118437", + "rowId": 1013, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 1013, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": "CA-2017-139661", + "rowId": 1494, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-139661", + "rowId": 1494, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 1494, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-133648", + "rowId": 1995, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-133648", + "rowId": 1995, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 1995, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": "CA-2017-138422", + "rowId": 2329, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-138422", + "rowId": 2329, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2329, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": "CA-2017-140949", + "rowId": 2455, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-140949", + "rowId": 2455, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2455, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": "CA-2017-149048", + "rowId": 2595, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-149048", + "rowId": 2595, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2595, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-112515", + "rowId": 2655, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-112515", + "rowId": 2655, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2655, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": "CA-2017-123372", + "rowId": 2661, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-123372", + "rowId": 2661, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2661, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": "CA-2017-134915", + "rowId": 2952, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-134915", + "rowId": 2952, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2952, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3059, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-131492", + "rowId": 3059, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3059, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3060, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-131492", + "rowId": 3060, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3060, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": "US-2017-132297", + "rowId": 3083, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "US-2017-132297", + "rowId": 3083, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3083, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": "CA-2017-102554", + "rowId": 3448, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-102554", + "rowId": 3448, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3448, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": "CA-2017-144568", + "rowId": 3717, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-144568", + "rowId": 3717, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3717, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": "CA-2017-123001", + "rowId": 3934, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-123001", + "rowId": 3934, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3934, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": "CA-2017-100811", + "rowId": 4012, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-100811", + "rowId": 4012, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4012, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": "CA-2017-124296", + "rowId": 4031, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-124296", + "rowId": 4031, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4031, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "CA-2017-115546", + "rowId": 4161, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-115546", + "rowId": 4161, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4161, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": "CA-2017-120327", + "rowId": 4227, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-120327", + "rowId": 4227, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4227, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": "CA-2017-143567", + "rowId": 4882, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-143567", + "rowId": 4882, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4882, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": "CA-2017-145653", + "rowId": 5220, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-145653", + "rowId": 5220, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 5220, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-147333", + "rowId": 5277, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-147333", + "rowId": 5277, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 5277, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": "CA-2017-145772", + "rowId": 6125, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-145772", + "rowId": 6125, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6125, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": "CA-2017-145660", + "rowId": 6205, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-145660", + "rowId": 6205, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6205, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": "CA-2017-102379", + "rowId": 6272, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-102379", + "rowId": 6272, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6272, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "US-2017-133361", + "rowId": 6459, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "US-2017-133361", + "rowId": 6459, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6459, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": "US-2017-124779", + "rowId": 6651, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "US-2017-124779", + "rowId": 6651, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6651, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": "US-2017-141677", + "rowId": 7174, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "US-2017-141677", + "rowId": 7174, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7174, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": "CA-2017-109183", + "rowId": 7293, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-109183", + "rowId": 7293, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7293, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": "CA-2017-112172", + "rowId": 7310, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-112172", + "rowId": 7310, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7310, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": "CA-2017-135069", + "rowId": 7425, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-135069", + "rowId": 7425, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7425, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-151799", + "rowId": 7698, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-151799", + "rowId": 7698, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7698, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": "CA-2017-150091", + "rowId": 8425, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-150091", + "rowId": 8425, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8425, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": "US-2017-119319", + "rowId": 8621, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "US-2017-119319", + "rowId": 8621, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8621, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": "CA-2017-163265", + "rowId": 8673, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-163265", + "rowId": 8673, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8673, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": "CA-2017-119284", + "rowId": 8697, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-119284", + "rowId": 8697, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8697, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-126928", + "rowId": 8878, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-126928", + "rowId": 8878, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8878, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": "CA-2017-105620", + "rowId": 8958, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-105620", + "rowId": 8958, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8958, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": "CA-2017-102925", + "rowId": 9473, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-102925", + "rowId": 9473, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9473, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-116127", + "rowId": 9584, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-116127", + "rowId": 9584, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9584, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9618, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-160633", + "rowId": 9618, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9618, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9619, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": "CA-2017-160633", + "rowId": 9619, + }, + Object { + "SUM(a.cnt)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9619, + }, + Object { + "SUM(a.cnt)": "44", + "orderDate": null, + "orderId": null, + "rowId": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Rollup over exprs: rollup_over_exprs 1`] = ` +Array [ + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": 944.96, + "orderData": 2020-01-23T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 944.96, + "orderData": 2020-01-23T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 944.96, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "order": 946.792, + "orderData": 2020-01-01T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 946.792, + "orderData": 2020-01-01T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 946.792, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "order": 1041.06, + "orderData": 2020-06-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 1041.06, + "orderData": 2020-06-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 1041.06, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "order": 1513.28, + "orderData": 2020-10-30T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 1513.28, + "orderData": 2020-10-30T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 1513.28, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 2017.608, + "orderData": 2020-06-25T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2017.608, + "orderData": 2020-06-25T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2017.608, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 2357.704, + "orderData": 2020-09-23T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2357.704, + "orderData": 2020-09-23T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2357.704, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": 2598.2, + "orderData": 2020-03-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2598.2, + "orderData": 2020-03-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2598.2, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 2956.92, + "orderData": 2020-05-13T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2956.92, + "orderData": 2020-05-13T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 2956.92, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "order": 3108.736, + "orderData": 2020-10-19T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3108.736, + "orderData": 2020-10-19T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3108.736, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "order": 3120.12, + "orderData": 2020-10-19T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3120.12, + "orderData": 2020-10-19T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3120.12, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "order": 3179.776, + "orderData": 2020-11-12T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3179.776, + "orderData": 2020-11-12T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3179.776, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "order": 3455.52, + "orderData": 2020-06-11T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3455.52, + "orderData": 2020-06-11T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3455.52, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "order": 3764.1, + "orderData": 2020-05-29T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3764.1, + "orderData": 2020-05-29T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3764.1, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "order": 3952.8, + "orderData": 2020-09-02T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3952.8, + "orderData": 2020-09-02T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 3952.8, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": 4090.592, + "orderData": 2020-11-21T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4090.592, + "orderData": 2020-11-21T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4090.592, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "order": 4162.94, + "orderData": 2020-05-27T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4162.94, + "orderData": 2020-05-27T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4162.94, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 4318.84, + "orderData": 2020-11-11T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4318.84, + "orderData": 2020-11-11T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4318.84, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "order": 4496.76, + "orderData": 2020-12-24T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4496.76, + "orderData": 2020-12-24T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 4496.76, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "order": 5240.88, + "orderData": 2020-09-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 5240.88, + "orderData": 2020-09-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 5240.88, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": 5240.94, + "orderData": 2020-05-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 5240.94, + "orderData": 2020-05-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 5240.94, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 5366.5, + "orderData": 2020-12-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 5366.5, + "orderData": 2020-12-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 5366.5, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "order": 6214.5, + "orderData": 2020-06-03T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6214.5, + "orderData": 2020-06-03T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6214.5, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": 6216.52, + "orderData": 2020-09-01T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6216.52, + "orderData": 2020-09-01T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6216.52, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "order": 6220.424, + "orderData": 2020-12-01T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6220.424, + "orderData": 2020-12-01T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6220.424, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "order": 6466.52, + "orderData": 2020-05-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6466.52, + "orderData": 2020-05-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6466.52, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 6620.78, + "orderData": 2020-11-28T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6620.78, + "orderData": 2020-11-28T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6620.78, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "order": 6631.8, + "orderData": 2020-12-02T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6631.8, + "orderData": 2020-12-02T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6631.8, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "order": 6742.84, + "orderData": 2020-09-08T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6742.84, + "orderData": 2020-09-08T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 6742.84, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": 7338.26, + "orderData": 2020-06-10T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 7338.26, + "orderData": 2020-06-10T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 7338.26, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": 7498.344, + "orderData": 2020-04-10T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 7498.344, + "orderData": 2020-04-10T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 7498.344, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 8591, + "orderData": 2020-12-04T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 8591, + "orderData": 2020-12-04T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 8591, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "order": 8682.12, + "orderData": 2020-11-06T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 8682.12, + "orderData": 2020-11-06T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 8682.12, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "order": 8709.736, + "orderData": 2020-02-16T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 8709.736, + "orderData": 2020-02-16T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 8709.736, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 9176.952, + "orderData": 2020-06-15T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9176.952, + "orderData": 2020-06-15T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9176.952, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 9198, + "orderData": 2020-12-25T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9198, + "orderData": 2020-12-25T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9198, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 9381.82, + "orderData": 2020-11-02T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9381.82, + "orderData": 2020-11-02T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9381.82, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": 9729.248, + "orderData": 2020-11-05T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9729.248, + "orderData": 2020-11-05T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9729.248, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "order": 9791.704, + "orderData": 2020-11-16T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9791.704, + "orderData": 2020-11-16T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9791.704, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "order": 9838, + "orderData": 2020-09-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9838, + "orderData": 2020-09-17T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 9838, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 10097.96, + "orderData": 2020-12-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 10097.96, + "orderData": 2020-12-14T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 10097.96, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": 10385.568, + "orderData": 2020-06-25T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 10385.568, + "orderData": 2020-06-25T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 10385.568, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": 11417.964, + "orderData": 2020-11-16T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 11417.964, + "orderData": 2020-11-16T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 11417.964, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "order": 11973.92, + "orderData": 2020-03-26T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 11973.92, + "orderData": 2020-03-26T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 11973.92, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "order": 12734.8, + "orderData": 2020-10-12T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 12734.8, + "orderData": 2020-10-12T00:00:00.000Z, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": 12734.8, + "orderData": null, + }, + Object { + "SUM(ECommerce.count)": "44", + "city": null, + "order": null, + "orderData": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Rollup with aliases: rollup_with_aliases 1`] = ` +Array [ + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": "CA-2017-145142", + "orderData": 2020-01-23T00:00:00.000Z, + "row": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-145142", + "orderData": 2020-01-23T00:00:00.000Z, + "row": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": null, + "orderData": 2020-01-23T00:00:00.000Z, + "row": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-01-23T00:00:00.000Z, + "row": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "order": "CA-2017-107503", + "orderData": 2020-01-01T00:00:00.000Z, + "row": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-107503", + "orderData": 2020-01-01T00:00:00.000Z, + "row": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "order": null, + "orderData": 2020-01-01T00:00:00.000Z, + "row": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-01-01T00:00:00.000Z, + "row": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "order": "CA-2017-118437", + "orderData": 2020-06-17T00:00:00.000Z, + "row": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-118437", + "orderData": 2020-06-17T00:00:00.000Z, + "row": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "order": null, + "orderData": 2020-06-17T00:00:00.000Z, + "row": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-17T00:00:00.000Z, + "row": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "order": "CA-2017-139661", + "orderData": 2020-10-30T00:00:00.000Z, + "row": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-139661", + "orderData": 2020-10-30T00:00:00.000Z, + "row": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "order": null, + "orderData": 2020-10-30T00:00:00.000Z, + "row": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-10-30T00:00:00.000Z, + "row": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-133648", + "orderData": 2020-06-25T00:00:00.000Z, + "row": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-133648", + "orderData": 2020-06-25T00:00:00.000Z, + "row": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-138422", + "orderData": 2020-09-23T00:00:00.000Z, + "row": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-138422", + "orderData": 2020-09-23T00:00:00.000Z, + "row": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-09-23T00:00:00.000Z, + "row": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-23T00:00:00.000Z, + "row": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": "CA-2017-140949", + "orderData": 2020-03-17T00:00:00.000Z, + "row": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-140949", + "orderData": 2020-03-17T00:00:00.000Z, + "row": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-03-17T00:00:00.000Z, + "row": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-03-17T00:00:00.000Z, + "row": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-149048", + "orderData": 2020-05-13T00:00:00.000Z, + "row": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-149048", + "orderData": 2020-05-13T00:00:00.000Z, + "row": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-05-13T00:00:00.000Z, + "row": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-13T00:00:00.000Z, + "row": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "order": "CA-2017-112515", + "orderData": 2020-09-17T00:00:00.000Z, + "row": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-112515", + "orderData": 2020-09-17T00:00:00.000Z, + "row": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-123372", + "orderData": 2020-11-28T00:00:00.000Z, + "row": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-123372", + "orderData": 2020-11-28T00:00:00.000Z, + "row": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-28T00:00:00.000Z, + "row": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-28T00:00:00.000Z, + "row": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "order": "CA-2017-134915", + "orderData": 2020-11-12T00:00:00.000Z, + "row": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-134915", + "orderData": 2020-11-12T00:00:00.000Z, + "row": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "order": null, + "orderData": 2020-11-12T00:00:00.000Z, + "row": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-12T00:00:00.000Z, + "row": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "order": "CA-2017-131492", + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-131492", + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "order": null, + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "order": "CA-2017-131492", + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-131492", + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "San Francisco", + "order": null, + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-10-19T00:00:00.000Z, + "row": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "order": "US-2017-132297", + "orderData": 2020-05-27T00:00:00.000Z, + "row": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "US-2017-132297", + "orderData": 2020-05-27T00:00:00.000Z, + "row": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "order": null, + "orderData": 2020-05-27T00:00:00.000Z, + "row": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-27T00:00:00.000Z, + "row": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "order": "CA-2017-102554", + "orderData": 2020-06-11T00:00:00.000Z, + "row": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-102554", + "orderData": 2020-06-11T00:00:00.000Z, + "row": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "order": null, + "orderData": 2020-06-11T00:00:00.000Z, + "row": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-11T00:00:00.000Z, + "row": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "order": "CA-2017-144568", + "orderData": 2020-05-29T00:00:00.000Z, + "row": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-144568", + "orderData": 2020-05-29T00:00:00.000Z, + "row": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "order": null, + "orderData": 2020-05-29T00:00:00.000Z, + "row": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-29T00:00:00.000Z, + "row": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "order": "CA-2017-123001", + "orderData": 2020-09-02T00:00:00.000Z, + "row": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-123001", + "orderData": 2020-09-02T00:00:00.000Z, + "row": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "order": null, + "orderData": 2020-09-02T00:00:00.000Z, + "row": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-02T00:00:00.000Z, + "row": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": "CA-2017-100811", + "orderData": 2020-11-21T00:00:00.000Z, + "row": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-100811", + "orderData": 2020-11-21T00:00:00.000Z, + "row": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": null, + "orderData": 2020-11-21T00:00:00.000Z, + "row": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-21T00:00:00.000Z, + "row": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "order": "CA-2017-124296", + "orderData": 2020-12-24T00:00:00.000Z, + "row": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-124296", + "orderData": 2020-12-24T00:00:00.000Z, + "row": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "order": null, + "orderData": 2020-12-24T00:00:00.000Z, + "row": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-24T00:00:00.000Z, + "row": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": "CA-2017-115546", + "orderData": 2020-05-14T00:00:00.000Z, + "row": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-115546", + "orderData": 2020-05-14T00:00:00.000Z, + "row": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-120327", + "orderData": 2020-11-11T00:00:00.000Z, + "row": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-120327", + "orderData": 2020-11-11T00:00:00.000Z, + "row": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-11T00:00:00.000Z, + "row": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-11T00:00:00.000Z, + "row": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-143567", + "orderData": 2020-11-02T00:00:00.000Z, + "row": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-143567", + "orderData": 2020-11-02T00:00:00.000Z, + "row": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-02T00:00:00.000Z, + "row": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-02T00:00:00.000Z, + "row": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": "CA-2017-145653", + "orderData": 2020-09-01T00:00:00.000Z, + "row": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-145653", + "orderData": 2020-09-01T00:00:00.000Z, + "row": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": null, + "orderData": 2020-09-01T00:00:00.000Z, + "row": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-01T00:00:00.000Z, + "row": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-147333", + "orderData": 2020-12-14T00:00:00.000Z, + "row": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-147333", + "orderData": 2020-12-14T00:00:00.000Z, + "row": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-12-14T00:00:00.000Z, + "row": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-14T00:00:00.000Z, + "row": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "order": "CA-2017-145772", + "orderData": 2020-06-03T00:00:00.000Z, + "row": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-145772", + "orderData": 2020-06-03T00:00:00.000Z, + "row": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "order": null, + "orderData": 2020-06-03T00:00:00.000Z, + "row": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-03T00:00:00.000Z, + "row": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "order": "CA-2017-145660", + "orderData": 2020-12-01T00:00:00.000Z, + "row": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-145660", + "orderData": 2020-12-01T00:00:00.000Z, + "row": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "order": null, + "orderData": 2020-12-01T00:00:00.000Z, + "row": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-01T00:00:00.000Z, + "row": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "order": "CA-2017-102379", + "orderData": 2020-12-02T00:00:00.000Z, + "row": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-102379", + "orderData": 2020-12-02T00:00:00.000Z, + "row": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "order": null, + "orderData": 2020-12-02T00:00:00.000Z, + "row": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-02T00:00:00.000Z, + "row": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "order": "US-2017-133361", + "orderData": 2020-05-14T00:00:00.000Z, + "row": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "US-2017-133361", + "orderData": 2020-05-14T00:00:00.000Z, + "row": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "order": "US-2017-124779", + "orderData": 2020-09-08T00:00:00.000Z, + "row": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "US-2017-124779", + "orderData": 2020-09-08T00:00:00.000Z, + "row": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "order": null, + "orderData": 2020-09-08T00:00:00.000Z, + "row": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-08T00:00:00.000Z, + "row": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "order": "US-2017-141677", + "orderData": 2020-03-26T00:00:00.000Z, + "row": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "US-2017-141677", + "orderData": 2020-03-26T00:00:00.000Z, + "row": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "order": null, + "orderData": 2020-03-26T00:00:00.000Z, + "row": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-03-26T00:00:00.000Z, + "row": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-109183", + "orderData": 2020-12-04T00:00:00.000Z, + "row": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-109183", + "orderData": 2020-12-04T00:00:00.000Z, + "row": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-12-04T00:00:00.000Z, + "row": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-04T00:00:00.000Z, + "row": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": "CA-2017-112172", + "orderData": 2020-06-10T00:00:00.000Z, + "row": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-112172", + "orderData": 2020-06-10T00:00:00.000Z, + "row": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-06-10T00:00:00.000Z, + "row": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-10T00:00:00.000Z, + "row": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": "CA-2017-135069", + "orderData": 2020-04-10T00:00:00.000Z, + "row": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-135069", + "orderData": 2020-04-10T00:00:00.000Z, + "row": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": null, + "orderData": 2020-04-10T00:00:00.000Z, + "row": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-04-10T00:00:00.000Z, + "row": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-151799", + "orderData": 2020-12-14T00:00:00.000Z, + "row": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-151799", + "orderData": 2020-12-14T00:00:00.000Z, + "row": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-12-14T00:00:00.000Z, + "row": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-14T00:00:00.000Z, + "row": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "order": "CA-2017-150091", + "orderData": 2020-10-12T00:00:00.000Z, + "row": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-150091", + "orderData": 2020-10-12T00:00:00.000Z, + "row": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "order": null, + "orderData": 2020-10-12T00:00:00.000Z, + "row": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-10-12T00:00:00.000Z, + "row": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "order": "US-2017-119319", + "orderData": 2020-11-06T00:00:00.000Z, + "row": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "US-2017-119319", + "orderData": 2020-11-06T00:00:00.000Z, + "row": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "order": null, + "orderData": 2020-11-06T00:00:00.000Z, + "row": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-06T00:00:00.000Z, + "row": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "order": "CA-2017-163265", + "orderData": 2020-02-16T00:00:00.000Z, + "row": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-163265", + "orderData": 2020-02-16T00:00:00.000Z, + "row": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "order": null, + "orderData": 2020-02-16T00:00:00.000Z, + "row": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-02-16T00:00:00.000Z, + "row": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-119284", + "orderData": 2020-06-15T00:00:00.000Z, + "row": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-119284", + "orderData": 2020-06-15T00:00:00.000Z, + "row": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-06-15T00:00:00.000Z, + "row": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-15T00:00:00.000Z, + "row": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "order": "CA-2017-126928", + "orderData": 2020-09-17T00:00:00.000Z, + "row": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-126928", + "orderData": 2020-09-17T00:00:00.000Z, + "row": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-105620", + "orderData": 2020-12-25T00:00:00.000Z, + "row": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-105620", + "orderData": 2020-12-25T00:00:00.000Z, + "row": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-12-25T00:00:00.000Z, + "row": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-25T00:00:00.000Z, + "row": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": "CA-2017-102925", + "orderData": 2020-11-05T00:00:00.000Z, + "row": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-102925", + "orderData": 2020-11-05T00:00:00.000Z, + "row": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-11-05T00:00:00.000Z, + "row": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-05T00:00:00.000Z, + "row": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": "CA-2017-116127", + "orderData": 2020-06-25T00:00:00.000Z, + "row": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-116127", + "orderData": 2020-06-25T00:00:00.000Z, + "row": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": "CA-2017-160633", + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-160633", + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "order": "CA-2017-160633", + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": "CA-2017-160633", + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lorain", + "order": null, + "orderData": 2020-01-01T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-01-01T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": null, + "orderData": 2020-01-23T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-01-23T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Decatur", + "order": null, + "orderData": 2020-02-16T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-02-16T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-03-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-03-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Houston", + "order": null, + "orderData": 2020-03-26T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-03-26T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": null, + "orderData": 2020-04-10T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-04-10T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-05-13T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-13T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Baltimore", + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "order": null, + "orderData": 2020-05-14T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Louisville", + "order": null, + "orderData": 2020-05-27T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-27T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Omaha", + "order": null, + "orderData": 2020-05-29T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-05-29T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Los Angeles", + "order": null, + "orderData": 2020-06-03T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-03T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-06-10T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-10T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Auburn", + "order": null, + "orderData": 2020-06-11T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-11T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-06-15T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-15T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Olympia", + "order": null, + "orderData": 2020-06-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-06-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "order": null, + "orderData": 2020-06-25T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Detroit", + "order": null, + "orderData": 2020-09-01T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-01T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bakersfield", + "order": null, + "orderData": 2020-09-02T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-02T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Arlington", + "order": null, + "orderData": 2020-09-08T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-08T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Morristown", + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Provo", + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "order": null, + "orderData": 2020-09-17T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-09-23T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-09-23T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lakewood", + "order": null, + "orderData": 2020-10-12T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-10-12T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": "San Francisco", + "order": null, + "orderData": 2020-10-19T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "order": null, + "orderData": 2020-10-19T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Vancouver", + "order": null, + "orderData": 2020-10-30T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-10-30T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-02T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-02T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "New York City", + "order": null, + "orderData": 2020-11-05T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-05T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Dallas", + "order": null, + "orderData": 2020-11-06T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-06T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-11T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-11T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Glendale", + "order": null, + "orderData": 2020-11-12T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-12T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Bowling", + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "order": null, + "orderData": 2020-11-16T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Philadelphia", + "order": null, + "orderData": 2020-11-21T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-21T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-11-28T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-11-28T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Marion", + "order": null, + "orderData": 2020-12-01T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-01T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Oakland", + "order": null, + "orderData": 2020-12-02T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-02T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-12-04T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-04T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": "Columbus", + "order": null, + "orderData": 2020-12-14T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "2", + "city": null, + "order": null, + "orderData": 2020-12-14T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Lafayette", + "order": null, + "orderData": 2020-12-24T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-24T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": "Columbus", + "order": null, + "orderData": 2020-12-25T00:00:00.000Z, + "row": null, + }, + Object { + "SUM(ECommerce.count)": "1", + "city": null, + "order": null, + "orderData": 2020-12-25T00:00:00.000Z, + "row": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Simple Rollup: simple_rollup 1`] = ` +Array [ + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-01-23T00:00:00.000Z, + "orderId": "CA-2017-145142", + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-145142", + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 523, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-01-01T00:00:00.000Z, + "orderId": "CA-2017-107503", + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-107503", + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 849, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-17T00:00:00.000Z, + "orderId": "CA-2017-118437", + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-118437", + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 1013, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-10-30T00:00:00.000Z, + "orderId": "CA-2017-139661", + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-139661", + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 1494, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-133648", + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-133648", + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 1995, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-09-23T00:00:00.000Z, + "orderId": "CA-2017-138422", + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-138422", + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2329, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-03-17T00:00:00.000Z, + "orderId": "CA-2017-140949", + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-140949", + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2455, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-05-13T00:00:00.000Z, + "orderId": "CA-2017-149048", + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-149048", + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2595, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-112515", + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-112515", + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2655, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-28T00:00:00.000Z, + "orderId": "CA-2017-123372", + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-123372", + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2661, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-12T00:00:00.000Z, + "orderId": "CA-2017-134915", + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-134915", + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 2952, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-131492", + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3059, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-10-19T00:00:00.000Z, + "orderId": "CA-2017-131492", + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-131492", + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3060, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-05-27T00:00:00.000Z, + "orderId": "US-2017-132297", + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "US-2017-132297", + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3083, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-11T00:00:00.000Z, + "orderId": "CA-2017-102554", + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-102554", + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3448, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-05-29T00:00:00.000Z, + "orderId": "CA-2017-144568", + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-144568", + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3717, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-09-02T00:00:00.000Z, + "orderId": "CA-2017-123001", + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-123001", + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 3934, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-21T00:00:00.000Z, + "orderId": "CA-2017-100811", + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-100811", + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4012, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-24T00:00:00.000Z, + "orderId": "CA-2017-124296", + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-124296", + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4031, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "CA-2017-115546", + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-115546", + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4161, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-11T00:00:00.000Z, + "orderId": "CA-2017-120327", + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-120327", + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4227, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-02T00:00:00.000Z, + "orderId": "CA-2017-143567", + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-143567", + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 4882, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-09-01T00:00:00.000Z, + "orderId": "CA-2017-145653", + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-145653", + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 5220, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-147333", + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-147333", + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 5277, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-03T00:00:00.000Z, + "orderId": "CA-2017-145772", + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-145772", + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6125, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-01T00:00:00.000Z, + "orderId": "CA-2017-145660", + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-145660", + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6205, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-02T00:00:00.000Z, + "orderId": "CA-2017-102379", + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-102379", + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6272, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-05-14T00:00:00.000Z, + "orderId": "US-2017-133361", + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "US-2017-133361", + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6459, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-09-08T00:00:00.000Z, + "orderId": "US-2017-124779", + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "US-2017-124779", + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 6651, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-03-26T00:00:00.000Z, + "orderId": "US-2017-141677", + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "US-2017-141677", + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7174, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-04T00:00:00.000Z, + "orderId": "CA-2017-109183", + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-109183", + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7293, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-10T00:00:00.000Z, + "orderId": "CA-2017-112172", + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-112172", + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7310, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-04-10T00:00:00.000Z, + "orderId": "CA-2017-135069", + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-135069", + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7425, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-14T00:00:00.000Z, + "orderId": "CA-2017-151799", + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-151799", + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 7698, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-10-12T00:00:00.000Z, + "orderId": "CA-2017-150091", + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-150091", + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8425, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-06T00:00:00.000Z, + "orderId": "US-2017-119319", + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "US-2017-119319", + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8621, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-02-16T00:00:00.000Z, + "orderId": "CA-2017-163265", + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-163265", + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8673, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-15T00:00:00.000Z, + "orderId": "CA-2017-119284", + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-119284", + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8697, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-09-17T00:00:00.000Z, + "orderId": "CA-2017-126928", + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-126928", + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8878, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-12-25T00:00:00.000Z, + "orderId": "CA-2017-105620", + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-105620", + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 8958, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-05T00:00:00.000Z, + "orderId": "CA-2017-102925", + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-102925", + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9473, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-06-25T00:00:00.000Z, + "orderId": "CA-2017-116127", + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-116127", + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9584, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-160633", + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9618, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": 2020-11-16T00:00:00.000Z, + "orderId": "CA-2017-160633", + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": "CA-2017-160633", + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "1", + "orderDate": null, + "orderId": null, + "rowId": 9619, + }, + Object { + "SUM(ECommerce.count)": "44", + "orderDate": null, + "orderId": null, + "rowId": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: metabase count cast to float32 from push down: metabase_count_cast_to_float32_from_push_down 1`] = ` +Array [ + Object { + "a0": 41, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: post-aggregate percentage of total: post_aggregate_percentage_of_total 1`] = ` +Array [ + Object { + "SUM(BigECommerce.percentageOfTotalForStatus)": 100, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: powerbi min max push down: powerbi_min_max_push_down 1`] = ` +Array [ + Object { + "a0": 2020-12-25T00:00:00.000Z, + "a1": 2020-01-01T00:00:00.000Z, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: powerbi min max ungrouped flag: powerbi_min_max_ungrouped_flag 1`] = ` +Array [ + Object { + "a0": "39", + "a1": 3.76, + "a2": 2399.96, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: reuse params: reuse_params 1`] = ` +Array [ + Object { + "c0": 2020-01-01T00:00:00.000Z, + "m0": 17372, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: ungrouped pre-agg: ungrouped_pre_agg 1`] = ` +Array [ + Object { + "productName": "Canon PC1080F Personal Copier", + "totalSales": 2399.96, + }, + Object { + "productName": "Logitech di_Novo Edge Keyboard", + "totalSales": 2249.91, + }, + Object { + "productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "totalSales": 2154.9, + }, + Object { + "productName": "Google Nexus 5", + "totalSales": 1979.89, + }, + Object { + "productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "totalSales": 1292.94, + }, + Object { + "productName": "Canon PC1080F Personal Copier", + "totalSales": 1199.98, + }, + Object { + "productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "totalSales": 899.982, + }, + Object { + "productName": "Okidata C610n Printer", + "totalSales": 649, + }, + Object { + "productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "totalSales": 600, + }, + Object { + "productName": "Google Nexus 6", + "totalSales": 539.97, + }, + Object { + "productName": "Google Nexus 7", + "totalSales": 539.97, + }, + Object { + "productName": "Harbour Creations 67200 Series Stacking Chairs", + "totalSales": 498.26, + }, + Object { + "productName": "DMI Eclipse Executive Suite Bookcases", + "totalSales": 400.784, + }, + Object { + "productName": "HTC One", + "totalSales": 239.976, + }, + Object { + "productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "totalSales": 232.88, + }, + Object { + "productName": "Balt Solid Wood Rectangular Table", + "totalSales": 210.98, + }, + Object { + "productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "totalSales": 180.96, + }, + Object { + "productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "totalSales": 179.9, + }, + Object { + "productName": "Harbour Creations 67200 Series Stacking Chairs", + "totalSales": 128.124, + }, + Object { + "productName": "Harbour Creations 67200 Series Stacking Chairs", + "totalSales": 113.888, + }, + Object { + "productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "totalSales": 86.352, + }, + Object { + "productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "totalSales": 71.6, + }, + Object { + "productName": "Linden 10 Round Wall Clock, Black", + "totalSales": 48.896, + }, + Object { + "productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "totalSales": 45.92, + }, + Object { + "productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "totalSales": 45.92, + }, + Object { + "productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "totalSales": 44.75, + }, + Object { + "productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "totalSales": 44.75, + }, + Object { + "productName": "Recycled Eldon Regeneration Jumbo File", + "totalSales": 39.296, + }, + Object { + "productName": "Linden 10 Round Wall Clock, Black", + "totalSales": 36.672, + }, + Object { + "productName": "Linden 10 Round Wall Clock, Black", + "totalSales": 30.56, + }, + Object { + "productName": "Linden 10 Round Wall Clock, Black", + "totalSales": 30.56, + }, + Object { + "productName": "Anderson Hickey Conga Table Tops & Accessories", + "totalSales": 24.368, + }, + Object { + "productName": "Plymouth Boxed Rubber Bands by Plymouth", + "totalSales": 23.55, + }, + Object { + "productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "totalSales": 18.368, + }, + Object { + "productName": "Wausau Papers Astrobrights Colored Envelopes", + "totalSales": 14.352, + }, + Object { + "productName": "Plymouth Boxed Rubber Bands by Plymouth", + "totalSales": 14.13, + }, + Object { + "productName": "Project Tote Personal File", + "totalSales": 14.03, + }, + Object { + "productName": "Plymouth Boxed Rubber Bands by Plymouth", + "totalSales": 11.304, + }, + Object { + "productName": "Magna Visual Magnetic Picture Hangers", + "totalSales": 9.64, + }, + Object { + "productName": "OIC #2 Pencils, Medium Soft", + "totalSales": 9.4, + }, + Object { + "productName": "Magna Visual Magnetic Picture Hangers", + "totalSales": 7.712, + }, + Object { + "productName": "OIC #2 Pencils, Medium Soft", + "totalSales": 3.76, + }, + Object { + "productName": "OIC #2 Pencils, Medium Soft", + "totalSales": 3.76, + }, + Object { + "productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "totalSales": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, first 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, second 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, first 1`] = ` +Array [ + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, second 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, first 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, second 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, third 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, first 1`] = ` +Array [ + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, second 1`] = ` +Array [ + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, third 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, first 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, second 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, first 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, second 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lorain", + "ECommerce.customerId": "GA-14725", + "ECommerce.customerName": "Customer 19", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-107503", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "8.55680", + "ECommerce.quantity": 4, + "ECommerce.rowId": 849, + "ECommerce.sales": "48.89600", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "10.39040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3059, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Marion", + "ECommerce.customerId": "MG-17650", + "ECommerce.customerName": "Customer 32", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145660", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "1.73520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6205, + "ECommerce.sales": "7.71200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "BS-11755", + "ECommerce.customerName": "Customer 10", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-04-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-135069", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "6.41760", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7425, + "ECommerce.sales": "36.67200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Dallas", + "ECommerce.customerId": "LC-17050", + "ECommerce.customerName": "Customer 29", + "ECommerce.discount": "0.60000", + "ECommerce.orderDate": "2020-11-06T00:00:00.000", + "ECommerce.orderId": "US-2017-119319", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "-19.86400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8621, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, first 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Marion", + "ECommerce.customerId": "MG-17650", + "ECommerce.customerName": "Customer 32", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145660", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "1.73520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6205, + "ECommerce.sales": "7.71200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "JH-15430", + "ECommerce.customerName": "Customer 23", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-105620", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "-7.20000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8958, + "ECommerce.sales": "120.00000", + "ECommerce.subCategory": "Machines", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, second 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-138422", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.profit": "5.20260", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2329, + "ECommerce.sales": "14.35200", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "DG-13300", + "ECommerce.customerName": "Customer 16", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-28T00:00:00.000", + "ECommerce.orderId": "CA-2017-123372", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.profit": "494.97250", + "ECommerce.quantity": 11, + "ECommerce.rowId": 2661, + "ECommerce.sales": "1979.89000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "10.39040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3059, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "CC-12475", + "ECommerce.customerName": "Customer 12", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-21T00:00:00.000", + "ECommerce.orderId": "CA-2017-100811", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.profit": "3.92960", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4012, + "ECommerce.sales": "39.29600", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Los Angeles", + "ECommerce.customerId": "SS-20140", + "ECommerce.customerName": "Customer 38", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-03T00:00:00.000", + "ECommerce.orderId": "CA-2017-145772", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6125, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Baltimore", + "ECommerce.customerId": "AJ-10780", + "ECommerce.customerName": "Customer 2", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "US-2017-133361", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6459, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "New York City", + "ECommerce.customerId": "MM-18280", + "ECommerce.customerName": "Customer 34", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-112172", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "0.70650", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7310, + "ECommerce.sales": "14.13000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lakewood", + "ECommerce.customerId": "NP-18670", + "ECommerce.customerName": "Customer 35", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-150091", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "129.29400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8425, + "ECommerce.sales": "2154.90000", + "ECommerce.subCategory": "Bookcases", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, first 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "AH-10465", + "ECommerce.customerName": "Customer 1", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-115546", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 4161, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Baltimore", + "ECommerce.customerId": "AJ-10780", + "ECommerce.customerName": "Customer 2", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "US-2017-133361", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6459, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, second 1`] = ` +Array [ + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BM-11650", + "ECommerce.customerName": "Customer 8", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-13T00:00:00.000", + "ECommerce.orderId": "CA-2017-149048", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.profit": "81.43200", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2595, + "ECommerce.sales": "180.96000", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "AH-10465", + "ECommerce.customerName": "Customer 1", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-115546", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 4161, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Oakland", + "ECommerce.customerId": "BB-11545", + "ECommerce.customerName": "Customer 5", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-102379", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "44.97500", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6272, + "ECommerce.sales": "179.90000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Baltimore", + "ECommerce.customerId": "AJ-10780", + "ECommerce.customerName": "Customer 2", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "US-2017-133361", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6459, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Arlington", + "ECommerce.customerId": "BF-11020", + "ECommerce.customerName": "Customer 6", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-08T00:00:00.000", + "ECommerce.orderId": "US-2017-124779", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "15.49800", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6651, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "BS-11755", + "ECommerce.customerName": "Customer 10", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-04-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-135069", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "6.41760", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7425, + "ECommerce.sales": "36.67200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BF-11170", + "ECommerce.customerName": "Customer 7", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-151799", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "467.99220", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7698, + "ECommerce.sales": "1199.98000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.40000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.profit": "74.99850", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9618, + "ECommerce.sales": "899.98200", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bowling", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "5.39700", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9619, + "ECommerce.sales": "86.35200", + "ECommerce.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, first 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, second 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "Linden 10 Round Wall Clock, Black", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Magna Visual Magnetic Picture Hangers", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains with special chars + dimensions 1`] = ` +Array [ + Object { + "Products.productName": "Logitech di_Novo Edge Keyboard", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, first 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "DMI Eclipse Executive Suite Bookcases", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Wausau Papers Astrobrights Colored Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Logitech di_Novo Edge Keyboard", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Okidata C610n Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 5", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 6", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 7", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "HTC One", + "Products.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, second 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "DMI Eclipse Executive Suite Bookcases", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Linden 10 Round Wall Clock, Black", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Magna Visual Magnetic Picture Hangers", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Wausau Papers Astrobrights Colored Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Logitech di_Novo Edge Keyboard", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Okidata C610n Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 5", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 6", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 7", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "HTC One", + "Products.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, first 1`] = ` +Array [ + Object { + "Products.category": "Office Supplies", + "Products.productName": "OIC #2 Pencils, Medium Soft", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Okidata C610n Printer", + "Products.subCategory": "Machines", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, second 1`] = ` +Array [ + Object { + "Products.category": "Office Supplies", + "Products.productName": "OIC #2 Pencils, Medium Soft", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Okidata C610n Printer", + "Products.subCategory": "Machines", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, third 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response pre-aggregations Customers: running total without time dimension 1`] = ` +Array [ + Object { + "Customers.runningTotal": "41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: null boolean 1`] = ` +Array [ + Object { + "BigECommerce.returning": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: null sum 1`] = ` +Array [ + Object { + "BigECommerce.totalSales": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: partitioned pre-agg 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "BigECommerce.productName": "Balt Solid Wood Rectangular Table", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", + "BigECommerce.totalQuantity": "4", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000Z", + "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "BigECommerce.productName": "Canon PC1080F Personal Copier", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "BigECommerce.totalQuantity": "8", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000Z", + "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.productName": "Google Nexus 6", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.productName": "Google Nexus 7", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "BigECommerce.totalQuantity": "1", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.productName": "HTC One", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "BigECommerce.totalQuantity": "6", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.productName": "Project Tote Personal File", + "BigECommerce.totalQuantity": "1", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "BigECommerce.totalQuantity": "7", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "BigECommerce.totalQuantity": "4", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Google Nexus 5", + "BigECommerce.totalQuantity": "11", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "BigECommerce.totalQuantity": "4", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Logitech di_Novo Edge Keyboard", + "BigECommerce.totalQuantity": "9", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "BigECommerce.totalQuantity": "3", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "BigECommerce.totalQuantity": "4", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "BigECommerce.totalQuantity": "4", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Canon PC1080F Personal Copier", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "BigECommerce.totalQuantity": "4", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "BigECommerce.totalQuantity": "5", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Okidata C610n Printer", + "BigECommerce.totalQuantity": "2", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "BigECommerce.totalQuantity": "5", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: partitioned pre-agg with multi time dimension 1`] = ` +Array [ + Object { + "BigECommerce.completedDate": "2020-01-02T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-01-01T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-01-24T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-01-23T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-02-17T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-02-16T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-03-18T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-03-17T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-03-27T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-03-26T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-04-11T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-04-10T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-05-14T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-05-13T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-05-15T00:00:00.000Z", + "BigECommerce.count": "2", + "BigECommerce.orderDate": "2020-05-14T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-05-28T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-05-27T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-05-30T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-05-29T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-06-04T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-06-03T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-06-11T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-06-10T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-06-12T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-06-11T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-06-16T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-06-15T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-06-18T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-06-17T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-06-26T00:00:00.000Z", + "BigECommerce.count": "2", + "BigECommerce.orderDate": "2020-06-25T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-09-02T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-09-03T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-09-02T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-09-09T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-09-08T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-09-18T00:00:00.000Z", + "BigECommerce.count": "2", + "BigECommerce.orderDate": "2020-09-17T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-09-24T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-09-23T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-10-13T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-10-12T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-10-20T00:00:00.000Z", + "BigECommerce.count": "2", + "BigECommerce.orderDate": "2020-10-19T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-10-30T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-03T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-02T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-06T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-05T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-07T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-06T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-12T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-11T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-13T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-12T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-17T00:00:00.000Z", + "BigECommerce.count": "2", + "BigECommerce.orderDate": "2020-11-16T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-22T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-21T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-11-29T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-11-28T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-12-02T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-12-03T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-12-02T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-12-05T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-12-04T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-12-15T00:00:00.000Z", + "BigECommerce.count": "2", + "BigECommerce.orderDate": "2020-12-14T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-12-25T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-12-24T00:00:00.000Z", + }, + Object { + "BigECommerce.completedDate": "2020-12-26T00:00:00.000Z", + "BigECommerce.count": "1", + "BigECommerce.orderDate": "2020-12-25T00:00:00.000Z", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 day 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": "1", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountBy2Day": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 month 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "2", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "3", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "3", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "3", + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "6", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "12", + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "7", + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "6", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "10", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "13", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountBy2Month": "16", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 week 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "1", + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "1", + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "1", + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": null, + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "2", + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "3", + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": null, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "3", + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "3", + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "2", + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountBy2Week": "2", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: totalProfitYearAgo 1`] = `Array []`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + limit 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + limit + total + offset 1`] = ` +Array [ + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + limit + total 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + total + offset 1`] = ` +Array [ + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + total 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions 1`] = ` +Array [ + Object { + "Customers.customerId": "AH-10465", + "Customers.customerName": "Customer 1", + }, + Object { + "Customers.customerId": "AJ-10780", + "Customers.customerName": "Customer 2", + }, + Object { + "Customers.customerId": "AS-10225", + "Customers.customerName": "Customer 3", + }, + Object { + "Customers.customerId": "AW-10840", + "Customers.customerName": "Customer 4", + }, + Object { + "Customers.customerId": "BB-11545", + "Customers.customerName": "Customer 5", + }, + Object { + "Customers.customerId": "BF-11020", + "Customers.customerName": "Customer 6", + }, + Object { + "Customers.customerId": "BF-11170", + "Customers.customerName": "Customer 7", + }, + Object { + "Customers.customerId": "BM-11650", + "Customers.customerName": "Customer 8", + }, + Object { + "Customers.customerId": "BS-11380", + "Customers.customerName": "Customer 9", + }, + Object { + "Customers.customerId": "BS-11755", + "Customers.customerName": "Customer 10", + }, + Object { + "Customers.customerId": "CA-12775", + "Customers.customerName": "Customer 11", + }, + Object { + "Customers.customerId": "CC-12475", + "Customers.customerName": "Customer 12", + }, + Object { + "Customers.customerId": "CD-12280", + "Customers.customerName": "Customer 13", + }, + Object { + "Customers.customerId": "CS-12355", + "Customers.customerName": "Customer 14", + }, + Object { + "Customers.customerId": "DB-13405", + "Customers.customerName": "Customer 15", + }, + Object { + "Customers.customerId": "DG-13300", + "Customers.customerName": "Customer 16", + }, + Object { + "Customers.customerId": "DW-13480", + "Customers.customerName": "Customer 17", + }, + Object { + "Customers.customerId": "EM-14140", + "Customers.customerName": "Customer 18", + }, + Object { + "Customers.customerId": "GA-14725", + "Customers.customerName": "Customer 19", + }, + Object { + "Customers.customerId": "GZ-14470", + "Customers.customerName": "Customer 20", + }, + Object { + "Customers.customerId": "HH-15010", + "Customers.customerName": "Customer 21", + }, + Object { + "Customers.customerId": "HK-14890", + "Customers.customerName": "Customer 22", + }, + Object { + "Customers.customerId": "JH-15430", + "Customers.customerName": "Customer 23", + }, + Object { + "Customers.customerId": "JO-15550", + "Customers.customerName": "Customer 24", + }, + Object { + "Customers.customerId": "JS-16030", + "Customers.customerName": "Customer 25", + }, + Object { + "Customers.customerId": "JW-15220", + "Customers.customerName": "Customer 26", + }, + Object { + "Customers.customerId": "KL-16555", + "Customers.customerName": "Customer 27", + }, + Object { + "Customers.customerId": "KN-16705", + "Customers.customerName": "Customer 28", + }, + Object { + "Customers.customerId": "LC-17050", + "Customers.customerName": "Customer 29", + }, + Object { + "Customers.customerId": "LR-16915", + "Customers.customerName": "Customer 30", + }, + Object { + "Customers.customerId": "MC-17605", + "Customers.customerName": "Customer 31", + }, + Object { + "Customers.customerId": "MG-17650", + "Customers.customerName": "Customer 32", + }, + Object { + "Customers.customerId": "ML-17755", + "Customers.customerName": "Customer 33", + }, + Object { + "Customers.customerId": "MM-18280", + "Customers.customerName": "Customer 34", + }, + Object { + "Customers.customerId": "NP-18670", + "Customers.customerName": "Customer 35", + }, + Object { + "Customers.customerId": "PF-19165", + "Customers.customerName": "Customer 36", + }, + Object { + "Customers.customerId": "SB-20185", + "Customers.customerName": "Customer 37", + }, + Object { + "Customers.customerId": "SS-20140", + "Customers.customerName": "Customer 38", + }, + Object { + "Customers.customerId": "TB-21175", + "Customers.customerName": "Customer 39", + }, + Object { + "Customers.customerId": "TS-21205", + "Customers.customerName": "Customer 40", + }, + Object { + "Customers.customerId": "WB-21850", + "Customers.customerName": "Customer 41", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: count by cities + order 1`] = ` +Array [ + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "12", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "5", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "2", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "2", + }, + Object { + "ECommerce.city": "San Francisco", + "ECommerce.count": "2", + }, + Object { + "ECommerce.city": "Arlington", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Auburn", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Bakersfield", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Baltimore", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Bowling", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Dallas", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Decatur", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Glendale", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Houston", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Lafayette", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Lakewood", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Lorain", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Los Angeles", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Louisville", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Marion", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Morristown", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Oakland", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Olympia", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Omaha", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Provo", + "ECommerce.count": "1", + }, + Object { + "ECommerce.city": "Vancouver", + "ECommerce.count": "1", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + limit 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lorain", + "ECommerce.customerId": "GA-14725", + "ECommerce.customerName": "Customer 19", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-107503", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "8.55680", + "ECommerce.quantity": 4, + "ECommerce.rowId": 849, + "ECommerce.sales": "48.89600", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Olympia", + "ECommerce.customerId": "PF-19165", + "ECommerce.customerName": "Customer 36", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-118437", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.profit": "4.06870", + "ECommerce.quantity": 1, + "ECommerce.rowId": 1013, + "ECommerce.sales": "14.03000", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "ML-17755", + "ECommerce.customerName": "Customer 33", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-133648", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "-2.11950", + "ECommerce.quantity": 3, + "ECommerce.rowId": 1995, + "ECommerce.sales": "11.30400", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-138422", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.profit": "5.20260", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2329, + "ECommerce.sales": "14.35200", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "DB-13405", + "ECommerce.customerName": "Customer 15", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-03-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-140949", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.profit": "13.60400", + "ECommerce.quantity": 8, + "ECommerce.rowId": 2455, + "ECommerce.sales": "71.60000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BM-11650", + "ECommerce.customerName": "Customer 8", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-13T00:00:00.000", + "ECommerce.orderId": "CA-2017-149048", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.profit": "81.43200", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2595, + "ECommerce.sales": "180.96000", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "DG-13300", + "ECommerce.customerName": "Customer 16", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-28T00:00:00.000", + "ECommerce.orderId": "CA-2017-123372", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.profit": "494.97250", + "ECommerce.quantity": 11, + "ECommerce.rowId": 2661, + "ECommerce.sales": "1979.89000", + "ECommerce.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + limit + total + offset 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Glendale", + "ECommerce.customerId": "EM-14140", + "ECommerce.customerName": "Customer 18", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-134915", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "9.96520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2952, + "ECommerce.sales": "113.88800", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "10.39040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3059, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Louisville", + "ECommerce.customerId": "DW-13480", + "ECommerce.customerName": "Customer 17", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-27T00:00:00.000", + "ECommerce.orderId": "US-2017-132297", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 3083, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Auburn", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-102554", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3448, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Omaha", + "ECommerce.customerId": "JO-15550", + "ECommerce.customerName": "Customer 24", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-29T00:00:00.000", + "ECommerce.orderId": "CA-2017-144568", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "1.17750", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3717, + "ECommerce.sales": "23.55000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "CC-12475", + "ECommerce.customerName": "Customer 12", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-21T00:00:00.000", + "ECommerce.orderId": "CA-2017-100811", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.profit": "3.92960", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4012, + "ECommerce.sales": "39.29600", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lafayette", + "ECommerce.customerId": "CS-12355", + "ECommerce.customerName": "Customer 14", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-24T00:00:00.000", + "ECommerce.orderId": "CA-2017-124296", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.profit": "60.54880", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4031, + "ECommerce.sales": "232.88000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "AH-10465", + "ECommerce.customerName": "Customer 1", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-115546", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 4161, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + limit + total 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lorain", + "ECommerce.customerId": "GA-14725", + "ECommerce.customerName": "Customer 19", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-107503", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "8.55680", + "ECommerce.quantity": 4, + "ECommerce.rowId": 849, + "ECommerce.sales": "48.89600", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Olympia", + "ECommerce.customerId": "PF-19165", + "ECommerce.customerName": "Customer 36", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-118437", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.profit": "4.06870", + "ECommerce.quantity": 1, + "ECommerce.rowId": 1013, + "ECommerce.sales": "14.03000", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "ML-17755", + "ECommerce.customerName": "Customer 33", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-133648", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "-2.11950", + "ECommerce.quantity": 3, + "ECommerce.rowId": 1995, + "ECommerce.sales": "11.30400", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-138422", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.profit": "5.20260", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2329, + "ECommerce.sales": "14.35200", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "DB-13405", + "ECommerce.customerName": "Customer 15", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-03-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-140949", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.profit": "13.60400", + "ECommerce.quantity": 8, + "ECommerce.rowId": 2455, + "ECommerce.sales": "71.60000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BM-11650", + "ECommerce.customerName": "Customer 8", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-13T00:00:00.000", + "ECommerce.orderId": "CA-2017-149048", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.profit": "81.43200", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2595, + "ECommerce.sales": "180.96000", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "DG-13300", + "ECommerce.customerName": "Customer 16", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-28T00:00:00.000", + "ECommerce.orderId": "CA-2017-123372", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.profit": "494.97250", + "ECommerce.quantity": 11, + "ECommerce.rowId": 2661, + "ECommerce.sales": "1979.89000", + "ECommerce.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + total + offset 1`] = ` +Array [ + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bowling", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "5.39700", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9619, + "ECommerce.sales": "86.35200", + "ECommerce.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lorain", + "ECommerce.customerId": "GA-14725", + "ECommerce.customerName": "Customer 19", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-107503", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "8.55680", + "ECommerce.quantity": 4, + "ECommerce.rowId": 849, + "ECommerce.sales": "48.89600", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Olympia", + "ECommerce.customerId": "PF-19165", + "ECommerce.customerName": "Customer 36", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-118437", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.profit": "4.06870", + "ECommerce.quantity": 1, + "ECommerce.rowId": 1013, + "ECommerce.sales": "14.03000", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "ML-17755", + "ECommerce.customerName": "Customer 33", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-133648", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "-2.11950", + "ECommerce.quantity": 3, + "ECommerce.rowId": 1995, + "ECommerce.sales": "11.30400", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-138422", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.profit": "5.20260", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2329, + "ECommerce.sales": "14.35200", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "DB-13405", + "ECommerce.customerName": "Customer 15", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-03-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-140949", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.profit": "13.60400", + "ECommerce.quantity": 8, + "ECommerce.rowId": 2455, + "ECommerce.sales": "71.60000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BM-11650", + "ECommerce.customerName": "Customer 8", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-13T00:00:00.000", + "ECommerce.orderId": "CA-2017-149048", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.profit": "81.43200", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2595, + "ECommerce.sales": "180.96000", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "DG-13300", + "ECommerce.customerName": "Customer 16", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-28T00:00:00.000", + "ECommerce.orderId": "CA-2017-123372", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.profit": "494.97250", + "ECommerce.quantity": 11, + "ECommerce.rowId": 2661, + "ECommerce.sales": "1979.89000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Glendale", + "ECommerce.customerId": "EM-14140", + "ECommerce.customerName": "Customer 18", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-134915", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "9.96520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2952, + "ECommerce.sales": "113.88800", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "10.39040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3059, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Louisville", + "ECommerce.customerId": "DW-13480", + "ECommerce.customerName": "Customer 17", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-27T00:00:00.000", + "ECommerce.orderId": "US-2017-132297", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 3083, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Auburn", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-102554", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3448, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Omaha", + "ECommerce.customerId": "JO-15550", + "ECommerce.customerName": "Customer 24", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-29T00:00:00.000", + "ECommerce.orderId": "CA-2017-144568", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "1.17750", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3717, + "ECommerce.sales": "23.55000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "CC-12475", + "ECommerce.customerName": "Customer 12", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-21T00:00:00.000", + "ECommerce.orderId": "CA-2017-100811", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.profit": "3.92960", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4012, + "ECommerce.sales": "39.29600", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lafayette", + "ECommerce.customerId": "CS-12355", + "ECommerce.customerName": "Customer 14", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-24T00:00:00.000", + "ECommerce.orderId": "CA-2017-124296", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.profit": "60.54880", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4031, + "ECommerce.sales": "232.88000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "AH-10465", + "ECommerce.customerName": "Customer 1", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-115546", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 4161, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "WB-21850", + "ECommerce.customerName": "Customer 41", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-120327", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "21.58240", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4227, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "TB-21175", + "ECommerce.customerName": "Customer 39", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-143567", + "ECommerce.productName": "Logitech di_Novo Edge Keyboard", + "ECommerce.profit": "517.47930", + "ECommerce.quantity": 9, + "ECommerce.rowId": 4882, + "ECommerce.sales": "2249.91000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "CA-12775", + "ECommerce.customerName": "Customer 11", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145653", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "134.53020", + "ECommerce.quantity": 7, + "ECommerce.rowId": 5220, + "ECommerce.sales": "498.26000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KL-16555", + "ECommerce.customerName": "Customer 27", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-147333", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 5277, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Los Angeles", + "ECommerce.customerId": "SS-20140", + "ECommerce.customerName": "Customer 38", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-03T00:00:00.000", + "ECommerce.orderId": "CA-2017-145772", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6125, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Marion", + "ECommerce.customerId": "MG-17650", + "ECommerce.customerName": "Customer 32", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145660", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "1.73520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6205, + "ECommerce.sales": "7.71200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Oakland", + "ECommerce.customerId": "BB-11545", + "ECommerce.customerName": "Customer 5", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-102379", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "44.97500", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6272, + "ECommerce.sales": "179.90000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Baltimore", + "ECommerce.customerId": "AJ-10780", + "ECommerce.customerName": "Customer 2", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "US-2017-133361", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6459, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Arlington", + "ECommerce.customerId": "BF-11020", + "ECommerce.customerName": "Customer 6", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-08T00:00:00.000", + "ECommerce.orderId": "US-2017-124779", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "15.49800", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6651, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Houston", + "ECommerce.customerId": "HK-14890", + "ECommerce.customerName": "Customer 22", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-03-26T00:00:00.000", + "ECommerce.orderId": "US-2017-141677", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "569.99050", + "ECommerce.quantity": 5, + "ECommerce.rowId": 7174, + "ECommerce.sales": "2399.96000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "LR-16915", + "ECommerce.customerName": "Customer 30", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-04T00:00:00.000", + "ECommerce.orderId": "CA-2017-109183", + "ECommerce.productName": "Okidata C610n Printer", + "ECommerce.profit": "-272.58000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7293, + "ECommerce.sales": "649.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "New York City", + "ECommerce.customerId": "MM-18280", + "ECommerce.customerName": "Customer 34", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-112172", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "0.70650", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7310, + "ECommerce.sales": "14.13000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "BS-11755", + "ECommerce.customerName": "Customer 10", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-04-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-135069", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "6.41760", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7425, + "ECommerce.sales": "36.67200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BF-11170", + "ECommerce.customerName": "Customer 7", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-151799", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "467.99220", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7698, + "ECommerce.sales": "1199.98000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lakewood", + "ECommerce.customerId": "NP-18670", + "ECommerce.customerName": "Customer 35", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-150091", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "129.29400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8425, + "ECommerce.sales": "2154.90000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Dallas", + "ECommerce.customerId": "LC-17050", + "ECommerce.customerName": "Customer 29", + "ECommerce.discount": "0.60000", + "ECommerce.orderDate": "2020-11-06T00:00:00.000", + "ECommerce.orderId": "US-2017-119319", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "-19.86400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8621, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Decatur", + "ECommerce.customerId": "JS-16030", + "ECommerce.customerName": "Customer 25", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-02-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-163265", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "6.19920", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8673, + "ECommerce.sales": "18.36800", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "TS-21205", + "ECommerce.customerName": "Customer 40", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-15T00:00:00.000", + "ECommerce.orderId": "CA-2017-119284", + "ECommerce.productName": "HTC One", + "ECommerce.profit": "26.99730", + "ECommerce.quantity": 3, + "ECommerce.rowId": 8697, + "ECommerce.sales": "239.97600", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Morristown", + "ECommerce.customerId": "GZ-14470", + "ECommerce.customerName": "Customer 20", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-126928", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "225.60000", + "ECommerce.quantity": 4, + "ECommerce.rowId": 8878, + "ECommerce.sales": "480.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "JH-15430", + "ECommerce.customerName": "Customer 23", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-105620", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "-7.20000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8958, + "ECommerce.sales": "120.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "New York City", + "ECommerce.customerId": "CD-12280", + "ECommerce.customerName": "Customer 13", + "ECommerce.discount": "0.10000", + "ECommerce.orderDate": "2020-11-05T00:00:00.000", + "ECommerce.orderId": "CA-2017-102925", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "24.20120", + "ECommerce.quantity": 2, + "ECommerce.rowId": 9473, + "ECommerce.sales": "128.12400", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "New York City", + "ECommerce.customerId": "SB-20185", + "ECommerce.customerName": "Customer 37", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-116127", + "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "ECommerce.profit": "-5.00980", + "ECommerce.quantity": 1, + "ECommerce.rowId": 9584, + "ECommerce.sales": "400.78400", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.40000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.profit": "74.99850", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9618, + "ECommerce.sales": "899.98200", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bowling", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "5.39700", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9619, + "ECommerce.sales": "86.35200", + "ECommerce.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + total 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lorain", + "ECommerce.customerId": "GA-14725", + "ECommerce.customerName": "Customer 19", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-107503", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "8.55680", + "ECommerce.quantity": 4, + "ECommerce.rowId": 849, + "ECommerce.sales": "48.89600", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Olympia", + "ECommerce.customerId": "PF-19165", + "ECommerce.customerName": "Customer 36", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-118437", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.profit": "4.06870", + "ECommerce.quantity": 1, + "ECommerce.rowId": 1013, + "ECommerce.sales": "14.03000", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "ML-17755", + "ECommerce.customerName": "Customer 33", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-133648", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "-2.11950", + "ECommerce.quantity": 3, + "ECommerce.rowId": 1995, + "ECommerce.sales": "11.30400", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-138422", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.profit": "5.20260", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2329, + "ECommerce.sales": "14.35200", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "DB-13405", + "ECommerce.customerName": "Customer 15", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-03-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-140949", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.profit": "13.60400", + "ECommerce.quantity": 8, + "ECommerce.rowId": 2455, + "ECommerce.sales": "71.60000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BM-11650", + "ECommerce.customerName": "Customer 8", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-13T00:00:00.000", + "ECommerce.orderId": "CA-2017-149048", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.profit": "81.43200", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2595, + "ECommerce.sales": "180.96000", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "DG-13300", + "ECommerce.customerName": "Customer 16", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-28T00:00:00.000", + "ECommerce.orderId": "CA-2017-123372", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.profit": "494.97250", + "ECommerce.quantity": 11, + "ECommerce.rowId": 2661, + "ECommerce.sales": "1979.89000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Glendale", + "ECommerce.customerId": "EM-14140", + "ECommerce.customerName": "Customer 18", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-134915", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "9.96520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2952, + "ECommerce.sales": "113.88800", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "10.39040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3059, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Louisville", + "ECommerce.customerId": "DW-13480", + "ECommerce.customerName": "Customer 17", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-27T00:00:00.000", + "ECommerce.orderId": "US-2017-132297", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 3083, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Auburn", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-102554", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3448, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Omaha", + "ECommerce.customerId": "JO-15550", + "ECommerce.customerName": "Customer 24", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-29T00:00:00.000", + "ECommerce.orderId": "CA-2017-144568", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "1.17750", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3717, + "ECommerce.sales": "23.55000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "CC-12475", + "ECommerce.customerName": "Customer 12", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-21T00:00:00.000", + "ECommerce.orderId": "CA-2017-100811", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.profit": "3.92960", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4012, + "ECommerce.sales": "39.29600", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lafayette", + "ECommerce.customerId": "CS-12355", + "ECommerce.customerName": "Customer 14", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-24T00:00:00.000", + "ECommerce.orderId": "CA-2017-124296", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.profit": "60.54880", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4031, + "ECommerce.sales": "232.88000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "AH-10465", + "ECommerce.customerName": "Customer 1", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-115546", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 4161, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "WB-21850", + "ECommerce.customerName": "Customer 41", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-120327", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "21.58240", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4227, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "TB-21175", + "ECommerce.customerName": "Customer 39", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-143567", + "ECommerce.productName": "Logitech di_Novo Edge Keyboard", + "ECommerce.profit": "517.47930", + "ECommerce.quantity": 9, + "ECommerce.rowId": 4882, + "ECommerce.sales": "2249.91000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "CA-12775", + "ECommerce.customerName": "Customer 11", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145653", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "134.53020", + "ECommerce.quantity": 7, + "ECommerce.rowId": 5220, + "ECommerce.sales": "498.26000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KL-16555", + "ECommerce.customerName": "Customer 27", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-147333", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 5277, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Los Angeles", + "ECommerce.customerId": "SS-20140", + "ECommerce.customerName": "Customer 38", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-03T00:00:00.000", + "ECommerce.orderId": "CA-2017-145772", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6125, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Marion", + "ECommerce.customerId": "MG-17650", + "ECommerce.customerName": "Customer 32", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145660", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "1.73520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6205, + "ECommerce.sales": "7.71200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Oakland", + "ECommerce.customerId": "BB-11545", + "ECommerce.customerName": "Customer 5", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-102379", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "44.97500", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6272, + "ECommerce.sales": "179.90000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Baltimore", + "ECommerce.customerId": "AJ-10780", + "ECommerce.customerName": "Customer 2", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "US-2017-133361", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6459, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Arlington", + "ECommerce.customerId": "BF-11020", + "ECommerce.customerName": "Customer 6", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-08T00:00:00.000", + "ECommerce.orderId": "US-2017-124779", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "15.49800", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6651, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Houston", + "ECommerce.customerId": "HK-14890", + "ECommerce.customerName": "Customer 22", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-03-26T00:00:00.000", + "ECommerce.orderId": "US-2017-141677", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "569.99050", + "ECommerce.quantity": 5, + "ECommerce.rowId": 7174, + "ECommerce.sales": "2399.96000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "LR-16915", + "ECommerce.customerName": "Customer 30", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-04T00:00:00.000", + "ECommerce.orderId": "CA-2017-109183", + "ECommerce.productName": "Okidata C610n Printer", + "ECommerce.profit": "-272.58000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7293, + "ECommerce.sales": "649.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "New York City", + "ECommerce.customerId": "MM-18280", + "ECommerce.customerName": "Customer 34", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-112172", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "0.70650", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7310, + "ECommerce.sales": "14.13000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "BS-11755", + "ECommerce.customerName": "Customer 10", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-04-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-135069", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "6.41760", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7425, + "ECommerce.sales": "36.67200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BF-11170", + "ECommerce.customerName": "Customer 7", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-151799", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "467.99220", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7698, + "ECommerce.sales": "1199.98000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lakewood", + "ECommerce.customerId": "NP-18670", + "ECommerce.customerName": "Customer 35", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-150091", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "129.29400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8425, + "ECommerce.sales": "2154.90000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Dallas", + "ECommerce.customerId": "LC-17050", + "ECommerce.customerName": "Customer 29", + "ECommerce.discount": "0.60000", + "ECommerce.orderDate": "2020-11-06T00:00:00.000", + "ECommerce.orderId": "US-2017-119319", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "-19.86400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8621, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Decatur", + "ECommerce.customerId": "JS-16030", + "ECommerce.customerName": "Customer 25", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-02-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-163265", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "6.19920", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8673, + "ECommerce.sales": "18.36800", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "TS-21205", + "ECommerce.customerName": "Customer 40", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-15T00:00:00.000", + "ECommerce.orderId": "CA-2017-119284", + "ECommerce.productName": "HTC One", + "ECommerce.profit": "26.99730", + "ECommerce.quantity": 3, + "ECommerce.rowId": 8697, + "ECommerce.sales": "239.97600", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Morristown", + "ECommerce.customerId": "GZ-14470", + "ECommerce.customerName": "Customer 20", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-126928", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "225.60000", + "ECommerce.quantity": 4, + "ECommerce.rowId": 8878, + "ECommerce.sales": "480.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "JH-15430", + "ECommerce.customerName": "Customer 23", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-105620", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "-7.20000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8958, + "ECommerce.sales": "120.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "New York City", + "ECommerce.customerId": "CD-12280", + "ECommerce.customerName": "Customer 13", + "ECommerce.discount": "0.10000", + "ECommerce.orderDate": "2020-11-05T00:00:00.000", + "ECommerce.orderId": "CA-2017-102925", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "24.20120", + "ECommerce.quantity": 2, + "ECommerce.rowId": 9473, + "ECommerce.sales": "128.12400", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "New York City", + "ECommerce.customerId": "SB-20185", + "ECommerce.customerName": "Customer 37", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-116127", + "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "ECommerce.profit": "-5.00980", + "ECommerce.quantity": 1, + "ECommerce.rowId": 9584, + "ECommerce.sales": "400.78400", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.40000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.profit": "74.99850", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9618, + "ECommerce.sales": "899.98200", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bowling", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "5.39700", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9619, + "ECommerce.sales": "86.35200", + "ECommerce.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions 1`] = ` +Array [ + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "MC-17605", + "ECommerce.customerName": "Customer 31", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-01-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-145142", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.profit": "21.09800", + "ECommerce.quantity": 2, + "ECommerce.rowId": 523, + "ECommerce.sales": "210.98000", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lorain", + "ECommerce.customerId": "GA-14725", + "ECommerce.customerName": "Customer 19", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-107503", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "8.55680", + "ECommerce.quantity": 4, + "ECommerce.rowId": 849, + "ECommerce.sales": "48.89600", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Olympia", + "ECommerce.customerId": "PF-19165", + "ECommerce.customerName": "Customer 36", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-118437", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.profit": "4.06870", + "ECommerce.quantity": 1, + "ECommerce.rowId": 1013, + "ECommerce.sales": "14.03000", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Vancouver", + "ECommerce.customerId": "JW-15220", + "ECommerce.customerName": "Customer 26", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-30T00:00:00.000", + "ECommerce.orderId": "CA-2017-139661", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "3.66320", + "ECommerce.quantity": 2, + "ECommerce.rowId": 1494, + "ECommerce.sales": "9.64000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "ML-17755", + "ECommerce.customerName": "Customer 33", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-133648", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "-2.11950", + "ECommerce.quantity": 3, + "ECommerce.rowId": 1995, + "ECommerce.sales": "11.30400", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-23T00:00:00.000", + "ECommerce.orderId": "CA-2017-138422", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.profit": "5.20260", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2329, + "ECommerce.sales": "14.35200", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "DB-13405", + "ECommerce.customerName": "Customer 15", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-03-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-140949", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.profit": "13.60400", + "ECommerce.quantity": 8, + "ECommerce.rowId": 2455, + "ECommerce.sales": "71.60000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BM-11650", + "ECommerce.customerName": "Customer 8", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-13T00:00:00.000", + "ECommerce.orderId": "CA-2017-149048", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.profit": "81.43200", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2595, + "ECommerce.sales": "180.96000", + "ECommerce.subCategory": "Envelopes", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Provo", + "ECommerce.customerId": "AS-10225", + "ECommerce.customerName": "Customer 3", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-112515", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "77.57640", + "ECommerce.quantity": 3, + "ECommerce.rowId": 2655, + "ECommerce.sales": "1292.94000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "DG-13300", + "ECommerce.customerName": "Customer 16", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-28T00:00:00.000", + "ECommerce.orderId": "CA-2017-123372", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.profit": "494.97250", + "ECommerce.quantity": 11, + "ECommerce.rowId": 2661, + "ECommerce.sales": "1979.89000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Glendale", + "ECommerce.customerId": "EM-14140", + "ECommerce.customerName": "Customer 18", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-134915", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "9.96520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 2952, + "ECommerce.sales": "113.88800", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "10.39040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3059, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "San Francisco", + "ECommerce.customerId": "HH-15010", + "ECommerce.customerName": "Customer 21", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-10-19T00:00:00.000", + "ECommerce.orderId": "CA-2017-131492", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.profit": "-3.35060", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3060, + "ECommerce.sales": "24.36800", + "ECommerce.subCategory": "Tables", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Louisville", + "ECommerce.customerId": "DW-13480", + "ECommerce.customerName": "Customer 17", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-27T00:00:00.000", + "ECommerce.orderId": "US-2017-132297", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 3083, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Auburn", + "ECommerce.customerId": "KN-16705", + "ECommerce.customerName": "Customer 28", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-102554", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 3448, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Omaha", + "ECommerce.customerId": "JO-15550", + "ECommerce.customerName": "Customer 24", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-29T00:00:00.000", + "ECommerce.orderId": "CA-2017-144568", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "1.17750", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3717, + "ECommerce.sales": "23.55000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bakersfield", + "ECommerce.customerId": "AW-10840", + "ECommerce.customerName": "Customer 4", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-123001", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "2.72600", + "ECommerce.quantity": 5, + "ECommerce.rowId": 3934, + "ECommerce.sales": "9.40000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "CC-12475", + "ECommerce.customerName": "Customer 12", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-21T00:00:00.000", + "ECommerce.orderId": "CA-2017-100811", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.profit": "3.92960", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4012, + "ECommerce.sales": "39.29600", + "ECommerce.subCategory": "Storage", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lafayette", + "ECommerce.customerId": "CS-12355", + "ECommerce.customerName": "Customer 14", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-24T00:00:00.000", + "ECommerce.orderId": "CA-2017-124296", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.profit": "60.54880", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4031, + "ECommerce.sales": "232.88000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "New York City", + "ECommerce.customerId": "AH-10465", + "ECommerce.customerName": "Customer 1", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-115546", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.profit": "134.99250", + "ECommerce.quantity": 3, + "ECommerce.rowId": 4161, + "ECommerce.sales": "539.97000", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "WB-21850", + "ECommerce.customerName": "Customer 41", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-11T00:00:00.000", + "ECommerce.orderId": "CA-2017-120327", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "21.58240", + "ECommerce.quantity": 4, + "ECommerce.rowId": 4227, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "TB-21175", + "ECommerce.customerName": "Customer 39", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-11-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-143567", + "ECommerce.productName": "Logitech di_Novo Edge Keyboard", + "ECommerce.profit": "517.47930", + "ECommerce.quantity": 9, + "ECommerce.rowId": 4882, + "ECommerce.sales": "2249.91000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Detroit", + "ECommerce.customerId": "CA-12775", + "ECommerce.customerName": "Customer 11", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145653", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "134.53020", + "ECommerce.quantity": 7, + "ECommerce.rowId": 5220, + "ECommerce.sales": "498.26000", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "KL-16555", + "ECommerce.customerName": "Customer 27", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-147333", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 5277, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Los Angeles", + "ECommerce.customerId": "SS-20140", + "ECommerce.customerName": "Customer 38", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-03T00:00:00.000", + "ECommerce.orderId": "CA-2017-145772", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.profit": "8.50250", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6125, + "ECommerce.sales": "44.75000", + "ECommerce.subCategory": "Accessories", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Marion", + "ECommerce.customerId": "MG-17650", + "ECommerce.customerName": "Customer 32", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderId": "CA-2017-145660", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.profit": "1.73520", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6205, + "ECommerce.sales": "7.71200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Oakland", + "ECommerce.customerId": "BB-11545", + "ECommerce.customerName": "Customer 5", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-02T00:00:00.000", + "ECommerce.orderId": "CA-2017-102379", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "44.97500", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6272, + "ECommerce.sales": "179.90000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Baltimore", + "ECommerce.customerId": "AJ-10780", + "ECommerce.customerName": "Customer 2", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-05-14T00:00:00.000", + "ECommerce.orderId": "US-2017-133361", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.profit": "1.09040", + "ECommerce.quantity": 2, + "ECommerce.rowId": 6459, + "ECommerce.sales": "3.76000", + "ECommerce.subCategory": "Art", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Arlington", + "ECommerce.customerId": "BF-11020", + "ECommerce.customerName": "Customer 6", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-09-08T00:00:00.000", + "ECommerce.orderId": "US-2017-124779", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "15.49800", + "ECommerce.quantity": 5, + "ECommerce.rowId": 6651, + "ECommerce.sales": "45.92000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Houston", + "ECommerce.customerId": "HK-14890", + "ECommerce.customerName": "Customer 22", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-03-26T00:00:00.000", + "ECommerce.orderId": "US-2017-141677", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "569.99050", + "ECommerce.quantity": 5, + "ECommerce.rowId": 7174, + "ECommerce.sales": "2399.96000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "LR-16915", + "ECommerce.customerName": "Customer 30", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-04T00:00:00.000", + "ECommerce.orderId": "CA-2017-109183", + "ECommerce.productName": "Okidata C610n Printer", + "ECommerce.profit": "-272.58000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7293, + "ECommerce.sales": "649.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "New York City", + "ECommerce.customerId": "MM-18280", + "ECommerce.customerName": "Customer 34", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-06-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-112172", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.profit": "0.70650", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7310, + "ECommerce.sales": "14.13000", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Philadelphia", + "ECommerce.customerId": "BS-11755", + "ECommerce.customerName": "Customer 10", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-04-10T00:00:00.000", + "ECommerce.orderId": "CA-2017-135069", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "6.41760", + "ECommerce.quantity": 3, + "ECommerce.rowId": 7425, + "ECommerce.sales": "36.67200", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BF-11170", + "ECommerce.customerName": "Customer 7", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-12-14T00:00:00.000", + "ECommerce.orderId": "CA-2017-151799", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.profit": "467.99220", + "ECommerce.quantity": 2, + "ECommerce.rowId": 7698, + "ECommerce.sales": "1199.98000", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Lakewood", + "ECommerce.customerId": "NP-18670", + "ECommerce.customerName": "Customer 35", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-10-12T00:00:00.000", + "ECommerce.orderId": "CA-2017-150091", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.profit": "129.29400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8425, + "ECommerce.sales": "2154.90000", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "Dallas", + "ECommerce.customerId": "LC-17050", + "ECommerce.customerName": "Customer 29", + "ECommerce.discount": "0.60000", + "ECommerce.orderDate": "2020-11-06T00:00:00.000", + "ECommerce.orderId": "US-2017-119319", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.profit": "-19.86400", + "ECommerce.quantity": 5, + "ECommerce.rowId": 8621, + "ECommerce.sales": "30.56000", + "ECommerce.subCategory": "Furnishings", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Decatur", + "ECommerce.customerId": "JS-16030", + "ECommerce.customerName": "Customer 25", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-02-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-163265", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.profit": "6.19920", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8673, + "ECommerce.sales": "18.36800", + "ECommerce.subCategory": "Fasteners", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "TS-21205", + "ECommerce.customerName": "Customer 40", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-15T00:00:00.000", + "ECommerce.orderId": "CA-2017-119284", + "ECommerce.productName": "HTC One", + "ECommerce.profit": "26.99730", + "ECommerce.quantity": 3, + "ECommerce.rowId": 8697, + "ECommerce.sales": "239.97600", + "ECommerce.subCategory": "Phones", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Morristown", + "ECommerce.customerId": "GZ-14470", + "ECommerce.customerName": "Customer 20", + "ECommerce.discount": "0.00000", + "ECommerce.orderDate": "2020-09-17T00:00:00.000", + "ECommerce.orderId": "CA-2017-126928", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "225.60000", + "ECommerce.quantity": 4, + "ECommerce.rowId": 8878, + "ECommerce.sales": "480.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "JH-15430", + "ECommerce.customerName": "Customer 23", + "ECommerce.discount": "0.50000", + "ECommerce.orderDate": "2020-12-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-105620", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.profit": "-7.20000", + "ECommerce.quantity": 2, + "ECommerce.rowId": 8958, + "ECommerce.sales": "120.00000", + "ECommerce.subCategory": "Machines", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "New York City", + "ECommerce.customerId": "CD-12280", + "ECommerce.customerName": "Customer 13", + "ECommerce.discount": "0.10000", + "ECommerce.orderDate": "2020-11-05T00:00:00.000", + "ECommerce.orderId": "CA-2017-102925", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.profit": "24.20120", + "ECommerce.quantity": 2, + "ECommerce.rowId": 9473, + "ECommerce.sales": "128.12400", + "ECommerce.subCategory": "Chairs", + }, + Object { + "ECommerce.category": "Furniture", + "ECommerce.city": "New York City", + "ECommerce.customerId": "SB-20185", + "ECommerce.customerName": "Customer 37", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-06-25T00:00:00.000", + "ECommerce.orderId": "CA-2017-116127", + "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "ECommerce.profit": "-5.00980", + "ECommerce.quantity": 1, + "ECommerce.rowId": 9584, + "ECommerce.sales": "400.78400", + "ECommerce.subCategory": "Bookcases", + }, + Object { + "ECommerce.category": "Technology", + "ECommerce.city": "Columbus", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.40000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.profit": "74.99850", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9618, + "ECommerce.sales": "899.98200", + "ECommerce.subCategory": "Copiers", + }, + Object { + "ECommerce.category": "Office Supplies", + "ECommerce.city": "Bowling", + "ECommerce.customerId": "BS-11380", + "ECommerce.customerName": "Customer 9", + "ECommerce.discount": "0.20000", + "ECommerce.orderDate": "2020-11-16T00:00:00.000", + "ECommerce.orderId": "CA-2017-160633", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.profit": "5.39700", + "ECommerce.quantity": 3, + "ECommerce.rowId": 9619, + "ECommerce.sales": "86.35200", + "ECommerce.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: partitioned pre-agg 1`] = ` +Array [ + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-02-01T00:00:00.000Z", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2020-04-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "ECommerce.totalQuantity": "1", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.productName": "HTC One", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.totalQuantity": "6", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.totalQuantity": "1", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.totalQuantity": "7", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Logitech di_Novo Edge Keyboard", + "ECommerce.totalQuantity": "9", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Okidata C610n Printer", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.totalQuantity": "5", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: partitioned pre-agg higher granularity 1`] = ` +Array [ + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.totalQuantity": "7", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "ECommerce.totalQuantity": "1", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "HTC One", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.totalQuantity": "6", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "14", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Logitech di_Novo Edge Keyboard", + "ECommerce.totalQuantity": "9", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.totalQuantity": "9", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Okidata C610n Printer", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.totalQuantity": "1", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.totalQuantity": "3", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery 1`] = ` +Array [ + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.totalProfit": "29.6548", + "ECommerce.totalSales": "259.876", + }, + Object { + "ECommerce.orderDate": "2020-02-01T00:00:00.000Z", + "ECommerce.totalProfit": "6.1992", + "ECommerce.totalSales": "18.368", + }, + Object { + "ECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "ECommerce.totalProfit": "583.5945", + "ECommerce.totalSales": "2471.56", + }, + Object { + "ECommerce.orderDate": "2020-04-01T00:00:00.000Z", + "ECommerce.totalProfit": "6.4176", + "ECommerce.totalSales": "36.672", + }, + Object { + "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.totalProfit": "353.6849", + "ECommerce.totalSales": "1288.21", + }, + Object { + "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.totalProfit": "34.2361", + "ECommerce.totalSales": "728.734", + }, + Object { + "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.totalProfit": "461.1332", + "ECommerce.totalSales": "2340.872", + }, + Object { + "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.totalProfit": "139.997", + "ECommerce.totalSales": "2219.468", + }, + Object { + "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.totalProfit": "1132.6617", + "ECommerce.totalSales": "5573.922", + }, + Object { + "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.totalProfit": "303.9737", + "ECommerce.totalSales": "2434.222", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + limit + total 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "DMI Eclipse Executive Suite Bookcases", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Harbour Creations 67200 Series Stacking Chairs", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Linden 10 Round Wall Clock, Black", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Magna Visual Magnetic Picture Hangers", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "OIC #2 Pencils, Medium Soft", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "Products.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + limit 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "DMI Eclipse Executive Suite Bookcases", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Harbour Creations 67200 Series Stacking Chairs", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Linden 10 Round Wall Clock, Black", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Magna Visual Magnetic Picture Hangers", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "OIC #2 Pencils, Medium Soft", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "Products.subCategory": "Art", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + total 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "DMI Eclipse Executive Suite Bookcases", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Harbour Creations 67200 Series Stacking Chairs", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Linden 10 Round Wall Clock, Black", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Magna Visual Magnetic Picture Hangers", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "OIC #2 Pencils, Medium Soft", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Wausau Papers Astrobrights Colored Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "Products.subCategory": "Fasteners", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "Products.subCategory": "Fasteners", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Project Tote Personal File", + "Products.subCategory": "Storage", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Recycled Eldon Regeneration Jumbo File", + "Products.subCategory": "Storage", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Logitech di_Novo Edge Keyboard", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Canon PC1080F Personal Copier", + "Products.subCategory": "Copiers", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "Products.subCategory": "Copiers", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Okidata C610n Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 5", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 6", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 7", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "HTC One", + "Products.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order 1`] = ` +Array [ + Object { + "Products.category": "Furniture", + "Products.productName": "DMI Eclipse Executive Suite Bookcases", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "Products.subCategory": "Bookcases", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Harbour Creations 67200 Series Stacking Chairs", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "Products.subCategory": "Chairs", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Linden 10 Round Wall Clock, Black", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Magna Visual Magnetic Picture Hangers", + "Products.subCategory": "Furnishings", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Anderson Hickey Conga Table Tops & Accessories", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Furniture", + "Products.productName": "Balt Solid Wood Rectangular Table", + "Products.subCategory": "Tables", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "OIC #2 Pencils, Medium Soft", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "Products.subCategory": "Art", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Wausau Papers Astrobrights Colored Envelopes", + "Products.subCategory": "Envelopes", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "Products.subCategory": "Fasteners", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "Products.subCategory": "Fasteners", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Project Tote Personal File", + "Products.subCategory": "Storage", + }, + Object { + "Products.category": "Office Supplies", + "Products.productName": "Recycled Eldon Regeneration Jumbo File", + "Products.subCategory": "Storage", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Logitech di_Novo Edge Keyboard", + "Products.subCategory": "Accessories", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Canon PC1080F Personal Copier", + "Products.subCategory": "Copiers", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "Products.subCategory": "Copiers", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Okidata C610n Printer", + "Products.subCategory": "Machines", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 5", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 6", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "Google Nexus 7", + "Products.subCategory": "Phones", + }, + Object { + "Products.category": "Technology", + "Products.productName": "HTC One", + "Products.subCategory": "Phones", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + dimension 1`] = ` +Array [ + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Balt Solid Wood Rectangular Table", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", + "ECommerce.totalQuantity": "1", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 6", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 7", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "HTC One", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Project Tote Personal File", + "ECommerce.totalQuantity": "1", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Canon PC1080F Personal Copier", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Google Nexus 5", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", + "ECommerce.totalQuantity": "11", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", + "ECommerce.totalQuantity": "3", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", + "ECommerce.totalQuantity": "6", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Linden 10 Round Wall Clock, Black", + "ECommerce.totalQuantity": "7", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Logitech di_Novo Edge Keyboard", + "ECommerce.totalQuantity": "9", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "OIC #2 Pencils, Medium Soft", + "ECommerce.totalQuantity": "5", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Okidata C610n Printer", + "ECommerce.totalQuantity": "2", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", + "ECommerce.totalQuantity": "8", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", + "ECommerce.totalQuantity": "4", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", + "ECommerce.totalQuantity": "9", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", + "ECommerce.totalQuantity": "3", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + no dimension 1`] = ` +Array [ + Object { + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-01-01T00:00:00.000", + "ECommerce.totalQuantity": "6", + }, + Object { + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", + "ECommerce.totalQuantity": "51", + }, + Object { + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", + "ECommerce.totalQuantity": "103", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year + dimension 1`] = ` +Array [ + Object { + "ECommerce.city": "Lorain", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2019-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Auburn", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Baltimore", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "3", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Decatur", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Houston", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Los Angeles", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Louisville", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "4", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Olympia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Omaha", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Arlington", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Bakersfield", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Bowling", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "9", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Dallas", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Glendale", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Lafayette", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Lakewood", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Marion", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Morristown", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Oakland", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Provo", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "San Francisco", + "ECommerce.count": "2", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Vancouver", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year + no dimension 1`] = ` +Array [ + Object { + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2019-07-01T00:00:00.000", + }, + Object { + "ECommerce.count": "17", + "ECommerce.customOrderDateNoPreAgg": "2020-01-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-01-01T00:00:00.000", + }, + Object { + "ECommerce.count": "26", + "ECommerce.customOrderDateNoPreAgg": "2020-07-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year": "2020-07-01T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year_by_1st_april + dimension 1`] = ` +Array [ + Object { + "ECommerce.city": "Decatur", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Houston", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Lorain", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Arlington", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Auburn", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Bakersfield", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Baltimore", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "4", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Lakewood", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Los Angeles", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Louisville", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Morristown", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "3", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Olympia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Omaha", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Provo", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Bowling", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "8", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Dallas", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Glendale", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Lafayette", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Marion", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Oakland", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "San Francisco", + "ECommerce.count": "2", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, + Object { + "ECommerce.city": "Vancouver", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year_by_1st_april + no dimension 1`] = ` +Array [ + Object { + "ECommerce.count": "6", + "ECommerce.customOrderDateNoPreAgg": "2019-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2019-10-01T00:00:00.000", + }, + Object { + "ECommerce.count": "19", + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-04-01T00:00:00.000", + }, + Object { + "ECommerce.count": "19", + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.half_year_by_1st_april": "2020-10-01T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by three_months_by_march + dimension 1`] = ` +Array [ + Object { + "ECommerce.city": "Decatur", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-12-11T21:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2019-12-11T21:00:00.000", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-12-11T21:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2019-12-11T21:00:00.000", + }, + Object { + "ECommerce.city": "Lorain", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2019-12-11T21:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2019-12-11T21:00:00.000", + }, + Object { + "ECommerce.city": "Auburn", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Baltimore", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "2", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Houston", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Los Angeles", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Louisville", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "3", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Omaha", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.city": "Arlington", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Bakersfield", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Detroit", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Morristown", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Olympia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Provo", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.city": "Bowling", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "8", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Dallas", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Glendale", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Lakewood", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Marion", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "New York City", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Oakland", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Philadelphia", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "San Francisco", + "ECommerce.count": "2", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Vancouver", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.city": "Columbus", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-12-24T09:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-12-24T09:00:00.000", + }, + Object { + "ECommerce.city": "Lafayette", + "ECommerce.count": "1", + "ECommerce.customOrderDateNoPreAgg": "2020-12-24T09:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-12-24T09:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by three_months_by_march + no dimension 1`] = ` +Array [ + Object { + "ECommerce.count": "3", + "ECommerce.customOrderDateNoPreAgg": "2019-12-11T21:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2019-12-11T21:00:00.000", + }, + Object { + "ECommerce.count": "12", + "ECommerce.customOrderDateNoPreAgg": "2020-03-15T00:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-03-15T00:00:00.000", + }, + Object { + "ECommerce.count": "8", + "ECommerce.customOrderDateNoPreAgg": "2020-06-18T03:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-06-18T03:00:00.000", + }, + Object { + "ECommerce.count": "19", + "ECommerce.customOrderDateNoPreAgg": "2020-09-21T06:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-09-21T06:00:00.000", + }, + Object { + "ECommerce.count": "2", + "ECommerce.customOrderDateNoPreAgg": "2020-12-24T09:00:00.000", + "ECommerce.customOrderDateNoPreAgg.three_months_by_march": "2020-12-24T09:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading 1`] = ` +Array [ + Object { + "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2019-12-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "8", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-02-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-02-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "12", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-04-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "6", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-06-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-06-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "19", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-08-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-08-01T10:00:00.000", + "ECommerce.rollingCountByLeading": "16", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-10-01T10:00:00.000", + "ECommerce.rollingCountByLeading": null, + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-12-01T10:00:00.000", + "ECommerce.rollingCountByLeading": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing 1`] = ` +Array [ + Object { + "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2019-12-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": "3", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-02-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-02-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": "3", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-04-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": "12", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-06-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-06-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": null, + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-08-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-08-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": "10", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-10-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": "16", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-12-01T10:00:00.000", + "ECommerce.rollingCountByTrailing": null, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByUnbounded 1`] = ` +Array [ + Object { + "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2019-12-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "3", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-02-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-02-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "6", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-04-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-04-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "18", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-06-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-06-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "18", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-08-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-08-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "28", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-10-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-10-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "44", + }, + Object { + "ECommerce.customOrderDateNoPreAgg": "2020-12-01T10:00:00.000", + "ECommerce.customOrderDateNoPreAgg.two_mo_by_feb": "2020-12-01T10:00:00.000", + "ECommerce.rollingCountByUnbounded": "44", + }, +] +`; diff --git a/packages/cubejs-testing-drivers/test/postgres-native-cubestore-response-full.test.ts b/packages/cubejs-testing-drivers/test/postgres-native-cubestore-response-full.test.ts new file mode 100644 index 0000000000000..6c395e39b2b90 --- /dev/null +++ b/packages/cubejs-testing-drivers/test/postgres-native-cubestore-response-full.test.ts @@ -0,0 +1,5 @@ +import { testQueries } from '../src/tests/testQueries'; + +testQueries('postgres', { + extendedEnv: 'native-cubestore-response' +}); From 6679d0a58ac4a6087d5402c1e1b6a75c2a258593 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 12 Dec 2024 18:35:31 +0200 Subject: [PATCH 050/128] =?UTF-8?q?Build=20native=20(without=20Python)=20i?= =?UTF-8?q?n=C2=A0drivers=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/drivers-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/drivers-tests.yml b/.github/workflows/drivers-tests.yml index 122f05de50668..80071593a177b 100644 --- a/.github/workflows/drivers-tests.yml +++ b/.github/workflows/drivers-tests.yml @@ -165,7 +165,7 @@ jobs: uses: actions/download-artifact@v4 with: name: backend-native - path: packages/cubejs-backend-native/ + path: packages/cubejs-backend-native - name: Build and push uses: docker/build-push-action@v6 with: From 01cf73b84d83404792f9b6139d52bbb7cadf61d3 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 12 Dec 2024 21:23:48 +0200 Subject: [PATCH 051/128] =?UTF-8?q?workaround=20for=C2=A0native=20build=20?= =?UTF-8?q?in=C2=A0testings-drivers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/drivers-tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/drivers-tests.yml b/.github/workflows/drivers-tests.yml index 80071593a177b..72c07397cf35d 100644 --- a/.github/workflows/drivers-tests.yml +++ b/.github/workflows/drivers-tests.yml @@ -166,6 +166,11 @@ jobs: with: name: 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: From 322c19863bcece9cfdc87abe395bc1b9e2c80365 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 13 Dec 2024 00:39:25 +0200 Subject: [PATCH 052/128] =?UTF-8?q?small=20improvements=20in=C2=A0CubeStor?= =?UTF-8?q?eResultWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/CubeStoreResultWrapper.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts index 6693fb06c156b..a85215fb57ac6 100644 --- a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts +++ b/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts @@ -16,22 +16,19 @@ export class CubeStoreResultWrapper { return array[Number(prop)]; } - // intercept array methods + // intercept isNative + if (prop === 'isNative') { + return true; + } + + // intercept array props and methods if (typeof prop === 'string' && prop in Array.prototype) { const arrayMethod = (Array.prototype as any)[prop]; if (typeof arrayMethod === 'function') { return (...args: any[]) => this.invokeArrayMethod(prop, ...args); } - } - // intercept isNative - if (prop === 'isNative') { - return true; - } - - // intercept array length - if (prop === 'length') { - return this.getArray().length; + return (this.getArray() as any)[prop]; } // intercept JSON.stringify or toJSON() From f5ef649f453c930aced65faf7f44f56aa030b256 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 13 Dec 2024 18:48:03 +0200 Subject: [PATCH 053/128] make parse_cubestore_ws_result_message async --- packages/cubejs-backend-native/js/index.ts | 4 ++-- .../cubejs-backend-native/src/node_export.rs | 19 +++++++++++++------ .../src/WebSocketConnection.ts | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 4465cc23bb3e0..0d9de794608fb 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -370,10 +370,10 @@ export const buildSqlAndParams = (cubeEvaluator: any): String => { export type ResultRow = Record; -export const parseCubestoreResultMessage = (message: ArrayBuffer): CubeStoreResultWrapper => { +export const parseCubestoreResultMessage = async (message: ArrayBuffer): Promise => { const native = loadNative(); - const msg = native.parseCubestoreResultMessage(message); + const msg = await native.parseCubestoreResultMessage(message); return new CubeStoreResultWrapper(msg); }; diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 0cee1c3d65c47..f106a4531aed4 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -515,13 +515,20 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { //============ sql orchestrator =================== -fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult> { +fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { let msg = cx.argument::(0)?; - let msg_data = msg.as_slice(&cx); - match CubeStoreResult::new(msg_data) { - Ok(result) => Ok(cx.boxed(result)), - Err(err) => cx.throw_error(err.to_string()), - } + let msg_data = msg.as_slice(&cx).to_vec(); + + let promise = cx + .task(move || CubeStoreResult::new(&msg_data)) + .promise(move |mut cx, res| { + match res { + Ok(result) => Ok(cx.boxed(result)), + Err(err) => cx.throw_error(err.to_string()), + } + }); + + Ok(promise) } fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { diff --git a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts index 40d37d516ad98..94170ed8ffd36 100644 --- a/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts +++ b/packages/cubejs-cubestore-driver/src/WebSocketConnection.ts @@ -109,7 +109,7 @@ export class WebSocketConnection { this.webSocket = undefined; } }); - webSocket.on('message', (msg) => { + webSocket.on('message', async (msg) => { const buf = new flatbuffers.ByteBuffer(msg); const httpMessage = HttpMessage.getRootAsHttpMessage(buf); const resolvers = webSocket.sentMessages[httpMessage.messageId()]; @@ -120,7 +120,7 @@ export class WebSocketConnection { if (getEnv('nativeOrchestrator') && msg.length > 1000) { try { - const nativeResMsg = parseCubestoreResultMessage(msg); + const nativeResMsg = await parseCubestoreResultMessage(msg); resolvers.resolve(nativeResMsg); } catch (e) { resolvers.reject(e); From fb3b3072336a96631ccaa3afc78a857595cb06ad Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 13 Dec 2024 20:57:29 +0200 Subject: [PATCH 054/128] make all native cubestore_result_transform functions async --- packages/cubejs-api-gateway/src/gateway.ts | 33 +- .../cubejs-api-gateway/src/types/responses.ts | 2 +- packages/cubejs-backend-native/Cargo.lock | 1 + packages/cubejs-backend-native/Cargo.toml | 1 + packages/cubejs-backend-native/js/index.ts | 8 +- .../cubejs-backend-native/src/node_export.rs | 350 +++++++++++------- .../src/cubestore_result_transform.rs | 5 +- 7 files changed, 233 insertions(+), 167 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index a6442c8c506ed..756ff5400a704 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1612,7 +1612,7 @@ class ApiGateway { * result object. * @internal */ - private getResultInternal( + private async getResultInternal( context: RequestContext, queryType: QueryType, normalizedQuery: NormalizedQuery, @@ -1649,13 +1649,14 @@ class ApiGateway { // We postpone data transformation until the last minute // in case when all responses are native - we process them in native part const dataCb: TransformDataResponseCb = response.data.isNative ? - () => JSON.parse( - transformDataNative( + async () => { + const jsonData = await transformDataNative( JSON.stringify(transformDataParams), response.data.getNativeRef() - ).result - ) as TransformDataResponse + ); + return JSON.parse(jsonData.result) as TransformDataResponse; + } : - () => transformData({ + async () => transformData({ ...transformDataParams, data: response.data, }); @@ -1866,20 +1867,20 @@ class ApiGateway { }; const resultDataJson = JSON.stringify(responseDataObj); - res(getFinalCubestoreResultMulti(transformDataJson, rawDataRef, resultDataJson)); + res(await getFinalCubestoreResultMulti(transformDataJson, rawDataRef, resultDataJson)); } else { // if we have mixed query results (there are js and native) // we prepare results separately: on js and native sides // and serve final response from JS side res({ queryType, - results: results.map(r => { - const data = r.dataCb(); + results: await Promise.all(results.map(async (r) => { + const data = await r.dataCb(); return { ...cleanupResult(r), data, }; - }), + })), pivotQuery: getPivotQuery(queryType, normalizedQueries), slowQuery }); @@ -1890,9 +1891,9 @@ class ApiGateway { const transformDataJson = JSON.stringify(r.transformDataParams); const rawDataRef = r.rawData.getNativeRef(); const resultDataJson = JSON.stringify(cleanupResult(r)); - res(getFinalCubestoreResult(transformDataJson, rawDataRef, resultDataJson)); + res(await getFinalCubestoreResult(transformDataJson, rawDataRef, resultDataJson)); } else { - const data = results[0].dataCb(); + const data = await results[0].dataCb(); res({ ...cleanupResult(results[0]), data, @@ -2045,19 +2046,19 @@ class ApiGateway { [[], [], []] ); - res(getFinalCubestoreResultArray(transformDataJson, rawDataRef, resultDataJson)); + res(await getFinalCubestoreResultArray(transformDataJson, rawDataRef, resultDataJson)); } else { // if we have mixed query results (there are js and native) // we prepare results separately: on js and native sides // and serve final response from JS side res({ - results: results.map(r => { - const data = r.dataCb(); + results: await Promise.all(results.map(async (r) => { + const data = await r.dataCb(); return { ...cleanupResult(r), data, }; - }), + })), }); } } else { diff --git a/packages/cubejs-api-gateway/src/types/responses.ts b/packages/cubejs-api-gateway/src/types/responses.ts index bdbc1ee63e4a4..aa09b3b2fcfba 100644 --- a/packages/cubejs-api-gateway/src/types/responses.ts +++ b/packages/cubejs-api-gateway/src/types/responses.ts @@ -34,4 +34,4 @@ export type TransformDataRequest = { resType?: ResultType }; -export type TransformDataResponseCb = () => TransformDataResponse; +export type TransformDataResponseCb = () => Promise; diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index 3b58feda8b8e1..65113ac0e7061 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -733,6 +733,7 @@ dependencies = [ name = "cubejs-native" version = "0.28.0" dependencies = [ + "anyhow", "async-channel", "async-trait", "axum", diff --git a/packages/cubejs-backend-native/Cargo.toml b/packages/cubejs-backend-native/Cargo.toml index debb2bea8dc84..80e12da1f88ae 100644 --- a/packages/cubejs-backend-native/Cargo.toml +++ b/packages/cubejs-backend-native/Cargo.toml @@ -19,6 +19,7 @@ crate-type = ["cdylib", "lib"] cubesqlplanner = { path = "../../rust/cubesqlplanner/cubesqlplanner" } cubeorchestrator = { path = "../../rust/cubeorchestrator" } cubenativeutils = { path = "../../rust/cubenativeutils" } +anyhow = "1.0" async-channel = { version = "2" } async-trait = "0.1.36" convert_case = "0.6.0" diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 0d9de794608fb..63621491fe77c 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -383,25 +383,25 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; -export const transformData = (transformDataJson: string, rows: any): TransformDataResponseNative => { +export const transformData = (transformDataJson: string, rows: any): Promise => { const native = loadNative(); return native.transformQueryData(transformDataJson, rows); }; -export const getFinalCubestoreResult = (transformDataJson: string, rows: any, resultData: string): ArrayBuffer => { +export const getFinalCubestoreResult = (transformDataJson: string, rows: any, resultData: string): Promise => { const native = loadNative(); return native.getFinalCubestoreResult(transformDataJson, rows, resultData); }; -export const getFinalCubestoreResultArray = (transformDataJson: string[], rows: any[], resultDataJson: string[]): ArrayBuffer => { +export const getFinalCubestoreResultArray = (transformDataJson: string[], rows: any[], resultDataJson: string[]): Promise => { const native = loadNative(); return native.getFinalCubestoreResultArray(transformDataJson, rows, resultDataJson); }; -export const getFinalCubestoreResultMulti = (transformDataJson: string[], rows: any[], responseData: string): ArrayBuffer => { +export const getFinalCubestoreResultMulti = (transformDataJson: string[], rows: any[], responseData: string): Promise => { const native = loadNative(); return native.getFinalCubestoreResultMulti(transformDataJson, rows, responseData); diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index f106a4531aed4..3c86121c3c2c7 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -13,7 +13,6 @@ use std::net::SocketAddr; use std::rc::Rc; use std::str::FromStr; use std::sync::Arc; - use crate::auth::{NativeAuthContext, NodeBridgeAuthService}; use crate::channel::call_js_fn; use crate::config::{NodeConfiguration, NodeConfigurationFactoryOptions, NodeCubeServices}; @@ -523,7 +522,7 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult Ok(cx.boxed(result)), + Ok(result) => Ok(cx.boxed(Arc::new(result))), Err(err) => cx.throw_error(err.to_string()), } }); @@ -532,7 +531,7 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult JsResult { - let result = cx.argument::>(0)?; + let result = cx.argument::>>(0)?; let js_array = cx.execute_scoped(|mut cx| { let js_array = JsArray::new(&mut cx, result.rows.len()); @@ -557,207 +556,270 @@ fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(js_array.upcast()) } -fn transform_query_data(mut cx: FunctionContext) -> JsResult { +fn transform_query_data(mut cx: FunctionContext) -> JsResult { let json_str = cx.argument::(0)?.value(&mut cx); - let request_data = match serde_json::from_str::(&json_str) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - let cube_store_result = cx.argument::>(1)?; - - let alias_to_member_name_map = &request_data.alias_to_member_name_map; - let annotation = &request_data.annotation; - let query = &request_data.query; - let query_type = &request_data.query_type.unwrap_or_default(); - let res_type = &request_data.res_type; - - let transformed = match transform_data( - alias_to_member_name_map, - annotation, - &cube_store_result, - query, - query_type, - res_type.clone(), - ) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; + let cube_store_result = cx.argument::>>(1)?; + let cube_store_result = Arc::clone(&cube_store_result); - let json_data = match serde_json::to_string(&transformed) { - Ok(data) => data, - Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), - }; + let promise = cx + .task(move || { + let request_data = match serde_json::from_str::(&json_str) { + Ok(data) => data, + Err(err) => return Err(anyhow::Error::from(err)), + }; - let js_string = cx.string(json_data); + let alias_to_member_name_map = &request_data.alias_to_member_name_map; + let annotation = &request_data.annotation; + let query = &request_data.query; + let query_type = &request_data.query_type.unwrap_or_default(); + let res_type = &request_data.res_type; + + let transformed = transform_data( + alias_to_member_name_map, + annotation, + &cube_store_result, + query, + query_type, + res_type.clone(), + )?; + + match serde_json::to_string(&transformed) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |mut cx, json_data| { + match json_data { + Ok(json_data) => { + let js_string = cx.string(json_data); - let js_result = cx.empty_object(); - js_result.set(&mut cx, "result", js_string)?; + let js_result = cx.empty_object(); + js_result.set(&mut cx, "result", js_string)?; - Ok(js_result) + Ok(js_result) + } + Err(err) => cx.throw_error(err.to_string()), + } + }); + + Ok(promise) } -fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { +fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { let transform_data_str = cx.argument::(0)?.value(&mut cx); - let transform_request_data = - match serde_json::from_str::(&transform_data_str) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - let cube_store_result = cx.argument::>(1)?; + let cube_store_result = cx.argument::>>(1)?; + let cube_store_result = Arc::clone(&cube_store_result); let result_data_str = cx.argument::(2)?.value(&mut cx); - let mut result_data = match serde_json::from_str::(&result_data_str) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - if let Err(err) = get_final_cubestore_result( - &transform_request_data, - &cube_store_result, - &mut result_data, - ) { - return cx.throw_error(err.to_string()); - } + let promise = cx + .task(move || { + let transform_request_data = + match serde_json::from_str::(&transform_data_str) { + Ok(data) => data, + Err(err) => return Err(anyhow::Error::from(err)), + }; + + let mut result_data = match serde_json::from_str::(&result_data_str) { + Ok(data) => data, + Err(err) => return Err(anyhow::Error::from(err)), + }; - let json_data = match serde_json::to_string(&result_data) { - Ok(data) => data, - Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), - }; - let json_bytes = json_data.as_bytes(); + get_final_cubestore_result( + &transform_request_data, + &cube_store_result, + &mut result_data, + )?; - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } + match serde_json::to_string(&result_data) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |mut cx, json_string| { + match json_string { + Ok(json_string) => { + let json_bytes = json_string.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + + Ok(js_buffer) + } + Err(err) => cx.throw_error(err.to_string()), + } + }); - Ok(js_buffer) + Ok(promise) } -fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { +fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { let transform_data_array = cx.argument::(0)?; - let transform_requests: Vec = transform_data_array + let transform_request_strings: Vec = transform_data_array .to_vec(&mut cx)? .into_iter() .map(|js_value| { - let js_string = js_value - .downcast_or_throw::(&mut cx)? - .value(&mut cx); - - match serde_json::from_str::(&js_string) { - Ok(request) => Ok(request), - Err(err) => cx.throw_error(err.to_string()), - } + js_value + .downcast_or_throw::(&mut cx) + .map(|js_string| js_string.value(&mut cx)) }) .collect::>()?; let cube_store_array = cx.argument::(1)?; - let cube_store_results_boxed: Vec>> = cube_store_array + let cube_store_results_boxed: Vec>>> = cube_store_array .to_vec(&mut cx)? .into_iter() - .map(|js_value| js_value.downcast_or_throw::, _>(&mut cx)) + .map(|js_value| { + js_value + .downcast_or_throw::>, _>(&mut cx) + }) .collect::>()?; - let cube_store_results: Vec<&CubeStoreResult> = cube_store_results_boxed + let cube_store_results: Vec> = cube_store_results_boxed .iter() - .map(|handle| &***handle) + .map(|handle| (**handle).clone()) .collect(); let results_data_array = cx.argument::(2)?; - let mut request_results: Vec = results_data_array + let request_result_strings: Vec = results_data_array .to_vec(&mut cx)? .into_iter() .map(|js_value| { - let js_string = js_value - .downcast_or_throw::(&mut cx)? - .value(&mut cx); - - match serde_json::from_str::(&js_string) { - Ok(request) => Ok(request), - Err(err) => cx.throw_error(err.to_string()), - } + js_value + .downcast_or_throw::(&mut cx) + .map(|js_string| js_string.value(&mut cx)) }) .collect::>()?; - if let Err(err) = get_final_cubestore_result_array( - &transform_requests, - &cube_store_results, - &mut request_results, - ) { - return cx.throw_error(err.to_string()); - } - - let final_obj = RequestResultArray { - results: request_results, - }; - - let json_data = match serde_json::to_string(&final_obj) { - Ok(data) => data, - Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), - }; - let json_bytes = json_data.as_bytes(); + let promise = cx + .task(move || { + let transform_requests: Vec = transform_request_strings + .into_iter() + .map(|req_str| { + match serde_json::from_str::(&req_str) { + Ok(request) => Ok(request), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .collect::>()?; + + let mut request_results: Vec = request_result_strings + .into_iter() + .map(|req_str| { + match serde_json::from_str::(&req_str) { + Ok(request) => Ok(request), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .collect::>()?; + + get_final_cubestore_result_array( + &transform_requests, + &cube_store_results, + &mut request_results, + )?; + + let final_obj = RequestResultArray { + results: request_results, + }; - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } + match serde_json::to_string(&final_obj) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |mut cx, json_data| { + match json_data { + Ok(json_data) => { + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + + Ok(js_buffer) + } + Err(err) => cx.throw_error(err.to_string()), + } + }); - Ok(js_buffer) + Ok(promise) } -fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { +fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { let transform_data_array = cx.argument::(0)?; - let transform_requests: Vec = transform_data_array + let transform_request_strings: Vec = transform_data_array .to_vec(&mut cx)? .into_iter() .map(|js_value| { - let js_string = js_value - .downcast_or_throw::(&mut cx)? - .value(&mut cx); - - match serde_json::from_str::(&js_string) { - Ok(request) => Ok(request), - Err(err) => cx.throw_error(err.to_string()), - } + js_value + .downcast_or_throw::(&mut cx) + .map(|js_string| js_string.value(&mut cx)) }) .collect::>()?; let cube_store_array = cx.argument::(1)?; - let cube_store_results_boxed: Vec>> = cube_store_array + let cube_store_results_boxed: Vec>>> = cube_store_array .to_vec(&mut cx)? .into_iter() - .map(|js_value| js_value.downcast_or_throw::, _>(&mut cx)) + .map(|js_value| { + js_value + .downcast_or_throw::>, _>(&mut cx) + }) .collect::>()?; - let cube_store_results: Vec<&CubeStoreResult> = cube_store_results_boxed + let cube_store_results: Vec> = cube_store_results_boxed .iter() - .map(|handle| &***handle) + .map(|handle| (**handle).clone()) .collect(); let result_data_str = cx.argument::(2)?.value(&mut cx); - let mut result_data = match serde_json::from_str::(&result_data_str) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - if let Err(err) = - get_final_cubestore_result_multi(&transform_requests, &cube_store_results, &mut result_data) - { - return cx.throw_error(err.to_string()); - } + let promise = cx + .task(move || { + let transform_requests: Vec = transform_request_strings + .into_iter() + .map(|req_str| { + match serde_json::from_str::(&req_str) { + Ok(request) => Ok(request), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .collect::>()?; + + let mut result_data = match serde_json::from_str::(&result_data_str) { + Ok(data) => data, + Err(err) => return Err(anyhow::Error::from(err)), + }; - let json_data = match serde_json::to_string(&result_data) { - Ok(data) => data, - Err(e) => return cx.throw_error(format!("Serialization error: {}", e)), - }; - let json_bytes = json_data.as_bytes(); + get_final_cubestore_result_multi(&transform_requests, &cube_store_results, &mut result_data)?; - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } + match serde_json::to_string(&result_data) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |mut cx, json_data| { + match json_data { + Ok(json_data) => { + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + + Ok(js_buffer) + } + Err(err) => cx.throw_error(err.to_string()), + } + }); - Ok(js_buffer) + Ok(promise) } pub fn register_module_exports( diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index e03448d0551fc..a8e72b0484713 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -11,6 +11,7 @@ use anyhow::{bail, Context, Result}; use chrono::{DateTime, SecondsFormat}; use itertools::multizip; use std::collections::{HashMap, HashSet}; +use std::sync::Arc; /// Transform specified `value` with specified `type` to the network protocol type. pub fn transform_value(value: String, type_: &str) -> String { @@ -438,7 +439,7 @@ pub fn get_final_cubestore_result( pub fn get_final_cubestore_result_array( transform_requests: &[TransformDataRequest], - cube_store_results: &[&CubeStoreResult], + cube_store_results: &[Arc], result_data: &mut [RequestResultData], ) -> Result<()> { for (transform_data, cube_store_result, result) in multizip(( @@ -454,7 +455,7 @@ pub fn get_final_cubestore_result_array( pub fn get_final_cubestore_result_multi( request_data: &[TransformDataRequest], - cube_store_result: &[&CubeStoreResult], + cube_store_result: &[Arc], result_data: &mut RequestResultDataMulti, ) -> Result<()> { for (transform_data, cube_store_result, result) in multizip(( From 71750d5eba4cd268e25d3cea4074a6cf22092583 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 13 Dec 2024 21:14:52 +0200 Subject: [PATCH 055/128] cargo fmt --- .../cubejs-backend-native/src/node_export.rs | 156 ++++++++---------- .../src/cubestore_result_transform.rs | 6 +- 2 files changed, 77 insertions(+), 85 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 3c86121c3c2c7..ae578437bb28a 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -9,10 +9,6 @@ use futures::StreamExt; use serde_json::Map; use tokio::sync::Semaphore; -use std::net::SocketAddr; -use std::rc::Rc; -use std::str::FromStr; -use std::sync::Arc; use crate::auth::{NativeAuthContext, NodeBridgeAuthService}; use crate::channel::call_js_fn; use crate::config::{NodeConfiguration, NodeConfigurationFactoryOptions, NodeCubeServices}; @@ -30,6 +26,10 @@ use cubenativeutils::wrappers::serializer::NativeDeserialize; use cubenativeutils::wrappers::NativeContextHolder; use cubesqlplanner::cube_bridge::base_query_options::NativeBaseQueryOptions; use cubesqlplanner::planner::base_query::BaseQuery; +use std::net::SocketAddr; +use std::rc::Rc; +use std::str::FromStr; +use std::sync::Arc; use cubeorchestrator::cubestore_message_parser::CubeStoreResult; @@ -520,11 +520,9 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult Ok(cx.boxed(Arc::new(result))), - Err(err) => cx.throw_error(err.to_string()), - } + .promise(move |mut cx, res| match res { + Ok(result) => Ok(cx.boxed(Arc::new(result))), + Err(err) => cx.throw_error(err.to_string()), }); Ok(promise) @@ -589,18 +587,16 @@ fn transform_query_data(mut cx: FunctionContext) -> JsResult { Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_data| { - match json_data { - Ok(json_data) => { - let js_string = cx.string(json_data); + .promise(move |mut cx, json_data| match json_data { + Ok(json_data) => { + let js_string = cx.string(json_data); - let js_result = cx.empty_object(); - js_result.set(&mut cx, "result", js_string)?; + let js_result = cx.empty_object(); + js_result.set(&mut cx, "result", js_string)?; - Ok(js_result) - } - Err(err) => cx.throw_error(err.to_string()), + Ok(js_result) } + Err(err) => cx.throw_error(err.to_string()), }); Ok(promise) @@ -620,7 +616,8 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Err(err) => return Err(anyhow::Error::from(err)), }; - let mut result_data = match serde_json::from_str::(&result_data_str) { + let mut result_data = match serde_json::from_str::(&result_data_str) + { Ok(data) => data, Err(err) => return Err(anyhow::Error::from(err)), }; @@ -636,21 +633,19 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_string| { - match json_string { - Ok(json_string) => { - let json_bytes = json_string.as_bytes(); - - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - - Ok(js_buffer) + .promise(move |mut cx, json_string| match json_string { + Ok(json_string) => { + let json_bytes = json_string.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); } - Err(err) => cx.throw_error(err.to_string()), + + Ok(js_buffer) } + Err(err) => cx.throw_error(err.to_string()), }); Ok(promise) @@ -672,10 +667,7 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult let cube_store_results_boxed: Vec>>> = cube_store_array .to_vec(&mut cx)? .into_iter() - .map(|js_value| { - js_value - .downcast_or_throw::>, _>(&mut cx) - }) + .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) .collect::>()?; let cube_store_results: Vec> = cube_store_results_boxed .iter() @@ -697,22 +689,22 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult .task(move || { let transform_requests: Vec = transform_request_strings .into_iter() - .map(|req_str| { - match serde_json::from_str::(&req_str) { + .map( + |req_str| match serde_json::from_str::(&req_str) { Ok(request) => Ok(request), Err(err) => Err(anyhow::Error::from(err)), - } - }) + }, + ) .collect::>()?; let mut request_results: Vec = request_result_strings .into_iter() - .map(|req_str| { - match serde_json::from_str::(&req_str) { + .map( + |req_str| match serde_json::from_str::(&req_str) { Ok(request) => Ok(request), Err(err) => Err(anyhow::Error::from(err)), - } - }) + }, + ) .collect::>()?; get_final_cubestore_result_array( @@ -730,21 +722,19 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_data| { - match json_data { - Ok(json_data) => { - let json_bytes = json_data.as_bytes(); - - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - - Ok(js_buffer) + .promise(move |mut cx, json_data| match json_data { + Ok(json_data) => { + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); } - Err(err) => cx.throw_error(err.to_string()), + + Ok(js_buffer) } + Err(err) => cx.throw_error(err.to_string()), }); Ok(promise) @@ -766,10 +756,7 @@ fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult let cube_store_results_boxed: Vec>>> = cube_store_array .to_vec(&mut cx)? .into_iter() - .map(|js_value| { - js_value - .downcast_or_throw::>, _>(&mut cx) - }) + .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) .collect::>()?; let cube_store_results: Vec> = cube_store_results_boxed .iter() @@ -782,41 +769,44 @@ fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult .task(move || { let transform_requests: Vec = transform_request_strings .into_iter() - .map(|req_str| { - match serde_json::from_str::(&req_str) { + .map( + |req_str| match serde_json::from_str::(&req_str) { Ok(request) => Ok(request), Err(err) => Err(anyhow::Error::from(err)), - } - }) + }, + ) .collect::>()?; - let mut result_data = match serde_json::from_str::(&result_data_str) { - Ok(data) => data, - Err(err) => return Err(anyhow::Error::from(err)), - }; + let mut result_data = + match serde_json::from_str::(&result_data_str) { + Ok(data) => data, + Err(err) => return Err(anyhow::Error::from(err)), + }; - get_final_cubestore_result_multi(&transform_requests, &cube_store_results, &mut result_data)?; + get_final_cubestore_result_multi( + &transform_requests, + &cube_store_results, + &mut result_data, + )?; match serde_json::to_string(&result_data) { Ok(json) => Ok(json), Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_data| { - match json_data { - Ok(json_data) => { - let json_bytes = json_data.as_bytes(); - - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - - Ok(js_buffer) + .promise(move |mut cx, json_data| match json_data { + Ok(json_data) => { + let json_bytes = json_data.as_bytes(); + + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); } - Err(err) => cx.throw_error(err.to_string()), + + Ok(js_buffer) } + Err(err) => cx.throw_error(err.to_string()), }); Ok(promise) diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index a8e72b0484713..c35c00d3922da 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -10,8 +10,10 @@ use crate::{ use anyhow::{bail, Context, Result}; use chrono::{DateTime, SecondsFormat}; use itertools::multizip; -use std::collections::{HashMap, HashSet}; -use std::sync::Arc; +use std::{ + collections::{HashMap, HashSet}, + sync::Arc, +}; /// Transform specified `value` with specified `type` to the network protocol type. pub fn transform_value(value: String, type_: &str) -> String { From 256ac00bd7e446de5c9efb1cd4cf833fb565e952 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 16 Dec 2024 14:00:24 +0200 Subject: [PATCH 056/128] refactor results transformations --- .../cubejs-backend-native/src/node_export.rs | 35 +-- .../src/cubestore_result_transform.rs | 266 +++++++++++------- rust/cubeorchestrator/src/lib.rs | 2 +- .../src/{types.rs => transport.rs} | 53 ---- 4 files changed, 164 insertions(+), 192 deletions(-) rename rust/cubeorchestrator/src/{types.rs => transport.rs} (86%) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index ae578437bb28a..fd768be8c53d0 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -36,12 +36,10 @@ use cubeorchestrator::cubestore_message_parser::CubeStoreResult; use cubesql::{telemetry::ReportingLogger, CubeError}; use cubeorchestrator::cubestore_result_transform::{ - get_final_cubestore_result, get_final_cubestore_result_array, get_final_cubestore_result_multi, - transform_data, -}; -use cubeorchestrator::types::{ - RequestResultArray, RequestResultData, RequestResultDataMulti, TransformDataRequest, + get_final_cubestore_result_array, RequestResultArray, RequestResultData, + RequestResultDataMulti, TransformedData, }; +use cubeorchestrator::transport::TransformDataRequest; use neon::prelude::*; use neon::types::buffer::TypedArray; @@ -567,20 +565,7 @@ fn transform_query_data(mut cx: FunctionContext) -> JsResult { Err(err) => return Err(anyhow::Error::from(err)), }; - let alias_to_member_name_map = &request_data.alias_to_member_name_map; - let annotation = &request_data.annotation; - let query = &request_data.query; - let query_type = &request_data.query_type.unwrap_or_default(); - let res_type = &request_data.res_type; - - let transformed = transform_data( - alias_to_member_name_map, - annotation, - &cube_store_result, - query, - query_type, - res_type.clone(), - )?; + let transformed = TransformedData::transform(&request_data, &cube_store_result)?; match serde_json::to_string(&transformed) { Ok(json) => Ok(json), @@ -622,11 +607,7 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Err(err) => return Err(anyhow::Error::from(err)), }; - get_final_cubestore_result( - &transform_request_data, - &cube_store_result, - &mut result_data, - )?; + result_data.prepare_results(&transform_request_data, &cube_store_result)?; match serde_json::to_string(&result_data) { Ok(json) => Ok(json), @@ -783,11 +764,7 @@ fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult Err(err) => return Err(anyhow::Error::from(err)), }; - get_final_cubestore_result_multi( - &transform_requests, - &cube_store_results, - &mut result_data, - )?; + result_data.prepare_results(&transform_requests, &cube_store_results)?; match serde_json::to_string(&result_data) { Ok(json) => Ok(json), diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index c35c00d3922da..82fc4757c2f76 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -1,15 +1,16 @@ use crate::{ cubestore_message_parser::CubeStoreResult, - types::{ - ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, RequestResultData, - RequestResultDataMulti, ResultType, TransformDataRequest, TransformedData, - BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, - COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, + transport::{ + ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, ResultType, + TransformDataRequest, BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, + COMPARE_DATE_RANGE_FIELD, COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, }, }; use anyhow::{bail, Context, Result}; use chrono::{DateTime, SecondsFormat}; use itertools::multizip; +use serde::{Deserialize, Serialize}; +use serde_json::Value; use std::{ collections::{HashMap, HashSet}, sync::Arc, @@ -284,63 +285,6 @@ pub fn get_vanilla_row( Ok(row) } -/// Transforms queried data array to the output format. -pub fn transform_data( - alias_to_member_name_map: &HashMap, - annotation: &HashMap, - data: &CubeStoreResult, - query: &NormalizedQuery, - query_type: &QueryType, - res_type: Option, -) -> Result { - let members_to_alias_map = get_members( - query_type, - query, - data, - alias_to_member_name_map, - annotation, - )?; - let members: Vec = members_to_alias_map.keys().cloned().collect(); - - match res_type { - Some(ResultType::Compact) => { - let dataset: Vec<_> = data - .rows - .iter() - .map(|row| { - get_compact_row( - &members_to_alias_map, - annotation, - query_type, - &members, - query.time_dimensions.as_ref(), - row, - &data.columns_pos, - ) - }) - .collect::>>()?; - Ok(TransformedData::Compact { members, dataset }) - } - _ => { - let dataset: Vec<_> = data - .rows - .iter() - .map(|row| { - get_vanilla_row( - alias_to_member_name_map, - annotation, - query_type, - query, - row, - &data.columns_pos, - ) - }) - .collect::>>()?; - Ok(TransformedData::Vanilla(dataset)) - } - } -} - /// Helper to get a list if unique granularities from normalized queries pub fn get_query_granularities(queries: &[&NormalizedQuery]) -> Vec { queries @@ -414,31 +358,6 @@ pub fn get_pivot_query( Ok(pivot_query) } -pub fn get_final_cubestore_result( - request_data: &TransformDataRequest, - cube_store_result: &CubeStoreResult, - result_data: &mut RequestResultData, -) -> Result<()> { - let alias_to_member_name_map = &request_data.alias_to_member_name_map; - let annotation = &request_data.annotation; - let query = &request_data.query; - let query_type = &request_data.query_type.clone().unwrap_or_default(); - let res_type = &request_data.res_type; - - let transformed = transform_data( - alias_to_member_name_map, - annotation, - cube_store_result, - query, - query_type, - res_type.clone(), - )?; - - result_data.data = Some(transformed); - - Ok(()) -} - pub fn get_final_cubestore_result_array( transform_requests: &[TransformDataRequest], cube_store_results: &[Arc], @@ -449,35 +368,164 @@ pub fn get_final_cubestore_result_array( cube_store_results.iter(), result_data.iter_mut(), )) { - get_final_cubestore_result(transform_data, cube_store_result, result)?; + result.prepare_results(transform_data, cube_store_result)?; } Ok(()) } -pub fn get_final_cubestore_result_multi( - request_data: &[TransformDataRequest], - cube_store_result: &[Arc], - result_data: &mut RequestResultDataMulti, -) -> Result<()> { - for (transform_data, cube_store_result, result) in multizip(( - request_data.iter(), - cube_store_result.iter(), - result_data.results.iter_mut(), - )) { - get_final_cubestore_result(transform_data, cube_store_result, result)?; +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TransformedData { + Compact { + members: Vec, + dataset: Vec>, + }, + Vanilla(Vec>), +} + +impl TransformedData { + /// Transforms queried data array to the output format. + pub fn transform( + request_data: &TransformDataRequest, + cube_store_result: &CubeStoreResult, + ) -> Result { + let alias_to_member_name_map = &request_data.alias_to_member_name_map; + let annotation = &request_data.annotation; + let query = &request_data.query; + let query_type = &request_data.query_type.clone().unwrap_or_default(); + let res_type = request_data.res_type.clone(); + + let members_to_alias_map = get_members( + &query_type, + query, + cube_store_result, + alias_to_member_name_map, + annotation, + )?; + let members: Vec = members_to_alias_map.keys().cloned().collect(); + + match res_type { + Some(ResultType::Compact) => { + let dataset: Vec<_> = cube_store_result + .rows + .iter() + .map(|row| { + get_compact_row( + &members_to_alias_map, + annotation, + &query_type, + &members, + query.time_dimensions.as_ref(), + row, + &cube_store_result.columns_pos, + ) + }) + .collect::>>()?; + Ok(TransformedData::Compact { members, dataset }) + } + _ => { + let dataset: Vec<_> = cube_store_result + .rows + .iter() + .map(|row| { + get_vanilla_row( + alias_to_member_name_map, + annotation, + &query_type, + query, + row, + &cube_store_result.columns_pos, + ) + }) + .collect::>>()?; + Ok(TransformedData::Vanilla(dataset)) + } + } } +} - let normalized_queries = result_data - .results - .iter() - .map(|result| &result.query) - .collect::>(); +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RequestResultDataMulti { + #[serde(rename = "queryType")] + pub query_type: QueryType, + pub results: Vec, + #[serde(rename = "pivotQuery")] + pub pivot_query: Option, + #[serde(rename = "slowQuery")] + pub slow_query: bool, +} - result_data.pivot_query = Option::from(get_pivot_query( - &result_data.query_type, - &normalized_queries, - )?); +impl RequestResultDataMulti { + /// Processes multiple results and populates the final `RequestResultDataMulti` structure + /// which is sent to the client. + pub fn prepare_results( + &mut self, + request_data: &[TransformDataRequest], + cube_store_result: &[Arc], + ) -> Result<()> { + for (transform_data, cube_store_result, result) in multizip(( + request_data.iter(), + cube_store_result.iter(), + self.results.iter_mut(), + )) { + result.prepare_results(transform_data, cube_store_result)?; + } - Ok(()) + let normalized_queries = self + .results + .iter() + .map(|result| &result.query) + .collect::>(); + + self.pivot_query = Some(get_pivot_query(&self.query_type, &normalized_queries)?); + + Ok(()) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RequestResultData { + pub query: NormalizedQuery, + #[serde(rename = "lastRefreshTime")] + pub last_refresh_time: Option, + #[serde(rename = "refreshKeyValues")] + pub refresh_key_values: Option, + #[serde(rename = "usedPreAggregations")] + pub used_pre_aggregations: Option, + #[serde(rename = "transformedQuery")] + pub transformed_query: Option, + #[serde(rename = "requestId")] + pub request_id: Option, + pub annotation: HashMap>, + #[serde(rename = "dataSource")] + pub data_source: String, + #[serde(rename = "dbType")] + pub db_type: String, + #[serde(rename = "extDbType")] + pub ext_db_type: Option, + pub external: bool, + #[serde(rename = "slowQuery")] + pub slow_query: bool, + pub total: Option, + pub data: Option, +} + +impl RequestResultData { + /// Populates the `RequestResultData` structure with the transformed Query result. + pub fn prepare_results( + &mut self, + request_data: &TransformDataRequest, + cube_store_result: &CubeStoreResult, + ) -> Result<()> { + let transformed = TransformedData::transform(request_data, cube_store_result)?; + self.data = Some(transformed); + + Ok(()) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RequestResultArray { + pub results: Vec, } diff --git a/rust/cubeorchestrator/src/lib.rs b/rust/cubeorchestrator/src/lib.rs index f445d3cfcead5..6532689df15d9 100644 --- a/rust/cubeorchestrator/src/lib.rs +++ b/rust/cubeorchestrator/src/lib.rs @@ -1,3 +1,3 @@ pub mod cubestore_message_parser; pub mod cubestore_result_transform; -pub mod types; +pub mod transport; diff --git a/rust/cubeorchestrator/src/types.rs b/rust/cubeorchestrator/src/transport.rs similarity index 86% rename from rust/cubeorchestrator/src/types.rs rename to rust/cubeorchestrator/src/transport.rs index eeeada3e3b7ce..08033e984326b 100644 --- a/rust/cubeorchestrator/src/types.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -315,16 +315,6 @@ pub struct NormalizedQuery { pub query_type: Option, } -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum TransformedData { - Compact { - members: Vec, - dataset: Vec>, - }, - Vanilla(Vec>), -} - #[derive(Debug, Clone, Deserialize)] pub struct TransformDataRequest { #[serde(rename = "aliasToMemberNameMap")] @@ -336,46 +326,3 @@ pub struct TransformDataRequest { #[serde(rename = "resType")] pub res_type: Option, } - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct RequestResultData { - pub query: NormalizedQuery, - #[serde(rename = "lastRefreshTime")] - pub last_refresh_time: Option, - #[serde(rename = "refreshKeyValues")] - pub refresh_key_values: Option, - #[serde(rename = "usedPreAggregations")] - pub used_pre_aggregations: Option, - #[serde(rename = "transformedQuery")] - pub transformed_query: Option, - #[serde(rename = "requestId")] - pub request_id: Option, - pub annotation: HashMap>, - #[serde(rename = "dataSource")] - pub data_source: String, - #[serde(rename = "dbType")] - pub db_type: String, - #[serde(rename = "extDbType")] - pub ext_db_type: Option, - pub external: bool, - #[serde(rename = "slowQuery")] - pub slow_query: bool, - pub total: Option, - pub data: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct RequestResultDataMulti { - #[serde(rename = "queryType")] - pub query_type: QueryType, - pub results: Vec, - #[serde(rename = "pivotQuery")] - pub pivot_query: Option, - #[serde(rename = "slowQuery")] - pub slow_query: bool, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct RequestResultArray { - pub results: Vec, -} From 9c8adf90fe72aa74d3e30e57371a227e7c87f5c2 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 16 Dec 2024 14:11:15 +0200 Subject: [PATCH 057/128] yarn sync --- yarn.lock | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/yarn.lock b/yarn.lock index e81a341037e3c..82230ebe0e521 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5303,6 +5303,11 @@ tiny-invariant "^1.3.3" valid-url "^1.0.9" +"@cubejs-backend/cubesql@1.1.9": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@cubejs-backend/cubesql/-/cubesql-1.1.9.tgz#d87e7ec0a0ff9776242ad7ba6015fbc68ccd0a47" + integrity sha512-3BFNxFQOY/hPBtLGrrSJ1xVVZsz1K/IzDXfdHyjSCOh38GOXHPy6tC77+MEIGcvjIrPO2me77FZ4P5cZjKGgKg== + "@cubejs-backend/dotenv@^9.0.2": version "9.0.2" resolved "https://registry.yarnpkg.com/@cubejs-backend/dotenv/-/dotenv-9.0.2.tgz#c3679091b702f0fd38de120c5a63943fcdc0dcbf" @@ -5319,6 +5324,15 @@ uuid "9.0.0" winston "3.8.2" +"@cubejs-backend/native@1.1.9": + version "1.1.9" + resolved "https://registry.yarnpkg.com/@cubejs-backend/native/-/native-1.1.9.tgz#66cec2caa56ae6a9369c042ddfaf0896ec2d80c9" + integrity sha512-HA9yVlI0UDvKbKjKK+cFmGgSbUfwIyp41X1q+NATzmWGFFVlzth3iS2YJ/H7Mshng6FqmCphzmshaGrSWs4cCw== + dependencies: + "@cubejs-backend/cubesql" "1.1.9" + "@cubejs-backend/shared" "1.1.8" + "@cubejs-infra/post-installer" "^0.0.7" + "@cubejs-backend/shared@0.33.20": version "0.33.20" resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-0.33.20.tgz#3d9fa60041599cca9fe4c04df05daa4b8ab8675f" @@ -5339,6 +5353,26 @@ throttle-debounce "^3.0.1" uuid "^8.3.2" +"@cubejs-backend/shared@1.1.8": + version "1.1.8" + resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-1.1.8.tgz#3bca511f0f779edc22c2f684a7f76bc52577e9a1" + integrity sha512-DtW4w3ha/nsgWYPwWPvifmMNEHM85Kdv2jg/apZaqTd4HtgXzX71GNSrz2dH03gihuJnYsZBZrZMpqYjdZkKdA== + dependencies: + "@oclif/color" "^0.1.2" + bytes "^3.1.0" + cli-progress "^3.9.0" + cross-spawn "^7.0.3" + decompress "^4.2.1" + env-var "^6.3.0" + fs-extra "^9.1.0" + http-proxy-agent "^4.0.1" + moment-range "^4.0.1" + moment-timezone "^0.5.33" + node-fetch "^2.6.1" + shelljs "^0.8.5" + throttle-debounce "^3.0.1" + uuid "^8.3.2" + "@cubejs-infra/post-installer@^0.0.7": version "0.0.7" resolved "https://registry.yarnpkg.com/@cubejs-infra/post-installer/-/post-installer-0.0.7.tgz#a28d2d03e5b7b69a64020d75194a7078cf911d2d" From 83b16d871dd0507cb42aa928157a6b79f2d46062 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 01:05:25 +0200 Subject: [PATCH 058/128] =?UTF-8?q?implement=20custom=20deserializer=20fro?= =?UTF-8?q?m=20JS=20Value=20to=C2=A0rust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and updated the cubestore result transformations with it --- packages/cubejs-api-gateway/src/gateway.ts | 19 +- packages/cubejs-backend-native/js/index.ts | 16 +- packages/cubejs-backend-native/src/lib.rs | 1 + .../cubejs-backend-native/src/node_export.rs | 136 ++---- .../src/node_obj_deserializer.rs | 434 ++++++++++++++++++ .../src/cubestore_result_transform.rs | 6 +- 6 files changed, 503 insertions(+), 109 deletions(-) create mode 100644 packages/cubejs-backend-native/src/node_obj_deserializer.rs diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 756ff5400a704..1f903531d3c7b 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1651,7 +1651,7 @@ class ApiGateway { const dataCb: TransformDataResponseCb = response.data.isNative ? async () => { const jsonData = await transformDataNative( - JSON.stringify(transformDataParams), response.data.getNativeRef() + transformDataParams, response.data.getNativeRef() ); return JSON.parse(jsonData.result) as TransformDataResponse; } @@ -1850,9 +1850,9 @@ class ApiGateway { // If all query results are from Cubestore (are native) // we prepare the final json result on native side if (allNative) { - const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[string[], any[], any[]]>( + const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(JSON.stringify(r.transformDataParams)); + transformList.push(r.transformDataParams); rawList.push(r.rawData.getNativeRef()); resultList.push(cleanupResult(r)); return [transformList, rawList, resultList]; @@ -1865,9 +1865,8 @@ class ApiGateway { results: cleanResultList, slowQuery }; - const resultDataJson = JSON.stringify(responseDataObj); - res(await getFinalCubestoreResultMulti(transformDataJson, rawDataRef, resultDataJson)); + res(await getFinalCubestoreResultMulti(transformDataJson, rawDataRef, responseDataObj)); } else { // if we have mixed query results (there are js and native) // we prepare results separately: on js and native sides @@ -1888,10 +1887,8 @@ class ApiGateway { } else if (allNative) { // We prepare the full final json result on native side const r = results[0]; - const transformDataJson = JSON.stringify(r.transformDataParams); const rawDataRef = r.rawData.getNativeRef(); - const resultDataJson = JSON.stringify(cleanupResult(r)); - res(await getFinalCubestoreResult(transformDataJson, rawDataRef, resultDataJson)); + res(await getFinalCubestoreResult(r.transformDataParams, rawDataRef, cleanupResult(r))); } else { const data = await results[0].dataCb(); res({ @@ -2036,11 +2033,11 @@ class ApiGateway { const [transformDataJson, rawDataRef, resultDataJson] = (results as { transformDataParams: any; rawData: { getNativeRef: () => any }; - }[]).reduce<[string[], any[], string[]]>( + }[]).reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(JSON.stringify(r.transformDataParams)); + transformList.push(r.transformDataParams); rawList.push(r.rawData.getNativeRef()); - resultList.push(JSON.stringify(cleanupResult(r))); + resultList.push(cleanupResult(r)); return [transformList, rawList, resultList]; }, [[], [], []] diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 63621491fe77c..073055026615f 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -383,28 +383,28 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; -export const transformData = (transformDataJson: string, rows: any): Promise => { +export const transformData = (transformDataObj: Object, rows: any): Promise => { const native = loadNative(); - return native.transformQueryData(transformDataJson, rows); + return native.transformQueryData(transformDataObj, rows); }; -export const getFinalCubestoreResult = (transformDataJson: string, rows: any, resultData: string): Promise => { +export const getFinalCubestoreResult = (transformDataObj: Object, rows: any, resultData: Object): Promise => { const native = loadNative(); - return native.getFinalCubestoreResult(transformDataJson, rows, resultData); + return native.getFinalCubestoreResult(transformDataObj, rows, resultData); }; -export const getFinalCubestoreResultArray = (transformDataJson: string[], rows: any[], resultDataJson: string[]): Promise => { +export const getFinalCubestoreResultArray = (transformDataArr: Object[], rows: any[], resultDataArr: Object[]): Promise => { const native = loadNative(); - return native.getFinalCubestoreResultArray(transformDataJson, rows, resultDataJson); + return native.getFinalCubestoreResultArray(transformDataArr, rows, resultDataArr); }; -export const getFinalCubestoreResultMulti = (transformDataJson: string[], rows: any[], responseData: string): Promise => { +export const getFinalCubestoreResultMulti = (transformDataArr: Object[], rows: any[], responseData: Object): Promise => { const native = loadNative(); - return native.getFinalCubestoreResultMulti(transformDataJson, rows, responseData); + return native.getFinalCubestoreResultMulti(transformDataArr, rows, responseData); }; export interface PyConfiguration { diff --git a/packages/cubejs-backend-native/src/lib.rs b/packages/cubejs-backend-native/src/lib.rs index 07a36aa69481a..4c9f442629600 100644 --- a/packages/cubejs-backend-native/src/lib.rs +++ b/packages/cubejs-backend-native/src/lib.rs @@ -11,6 +11,7 @@ pub mod cross; pub mod gateway; pub mod logger; pub mod node_export; +pub mod node_obj_deserializer; pub mod node_obj_serializer; #[cfg(feature = "python")] pub mod python; diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index fd768be8c53d0..68bc32f11307f 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -35,6 +35,7 @@ use cubeorchestrator::cubestore_message_parser::CubeStoreResult; use cubesql::{telemetry::ReportingLogger, CubeError}; +use crate::node_obj_deserializer::JsValueDeserializer; use cubeorchestrator::cubestore_result_transform::{ get_final_cubestore_result_array, RequestResultArray, RequestResultData, RequestResultDataMulti, TransformedData, @@ -42,6 +43,7 @@ use cubeorchestrator::cubestore_result_transform::{ use cubeorchestrator::transport::TransformDataRequest; use neon::prelude::*; use neon::types::buffer::TypedArray; +use serde::Deserialize; struct SQLInterface { services: Arc, @@ -553,18 +555,19 @@ fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { } fn transform_query_data(mut cx: FunctionContext) -> JsResult { - let json_str = cx.argument::(0)?.value(&mut cx); + let transform_data_js_object = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); + + let request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; let cube_store_result = cx.argument::>>(1)?; let cube_store_result = Arc::clone(&cube_store_result); let promise = cx .task(move || { - let request_data = match serde_json::from_str::(&json_str) { - Ok(data) => data, - Err(err) => return Err(anyhow::Error::from(err)), - }; - let transformed = TransformedData::transform(&request_data, &cube_store_result)?; match serde_json::to_string(&transformed) { @@ -588,25 +591,25 @@ fn transform_query_data(mut cx: FunctionContext) -> JsResult { } fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { - let transform_data_str = cx.argument::(0)?.value(&mut cx); + let transform_data_js_object = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); + let transform_request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) + { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + let cube_store_result = cx.argument::>>(1)?; let cube_store_result = Arc::clone(&cube_store_result); - let result_data_str = cx.argument::(2)?.value(&mut cx); + let result_data_js_object = cx.argument::(2)?; + let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); + let mut result_data: RequestResultData = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; let promise = cx .task(move || { - let transform_request_data = - match serde_json::from_str::(&transform_data_str) { - Ok(data) => data, - Err(err) => return Err(anyhow::Error::from(err)), - }; - - let mut result_data = match serde_json::from_str::(&result_data_str) - { - Ok(data) => data, - Err(err) => return Err(anyhow::Error::from(err)), - }; - result_data.prepare_results(&transform_request_data, &cube_store_result)?; match serde_json::to_string(&result_data) { @@ -633,16 +636,13 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { } fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { - let transform_data_array = cx.argument::(0)?; - let transform_request_strings: Vec = transform_data_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| { - js_value - .downcast_or_throw::(&mut cx) - .map(|js_string| js_string.value(&mut cx)) - }) - .collect::>()?; + let transform_data_array = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); + let transform_requests: Vec = match Deserialize::deserialize(deserializer) + { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; let cube_store_array = cx.argument::(1)?; let cube_store_results_boxed: Vec>>> = cube_store_array @@ -655,39 +655,15 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult .map(|handle| (**handle).clone()) .collect(); - let results_data_array = cx.argument::(2)?; - let request_result_strings: Vec = results_data_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| { - js_value - .downcast_or_throw::(&mut cx) - .map(|js_string| js_string.value(&mut cx)) - }) - .collect::>()?; + let results_data_array = cx.argument::(2)?; + let deserializer = JsValueDeserializer::new(&mut cx, results_data_array); + let mut request_results: Vec = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; let promise = cx .task(move || { - let transform_requests: Vec = transform_request_strings - .into_iter() - .map( - |req_str| match serde_json::from_str::(&req_str) { - Ok(request) => Ok(request), - Err(err) => Err(anyhow::Error::from(err)), - }, - ) - .collect::>()?; - - let mut request_results: Vec = request_result_strings - .into_iter() - .map( - |req_str| match serde_json::from_str::(&req_str) { - Ok(request) => Ok(request), - Err(err) => Err(anyhow::Error::from(err)), - }, - ) - .collect::>()?; - get_final_cubestore_result_array( &transform_requests, &cube_store_results, @@ -722,16 +698,13 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult } fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { - let transform_data_array = cx.argument::(0)?; - let transform_request_strings: Vec = transform_data_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| { - js_value - .downcast_or_throw::(&mut cx) - .map(|js_string| js_string.value(&mut cx)) - }) - .collect::>()?; + let transform_data_array = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); + let transform_requests: Vec = match Deserialize::deserialize(deserializer) + { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; let cube_store_array = cx.argument::(1)?; let cube_store_results_boxed: Vec>>> = cube_store_array @@ -744,26 +717,15 @@ fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult .map(|handle| (**handle).clone()) .collect(); - let result_data_str = cx.argument::(2)?.value(&mut cx); + let result_data_js_object = cx.argument::(2)?; + let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); + let mut result_data: RequestResultDataMulti = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; let promise = cx .task(move || { - let transform_requests: Vec = transform_request_strings - .into_iter() - .map( - |req_str| match serde_json::from_str::(&req_str) { - Ok(request) => Ok(request), - Err(err) => Err(anyhow::Error::from(err)), - }, - ) - .collect::>()?; - - let mut result_data = - match serde_json::from_str::(&result_data_str) { - Ok(data) => data, - Err(err) => return Err(anyhow::Error::from(err)), - }; - result_data.prepare_results(&transform_requests, &cube_store_results)?; match serde_json::to_string(&result_data) { diff --git a/packages/cubejs-backend-native/src/node_obj_deserializer.rs b/packages/cubejs-backend-native/src/node_obj_deserializer.rs new file mode 100644 index 0000000000000..c30d86796a559 --- /dev/null +++ b/packages/cubejs-backend-native/src/node_obj_deserializer.rs @@ -0,0 +1,434 @@ +use neon::prelude::*; +use neon::result::Throw; +use serde::de::{ + self, Deserializer, EnumAccess, IntoDeserializer, MapAccess, SeqAccess, StdError, + VariantAccess, Visitor, +}; +use serde::forward_to_deserialize_any; +use std::fmt; + +#[derive(Debug)] +pub struct JsDeserializationError(String); + +impl fmt::Display for JsDeserializationError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "JS Deserialization Error: {}", self.0) + } +} + +impl From for JsDeserializationError { + fn from(throw: Throw) -> Self { + JsDeserializationError(throw.to_string()) + } +} + +impl StdError for JsDeserializationError {} + +impl de::Error for JsDeserializationError { + fn custom(msg: T) -> Self { + JsDeserializationError(msg.to_string()) + } +} + +pub struct JsValueDeserializer<'a, 'b> { + pub cx: &'a mut FunctionContext<'b>, + pub value: Handle<'a, JsValue>, +} + +impl<'a, 'b> JsValueDeserializer<'a, 'b> { + pub fn new(cx: &'a mut FunctionContext<'b>, value: Handle<'a, JsValue>) -> Self { + Self { cx, value } + } +} + +impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> { + type Error = JsDeserializationError; + + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + if self.value.is_a::(self.cx) { + let value = self + .value + .downcast::(self.cx) + .or_throw(self.cx)? + .value(self.cx); + visitor.visit_string(value) + } else if self.value.is_a::(self.cx) { + let value = self + .value + .downcast::(self.cx) + .or_throw(self.cx)? + .value(self.cx); + + // floats + if value.fract() != 0.0 { + return visitor.visit_f64(value); + } + + // unsigned + if value >= 0.0 { + if value <= u8::MAX as f64 { + return visitor.visit_u8(value as u8); + } + + if value <= u16::MAX as f64 { + return visitor.visit_u16(value as u16); + } + + if value <= u32::MAX as f64 { + return visitor.visit_u32(value as u32); + } + + if value <= u64::MAX as f64 { + return visitor.visit_u64(value as u64); + } + } + + if value >= i8::MIN as f64 && value <= i8::MAX as f64 { + return visitor.visit_i8(value as i8); + } + + if value >= i16::MIN as f64 && value <= i16::MAX as f64 { + return visitor.visit_i16(value as i16); + } + + if value >= i32::MIN as f64 && value <= i32::MAX as f64 { + return visitor.visit_i32(value as i32); + } + + if value >= i64::MIN as f64 && value <= i64::MAX as f64 { + return visitor.visit_i64(value as i64); + } + + Err(JsDeserializationError( + "Unsupported type for deserialization".to_string(), + )) + } else if self.value.is_a::(self.cx) { + let value = self + .value + .downcast::(self.cx) + .or_throw(self.cx)? + .value(self.cx); + visitor.visit_bool(value) + } else if self.value.is_a::(self.cx) { + let js_array = self + .value + .downcast::(self.cx) + .or_throw(self.cx)?; + let deserializer = JsArrayDeserializer::new(self.cx, js_array); + visitor.visit_seq(deserializer) + } else if self.value.is_a::(self.cx) { + let js_object = self + .value + .downcast::(self.cx) + .or_throw(self.cx)?; + let deserializer = JsObjectDeserializer::new(self.cx, js_object); + visitor.visit_map(deserializer) + } else if self.value.is_a::(self.cx) + || self.value.is_a::(self.cx) + { + visitor.visit_none() + } else { + Err(JsDeserializationError( + "Unsupported type for deserialization".to_string(), + )) + } + } + + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + if self.value.is_a::(self.cx) || self.value.is_a::(self.cx) { + visitor.visit_none() + } else { + visitor.visit_some(self) + } + } + + fn deserialize_unit(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_unit() + } + + fn deserialize_unit_struct( + self, + _name: &'static str, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.deserialize_unit(visitor) + } + + fn deserialize_newtype_struct( + self, + _name: &'static str, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + visitor.visit_newtype_struct(self) + } + + fn deserialize_seq(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + if self.value.is_a::(self.cx) { + let js_array = self + .value + .downcast::(self.cx) + .or_throw(self.cx)?; + let deserializer = JsArrayDeserializer::new(self.cx, js_array); + visitor.visit_seq(deserializer) + } else { + Err(JsDeserializationError("expected an array".to_string())) + } + } + + fn deserialize_tuple(self, _len: usize, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_map(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + if self.value.is_a::(self.cx) { + let js_object = self + .value + .downcast::(self.cx) + .or_throw(self.cx)?; + let deserializer = JsObjectDeserializer::new(self.cx, js_object); + visitor.visit_map(deserializer) + } else { + Err(JsDeserializationError("expected an object".to_string())) + } + } + + fn deserialize_struct( + self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.deserialize_map(visitor) + } + + fn deserialize_enum( + self, + _name: &'static str, + _variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + let deserializer = JsEnumDeserializer::new(self.cx, self.value); + visitor.visit_enum(deserializer) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string + bytes byte_buf + identifier ignored_any + } +} + +struct JsObjectDeserializer<'a, 'b> { + cx: &'a mut FunctionContext<'b>, + js_object: Handle<'a, JsObject>, + keys: Vec, + index: usize, +} + +impl<'a, 'b> JsObjectDeserializer<'a, 'b> { + fn new(cx: &'a mut FunctionContext<'b>, js_object: Handle<'a, JsObject>) -> Self { + let keys = js_object + .get_own_property_names(cx) + .expect("Failed to get object keys") + .to_vec(cx) + .expect("Failed to convert keys to Vec") + .iter() + .filter_map(|k| { + k.downcast_or_throw::(cx) + .ok() + .map(|js_string| js_string.value(cx)) + }) + .collect::>(); + Self { + cx, + js_object, + keys, + index: 0, + } + } +} + +// `MapAccess` is provided to the `Visitor` to give it the ability to iterate +// through entries of the map. +impl<'de, 'a, 'b> MapAccess<'de> for JsObjectDeserializer<'a, 'b> { + type Error = JsDeserializationError; + + fn next_key_seed(&mut self, seed: K) -> Result, Self::Error> + where + K: de::DeserializeSeed<'de>, + { + if self.index >= self.keys.len() { + return Ok(None); + } + let key = &self.keys[self.index]; + self.index += 1; + seed.deserialize(key.as_str().into_deserializer()).map(Some) + } + + fn next_value_seed(&mut self, seed: V) -> Result + where + V: de::DeserializeSeed<'de>, + { + let key = &self.keys[self.index - 1]; + let value = self + .js_object + .get(self.cx, key.as_str()) + .expect("Failed to get value by key"); + seed.deserialize(JsValueDeserializer::new(self.cx, value)) + } +} + +struct JsArrayDeserializer<'a, 'b> { + cx: &'a mut FunctionContext<'b>, + js_array: Handle<'a, JsArray>, + index: usize, + length: usize, +} + +impl<'a, 'b> JsArrayDeserializer<'a, 'b> { + fn new(cx: &'a mut FunctionContext<'b>, js_array: Handle<'a, JsArray>) -> Self { + let length = js_array.len(cx) as usize; + Self { + cx, + js_array, + index: 0, + length, + } + } +} + +// `SeqAccess` is provided to the `Visitor` to give it the ability to iterate +// through elements of the sequence. +impl<'de, 'a, 'b> SeqAccess<'de> for JsArrayDeserializer<'a, 'b> { + type Error = JsDeserializationError; + + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + if self.index >= self.length { + return Ok(None); + } + let value = self + .js_array + .get(self.cx, self.index as u32) + .map_err(JsDeserializationError::from)?; + self.index += 1; + + seed.deserialize(JsValueDeserializer::new(self.cx, value)) + .map(Some) + } + + fn size_hint(&self) -> Option { + Some(self.length) + } +} + +pub struct JsEnumDeserializer<'a, 'b> { + cx: &'a mut FunctionContext<'b>, + value: Handle<'a, JsValue>, +} + +impl<'a, 'b> JsEnumDeserializer<'a, 'b> { + fn new(cx: &'a mut FunctionContext<'b>, value: Handle<'a, JsValue>) -> Self { + Self { cx, value } + } +} + +// `EnumAccess` is provided to the `Visitor` to give it the ability to determine +// which variant of the enum is supposed to be deserialized. +impl<'de, 'a, 'b> EnumAccess<'de> for JsEnumDeserializer<'a, 'b> { + type Error = JsDeserializationError; + type Variant = Self; + + fn variant_seed(self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + let variant = seed.deserialize(JsValueDeserializer::new(self.cx, self.value))?; + Ok((variant, self)) + } +} + +impl<'de, 'a, 'b> VariantAccess<'de> for JsEnumDeserializer<'a, 'b> { + type Error = JsDeserializationError; + + // If the `Visitor` expected this variant to be a unit variant, the input + // should have been the plain string case handled in `deserialize_enum`. + fn unit_variant(self) -> Result<(), Self::Error> { + Ok(()) + } + + // Newtype variants are represented in JSON as `{ NAME: VALUE }` so + // deserialize the value here. + fn newtype_variant_seed(self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + seed.deserialize(JsValueDeserializer::new(self.cx, self.value)) + } + + // Tuple variants are represented in JSON as `{ NAME: [DATA...] }` so + // deserialize the sequence of data here. + fn tuple_variant(self, _len: usize, visitor: V) -> Result + where + V: Visitor<'de>, + { + Deserializer::deserialize_seq(JsValueDeserializer::new(self.cx, self.value), visitor) + } + + // Struct variants are represented in JSON as `{ NAME: { K: V, ... } }` so + // deserialize the inner map here. + fn struct_variant( + self, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + Deserializer::deserialize_map(JsValueDeserializer::new(self.cx, self.value), visitor) + } +} diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 82fc4757c2f76..cc3205d6c5a09 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -397,7 +397,7 @@ impl TransformedData { let res_type = request_data.res_type.clone(); let members_to_alias_map = get_members( - &query_type, + query_type, query, cube_store_result, alias_to_member_name_map, @@ -414,7 +414,7 @@ impl TransformedData { get_compact_row( &members_to_alias_map, annotation, - &query_type, + query_type, &members, query.time_dimensions.as_ref(), row, @@ -432,7 +432,7 @@ impl TransformedData { get_vanilla_row( alias_to_member_name_map, annotation, - &query_type, + query_type, query, row, &cube_store_result.columns_pos, From 82d16e8ca96c2b1625e71ef8b14f43440f8edbfd Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 11:52:03 +0200 Subject: [PATCH 059/128] refactor json_to_array_buffer() --- .../cubejs-backend-native/src/node_export.rs | 66 +++++++------------ .../src/node_obj_deserializer.rs | 3 +- 2 files changed, 25 insertions(+), 44 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index 68bc32f11307f..f7af6da7c8865 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -514,6 +514,27 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { //============ sql orchestrator =================== +fn json_to_array_buffer<'a, C>( + mut cx: C, + json_data: Result, +) -> JsResult<'a, JsArrayBuffer> +where + C: Context<'a>, +{ + match json_data { + Ok(json_data) => { + let json_bytes = json_data.as_bytes(); + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + Ok(js_buffer) + } + Err(err) => cx.throw_error(err.to_string()), + } +} + fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { let msg = cx.argument::(0)?; let msg_data = msg.as_slice(&cx).to_vec(); @@ -617,20 +638,7 @@ fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_string| match json_string { - Ok(json_string) => { - let json_bytes = json_string.as_bytes(); - - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - - Ok(js_buffer) - } - Err(err) => cx.throw_error(err.to_string()), - }); + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); Ok(promise) } @@ -679,20 +687,7 @@ fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_data| match json_data { - Ok(json_data) => { - let json_bytes = json_data.as_bytes(); - - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - - Ok(js_buffer) - } - Err(err) => cx.throw_error(err.to_string()), - }); + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); Ok(promise) } @@ -733,20 +728,7 @@ fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult Err(err) => Err(anyhow::Error::from(err)), } }) - .promise(move |mut cx, json_data| match json_data { - Ok(json_data) => { - let json_bytes = json_data.as_bytes(); - - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - - Ok(js_buffer) - } - Err(err) => cx.throw_error(err.to_string()), - }); + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); Ok(promise) } diff --git a/packages/cubejs-backend-native/src/node_obj_deserializer.rs b/packages/cubejs-backend-native/src/node_obj_deserializer.rs index c30d86796a559..3b666599e568f 100644 --- a/packages/cubejs-backend-native/src/node_obj_deserializer.rs +++ b/packages/cubejs-backend-native/src/node_obj_deserializer.rs @@ -255,8 +255,7 @@ impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> { forward_to_deserialize_any! { bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string - bytes byte_buf - identifier ignored_any + bytes byte_buf identifier ignored_any } } From 3f3540e3dd5881b70e4124922d31a2d7a07cb8f1 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 12:21:33 +0200 Subject: [PATCH 060/128] =?UTF-8?q?a=20bit=20of=C2=A0refactoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/src/node_export.rs | 2 +- rust/cubeorchestrator/src/cubestore_message_parser.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index f7af6da7c8865..c9dcfacc8a32c 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -540,7 +540,7 @@ fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult Ok(cx.boxed(Arc::new(result))), Err(err) => cx.throw_error(err.to_string()), diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 4f768bd3fb51b..447aa6acf5a06 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -36,7 +36,7 @@ pub struct CubeStoreResult { impl Finalize for CubeStoreResult {} impl CubeStoreResult { - pub fn new(msg_data: &[u8]) -> Result { + pub fn from_fb(msg_data: &[u8]) -> Result { let mut result = CubeStoreResult { columns: vec![], rows: vec![], From 76c96dce53e1475cd041e48f38b5fb1577dddccf Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 12:36:39 +0200 Subject: [PATCH 061/128] code rearrangement --- packages/cubejs-backend-native/src/lib.rs | 1 + .../cubejs-backend-native/src/node_export.rs | 241 +---------------- .../cubejs-backend-native/src/orchestrator.rs | 249 ++++++++++++++++++ 3 files changed, 251 insertions(+), 240 deletions(-) create mode 100644 packages/cubejs-backend-native/src/orchestrator.rs diff --git a/packages/cubejs-backend-native/src/lib.rs b/packages/cubejs-backend-native/src/lib.rs index 4c9f442629600..68285075541b6 100644 --- a/packages/cubejs-backend-native/src/lib.rs +++ b/packages/cubejs-backend-native/src/lib.rs @@ -13,6 +13,7 @@ pub mod logger; pub mod node_export; pub mod node_obj_deserializer; pub mod node_obj_serializer; +pub mod orchestrator; #[cfg(feature = "python")] pub mod python; pub mod stream; diff --git a/packages/cubejs-backend-native/src/node_export.rs b/packages/cubejs-backend-native/src/node_export.rs index c9dcfacc8a32c..5d4eb733206c6 100644 --- a/packages/cubejs-backend-native/src/node_export.rs +++ b/packages/cubejs-backend-native/src/node_export.rs @@ -31,19 +31,9 @@ use std::rc::Rc; use std::str::FromStr; use std::sync::Arc; -use cubeorchestrator::cubestore_message_parser::CubeStoreResult; - use cubesql::{telemetry::ReportingLogger, CubeError}; -use crate::node_obj_deserializer::JsValueDeserializer; -use cubeorchestrator::cubestore_result_transform::{ - get_final_cubestore_result_array, RequestResultArray, RequestResultData, - RequestResultDataMulti, TransformedData, -}; -use cubeorchestrator::transport::TransformDataRequest; use neon::prelude::*; -use neon::types::buffer::TypedArray; -use serde::Deserialize; struct SQLInterface { services: Arc, @@ -512,227 +502,6 @@ fn debug_js_to_clrepr_to_js(mut cx: FunctionContext) -> JsResult { arg_clrep.into_js(&mut cx) } -//============ sql orchestrator =================== - -fn json_to_array_buffer<'a, C>( - mut cx: C, - json_data: Result, -) -> JsResult<'a, JsArrayBuffer> -where - C: Context<'a>, -{ - match json_data { - Ok(json_data) => { - let json_bytes = json_data.as_bytes(); - let mut js_buffer = cx.array_buffer(json_bytes.len())?; - { - let buffer = js_buffer.as_mut_slice(&mut cx); - buffer.copy_from_slice(json_bytes); - } - Ok(js_buffer) - } - Err(err) => cx.throw_error(err.to_string()), - } -} - -fn parse_cubestore_ws_result_message(mut cx: FunctionContext) -> JsResult { - let msg = cx.argument::(0)?; - let msg_data = msg.as_slice(&cx).to_vec(); - - let promise = cx - .task(move || CubeStoreResult::from_fb(&msg_data)) - .promise(move |mut cx, res| match res { - Ok(result) => Ok(cx.boxed(Arc::new(result))), - Err(err) => cx.throw_error(err.to_string()), - }); - - Ok(promise) -} - -fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { - let result = cx.argument::>>(0)?; - - let js_array = cx.execute_scoped(|mut cx| { - let js_array = JsArray::new(&mut cx, result.rows.len()); - - for (i, row) in result.rows.iter().enumerate() { - let js_row = cx.execute_scoped(|mut cx| { - 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); - js_row.set(&mut cx, js_key, js_value)?; - } - Ok(js_row) - })?; - - js_array.set(&mut cx, i as u32, js_row)?; - } - - Ok(js_array) - })?; - - Ok(js_array.upcast()) -} - -fn transform_query_data(mut cx: FunctionContext) -> JsResult { - let transform_data_js_object = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); - - let request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let cube_store_result = cx.argument::>>(1)?; - let cube_store_result = Arc::clone(&cube_store_result); - - let promise = cx - .task(move || { - let transformed = TransformedData::transform(&request_data, &cube_store_result)?; - - match serde_json::to_string(&transformed) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |mut cx, json_data| match json_data { - Ok(json_data) => { - let js_string = cx.string(json_data); - - let js_result = cx.empty_object(); - js_result.set(&mut cx, "result", js_string)?; - - Ok(js_result) - } - Err(err) => cx.throw_error(err.to_string()), - }); - - Ok(promise) -} - -fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { - let transform_data_js_object = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); - let transform_request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) - { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let cube_store_result = cx.argument::>>(1)?; - let cube_store_result = Arc::clone(&cube_store_result); - let result_data_js_object = cx.argument::(2)?; - let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); - let mut result_data: RequestResultData = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let promise = cx - .task(move || { - result_data.prepare_results(&transform_request_data, &cube_store_result)?; - - match serde_json::to_string(&result_data) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); - - Ok(promise) -} - -fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { - let transform_data_array = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); - let transform_requests: Vec = match Deserialize::deserialize(deserializer) - { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let cube_store_array = cx.argument::(1)?; - let cube_store_results_boxed: Vec>>> = cube_store_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) - .collect::>()?; - let cube_store_results: Vec> = cube_store_results_boxed - .iter() - .map(|handle| (**handle).clone()) - .collect(); - - let results_data_array = cx.argument::(2)?; - let deserializer = JsValueDeserializer::new(&mut cx, results_data_array); - let mut request_results: Vec = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let promise = cx - .task(move || { - get_final_cubestore_result_array( - &transform_requests, - &cube_store_results, - &mut request_results, - )?; - - let final_obj = RequestResultArray { - results: request_results, - }; - - match serde_json::to_string(&final_obj) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); - - Ok(promise) -} - -fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { - let transform_data_array = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); - let transform_requests: Vec = match Deserialize::deserialize(deserializer) - { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let cube_store_array = cx.argument::(1)?; - let cube_store_results_boxed: Vec>>> = cube_store_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) - .collect::>()?; - let cube_store_results: Vec> = cube_store_results_boxed - .iter() - .map(|handle| (**handle).clone()) - .collect(); - - let result_data_js_object = cx.argument::(2)?; - let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); - let mut result_data: RequestResultDataMulti = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let promise = cx - .task(move || { - result_data.prepare_results(&transform_requests, &cube_store_results)?; - - match serde_json::to_string(&result_data) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); - - Ok(promise) -} - pub fn register_module_exports( mut cx: ModuleContext, ) -> NeonResult<()> { @@ -747,15 +516,7 @@ pub fn register_module_exports( cx.export_function("buildSqlAndParams", build_sql_and_params)?; //========= sql orchestrator exports ================= - cx.export_function( - "parseCubestoreResultMessage", - parse_cubestore_ws_result_message, - )?; - cx.export_function("getCubestoreResult", get_cubestore_result)?; - cx.export_function("transformQueryData", transform_query_data)?; - cx.export_function("getFinalCubestoreResult", final_cubestore_result)?; - cx.export_function("getFinalCubestoreResultMulti", final_cubestore_result_multi)?; - cx.export_function("getFinalCubestoreResultArray", final_cubestore_result_array)?; + crate::orchestrator::register_module(&mut cx)?; crate::template::template_register_module(&mut cx)?; diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs new file mode 100644 index 0000000000000..ba099134c6c8c --- /dev/null +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -0,0 +1,249 @@ +use crate::node_obj_deserializer::JsValueDeserializer; +use cubeorchestrator::cubestore_message_parser::CubeStoreResult; +use cubeorchestrator::cubestore_result_transform::{ + get_final_cubestore_result_array, RequestResultArray, RequestResultData, + RequestResultDataMulti, TransformedData, +}; +use cubeorchestrator::transport::TransformDataRequest; +use neon::context::{Context, FunctionContext, ModuleContext}; +use neon::handle::Handle; +use neon::object::Object; +use neon::prelude::{ + JsArray, JsArrayBuffer, JsBox, JsBuffer, JsObject, JsPromise, JsResult, JsValue, NeonResult, +}; +use neon::types::buffer::TypedArray; +use serde::Deserialize; +use std::sync::Arc; + +pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { + cx.export_function( + "parseCubestoreResultMessage", + parse_cubestore_result_message, + )?; + cx.export_function("getCubestoreResult", get_cubestore_result)?; + cx.export_function("transformQueryData", transform_query_data)?; + cx.export_function("getFinalCubestoreResult", final_cubestore_result)?; + cx.export_function("getFinalCubestoreResultMulti", final_cubestore_result_multi)?; + cx.export_function("getFinalCubestoreResultArray", final_cubestore_result_array)?; + + Ok(()) +} + +fn json_to_array_buffer<'a, C>( + mut cx: C, + json_data: Result, +) -> JsResult<'a, JsArrayBuffer> +where + C: Context<'a>, +{ + match json_data { + Ok(json_data) => { + let json_bytes = json_data.as_bytes(); + let mut js_buffer = cx.array_buffer(json_bytes.len())?; + { + let buffer = js_buffer.as_mut_slice(&mut cx); + buffer.copy_from_slice(json_bytes); + } + Ok(js_buffer) + } + Err(err) => cx.throw_error(err.to_string()), + } +} + +pub fn parse_cubestore_result_message(mut cx: FunctionContext) -> JsResult { + let msg = cx.argument::(0)?; + let msg_data = msg.as_slice(&cx).to_vec(); + + let promise = cx + .task(move || CubeStoreResult::from_fb(&msg_data)) + .promise(move |mut cx, res| match res { + Ok(result) => Ok(cx.boxed(Arc::new(result))), + Err(err) => cx.throw_error(err.to_string()), + }); + + Ok(promise) +} + +pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { + let result = cx.argument::>>(0)?; + + let js_array = cx.execute_scoped(|mut cx| { + let js_array = JsArray::new(&mut cx, result.rows.len()); + + for (i, row) in result.rows.iter().enumerate() { + let js_row = cx.execute_scoped(|mut cx| { + 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); + js_row.set(&mut cx, js_key, js_value)?; + } + Ok(js_row) + })?; + + js_array.set(&mut cx, i as u32, js_row)?; + } + + Ok(js_array) + })?; + + Ok(js_array.upcast()) +} + +pub fn transform_query_data(mut cx: FunctionContext) -> JsResult { + let transform_data_js_object = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); + + let request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let cube_store_result = cx.argument::>>(1)?; + let cube_store_result = Arc::clone(&cube_store_result); + + let promise = cx + .task(move || { + let transformed = TransformedData::transform(&request_data, &cube_store_result)?; + + match serde_json::to_string(&transformed) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |mut cx, json_data| match json_data { + Ok(json_data) => { + let js_string = cx.string(json_data); + + let js_result = cx.empty_object(); + js_result.set(&mut cx, "result", js_string)?; + + Ok(js_result) + } + Err(err) => cx.throw_error(err.to_string()), + }); + + Ok(promise) +} + +pub fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { + let transform_data_js_object = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); + let transform_request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) + { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let cube_store_result = cx.argument::>>(1)?; + let cube_store_result = Arc::clone(&cube_store_result); + let result_data_js_object = cx.argument::(2)?; + let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); + let mut result_data: RequestResultData = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let promise = cx + .task(move || { + result_data.prepare_results(&transform_request_data, &cube_store_result)?; + + match serde_json::to_string(&result_data) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); + + Ok(promise) +} + +pub fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { + let transform_data_array = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); + let transform_requests: Vec = match Deserialize::deserialize(deserializer) + { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let cube_store_array = cx.argument::(1)?; + let cube_store_results_boxed: Vec>>> = cube_store_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) + .collect::>()?; + let cube_store_results: Vec> = cube_store_results_boxed + .iter() + .map(|handle| (**handle).clone()) + .collect(); + + let results_data_array = cx.argument::(2)?; + let deserializer = JsValueDeserializer::new(&mut cx, results_data_array); + let mut request_results: Vec = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let promise = cx + .task(move || { + get_final_cubestore_result_array( + &transform_requests, + &cube_store_results, + &mut request_results, + )?; + + let final_obj = RequestResultArray { + results: request_results, + }; + + match serde_json::to_string(&final_obj) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); + + Ok(promise) +} + +pub fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult { + let transform_data_array = cx.argument::(0)?; + let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); + let transform_requests: Vec = match Deserialize::deserialize(deserializer) + { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let cube_store_array = cx.argument::(1)?; + let cube_store_results_boxed: Vec>>> = cube_store_array + .to_vec(&mut cx)? + .into_iter() + .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) + .collect::>()?; + let cube_store_results: Vec> = cube_store_results_boxed + .iter() + .map(|handle| (**handle).clone()) + .collect(); + + let result_data_js_object = cx.argument::(2)?; + let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); + let mut result_data: RequestResultDataMulti = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(err) => return cx.throw_error(err.to_string()), + }; + + let promise = cx + .task(move || { + result_data.prepare_results(&transform_requests, &cube_store_results)?; + + match serde_json::to_string(&result_data) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); + + Ok(promise) +} From f6756a0f835330c2a2026024aa6d349b0c243b75 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 13:45:09 +0200 Subject: [PATCH 062/128] =?UTF-8?q?switch=20to=C2=A0use=20DBResponsePrimit?= =?UTF-8?q?ive=20instead=20of=C2=A0just=20Strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cubejs-backend-native/src/orchestrator.rs | 2 +- .../src/cubestore_message_parser.rs | 11 +++- .../src/cubestore_result_transform.rs | 51 ++++++++++++------- rust/cubeorchestrator/src/transport.rs | 25 ++++++++- 4 files changed, 65 insertions(+), 24 deletions(-) diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index ba099134c6c8c..861a36e4d4ce7 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -75,7 +75,7 @@ pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { 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); + let js_value = cx.string(value.to_string()); js_row.set(&mut cx, js_key, js_value)?; } Ok(js_row) diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index 447aa6acf5a06..bfb94b97b49b6 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,5 +1,7 @@ +use crate::transport::{DBResponsePrimitive, DBResponseValue}; use cubeshared::codegen::{root_as_http_message, HttpCommand}; use neon::prelude::Finalize; +use serde::Deserialize; use std::collections::HashMap; #[derive(Debug)] @@ -27,9 +29,10 @@ impl std::fmt::Display for ParseError { impl std::error::Error for ParseError {} +#[derive(Debug, Clone, Deserialize)] pub struct CubeStoreResult { pub columns: Vec, - pub rows: Vec>, + pub rows: Vec>, pub columns_pos: HashMap, } @@ -83,7 +86,11 @@ impl CubeStoreResult { let values = row.values().ok_or(ParseError::NullRow)?; let row_obj: Vec<_> = values .iter() - .map(|val| val.string_value().unwrap_or("").to_owned()) + .map(|val| { + DBResponseValue::Primitive(DBResponsePrimitive::String( + val.string_value().unwrap_or("").to_owned(), + )) + }) .collect(); result.rows.push(row_obj); diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index cc3205d6c5a09..6fb06338aa1d6 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -1,9 +1,10 @@ use crate::{ cubestore_message_parser::CubeStoreResult, transport::{ - ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, ResultType, - TransformDataRequest, BLENDING_QUERY_KEY_PREFIX, BLENDING_QUERY_RES_SEPARATOR, - COMPARE_DATE_RANGE_FIELD, COMPARE_DATE_RANGE_SEPARATOR, MEMBER_SEPARATOR, + ConfigItem, DBResponsePrimitive, DBResponseValue, MembersMap, NormalizedQuery, + QueryTimeDimension, QueryType, ResultType, TransformDataRequest, BLENDING_QUERY_KEY_PREFIX, + BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, COMPARE_DATE_RANGE_SEPARATOR, + MEMBER_SEPARATOR, }, }; use anyhow::{bail, Context, Result}; @@ -17,18 +18,28 @@ use std::{ }; /// Transform specified `value` with specified `type` to the network protocol type. -pub fn transform_value(value: String, type_: &str) -> String { - if type_ == "time" || type_.is_empty() { - DateTime::parse_from_rfc3339(&value) - .map(|dt| dt.to_rfc3339_opts(SecondsFormat::Millis, true)) - .unwrap_or_else(|_| value) - } else { - value +pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { + match value { + DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { + let formatted = dt.to_rfc3339_opts(SecondsFormat::Millis, true); + DBResponsePrimitive::String(formatted) + } + DBResponseValue::Primitive(DBResponsePrimitive::String(ref s)) if type_ == "time" => { + let formatted = DateTime::parse_from_rfc3339(s) + .map(|dt| dt.to_rfc3339_opts(SecondsFormat::Millis, true)) + .unwrap_or_else(|_| s.clone()); + DBResponsePrimitive::String(formatted) + } + DBResponseValue::Primitive(p) => p, + DBResponseValue::Object { value } => value, + _ => DBResponsePrimitive::Null, } } /// Parse date range value from time dimension. -pub fn get_date_range_value(time_dimensions: Option<&Vec>) -> Result { +pub fn get_date_range_value( + time_dimensions: Option<&Vec>, +) -> Result { let time_dimensions = match time_dimensions { Some(time_dimensions) => time_dimensions, None => bail!("QueryTimeDimension should be specified for the compare date range query."), @@ -51,7 +62,9 @@ pub fn get_date_range_value(time_dimensions: Option<&Vec>) - ); } - Ok(date_range.join(COMPARE_DATE_RANGE_SEPARATOR)) + Ok(DBResponsePrimitive::String( + date_range.join(COMPARE_DATE_RANGE_SEPARATOR), + )) } /// Parse blending query key from time dimension for query. @@ -169,10 +182,10 @@ pub fn get_compact_row( query_type: &QueryType, members: &[String], time_dimensions: Option<&Vec>, - db_row: &[String], + db_row: &[DBResponseValue], columns_pos: &HashMap, -) -> Result> { - let mut row: Vec = Vec::with_capacity(members.len()); +) -> Result> { + let mut row: Vec = Vec::with_capacity(members.len()); for m in members { if let Some(annotation_item) = annotation.get(m) { @@ -217,9 +230,9 @@ pub fn get_vanilla_row( annotation: &HashMap, query_type: &QueryType, query: &NormalizedQuery, - db_row: &[String], + db_row: &[DBResponseValue], columns_pos: &HashMap, -) -> Result> { +) -> Result> { let mut row = HashMap::new(); for (alias, &index) in columns_pos { @@ -379,9 +392,9 @@ pub fn get_final_cubestore_result_array( pub enum TransformedData { Compact { members: Vec, - dataset: Vec>, + dataset: Vec>, }, - Vanilla(Vec>), + Vanilla(Vec>), } impl TransformedData { diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 08033e984326b..6e03e27470dee 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -9,7 +9,6 @@ pub const BLENDING_QUERY_KEY_PREFIX: &str = "time."; pub const BLENDING_QUERY_RES_SEPARATOR: &str = "."; pub const MEMBER_SEPARATOR: &str = "."; -// TODO: Seems to be unused #[derive(Debug, Clone, Serialize, Deserialize)] pub enum DBResponsePrimitive { Null, @@ -18,7 +17,18 @@ pub enum DBResponsePrimitive { String(String), } -// TODO: Seems to be unused +impl Display for DBResponsePrimitive { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { + DBResponsePrimitive::Null => "null".to_string(), + DBResponsePrimitive::Boolean(b) => b.to_string(), + DBResponsePrimitive::Number(n) => n.to_string(), + DBResponsePrimitive::String(s) => s.clone(), + }; + write!(f, "{}", str) + } +} + #[derive(Debug, Clone, Deserialize)] pub enum DBResponseValue { DateTime(DateTime), @@ -27,6 +37,17 @@ pub enum DBResponseValue { Object { value: DBResponsePrimitive }, } +impl Display for DBResponseValue { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { + DBResponseValue::DateTime(dt) => dt.to_rfc3339(), + DBResponseValue::Primitive(p) => p.to_string(), + DBResponseValue::Object { value } => value.to_string(), + }; + write!(f, "{}", str) + } +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub enum ResultType { #[serde(rename = "default")] From c9f0a6f99e6c342b3db9cda6d8f1468d75fc5bdc Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 13:48:34 +0200 Subject: [PATCH 063/128] refactoring --- .../src/cubestore_message_parser.rs | 2 +- .../src/cubestore_result_transform.rs | 54 +++++++++++++++++-- rust/cubeorchestrator/src/transport.rs | 46 ---------------- 3 files changed, 50 insertions(+), 52 deletions(-) diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/cubestore_message_parser.rs index bfb94b97b49b6..2be4df110a251 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/cubestore_message_parser.rs @@ -1,4 +1,4 @@ -use crate::transport::{DBResponsePrimitive, DBResponseValue}; +use crate::cubestore_result_transform::{DBResponsePrimitive, DBResponseValue}; use cubeshared::codegen::{root_as_http_message, HttpCommand}; use neon::prelude::Finalize; use serde::Deserialize; diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/cubestore_result_transform.rs index 6fb06338aa1d6..3dc1c5ef01d16 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/cubestore_result_transform.rs @@ -1,22 +1,27 @@ use crate::{ cubestore_message_parser::CubeStoreResult, transport::{ - ConfigItem, DBResponsePrimitive, DBResponseValue, MembersMap, NormalizedQuery, - QueryTimeDimension, QueryType, ResultType, TransformDataRequest, BLENDING_QUERY_KEY_PREFIX, - BLENDING_QUERY_RES_SEPARATOR, COMPARE_DATE_RANGE_FIELD, COMPARE_DATE_RANGE_SEPARATOR, - MEMBER_SEPARATOR, + ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, ResultType, + TransformDataRequest, }, }; use anyhow::{bail, Context, Result}; -use chrono::{DateTime, SecondsFormat}; +use chrono::{DateTime, SecondsFormat, Utc}; use itertools::multizip; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::{ collections::{HashMap, HashSet}, + fmt::Display, sync::Arc, }; +pub const COMPARE_DATE_RANGE_FIELD: &str = "compareDateRange"; +pub const COMPARE_DATE_RANGE_SEPARATOR: &str = " - "; +pub const BLENDING_QUERY_KEY_PREFIX: &str = "time."; +pub const BLENDING_QUERY_RES_SEPARATOR: &str = "."; +pub const MEMBER_SEPARATOR: &str = "."; + /// Transform specified `value` with specified `type` to the network protocol type. pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { match value { @@ -542,3 +547,42 @@ impl RequestResultData { pub struct RequestResultArray { pub results: Vec, } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum DBResponsePrimitive { + Null, + Boolean(bool), + Number(f64), + String(String), +} + +impl Display for DBResponsePrimitive { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { + DBResponsePrimitive::Null => "null".to_string(), + DBResponsePrimitive::Boolean(b) => b.to_string(), + DBResponsePrimitive::Number(n) => n.to_string(), + DBResponsePrimitive::String(s) => s.clone(), + }; + write!(f, "{}", str) + } +} + +#[derive(Debug, Clone, Deserialize)] +pub enum DBResponseValue { + DateTime(DateTime), + Primitive(DBResponsePrimitive), + // TODO: Is this variant still used? + Object { value: DBResponsePrimitive }, +} + +impl Display for DBResponseValue { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { + DBResponseValue::DateTime(dt) => dt.to_rfc3339(), + DBResponseValue::Primitive(p) => p.to_string(), + DBResponseValue::Object { value } => value.to_string(), + }; + write!(f, "{}", str) + } +} diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 6e03e27470dee..77d4c409e7151 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -1,53 +1,7 @@ -use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::{collections::HashMap, fmt::Display}; -pub const COMPARE_DATE_RANGE_FIELD: &str = "compareDateRange"; -pub const COMPARE_DATE_RANGE_SEPARATOR: &str = " - "; -pub const BLENDING_QUERY_KEY_PREFIX: &str = "time."; -pub const BLENDING_QUERY_RES_SEPARATOR: &str = "."; -pub const MEMBER_SEPARATOR: &str = "."; - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum DBResponsePrimitive { - Null, - Boolean(bool), - Number(f64), - String(String), -} - -impl Display for DBResponsePrimitive { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let str = match self { - DBResponsePrimitive::Null => "null".to_string(), - DBResponsePrimitive::Boolean(b) => b.to_string(), - DBResponsePrimitive::Number(n) => n.to_string(), - DBResponsePrimitive::String(s) => s.clone(), - }; - write!(f, "{}", str) - } -} - -#[derive(Debug, Clone, Deserialize)] -pub enum DBResponseValue { - DateTime(DateTime), - Primitive(DBResponsePrimitive), - // TODO: Is this variant still used? - Object { value: DBResponsePrimitive }, -} - -impl Display for DBResponseValue { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let str = match self { - DBResponseValue::DateTime(dt) => dt.to_rfc3339(), - DBResponseValue::Primitive(p) => p.to_string(), - DBResponseValue::Object { value } => value.to_string(), - }; - write!(f, "{}", str) - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] pub enum ResultType { #[serde(rename = "default")] From 2658a93da9695a3a7528b20c13ecbf979e8b89e3 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 17:38:11 +0200 Subject: [PATCH 064/128] =?UTF-8?q?always=20use=20transform=20data=20nativ?= =?UTF-8?q?e=20for=C2=A0all=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 135 +++++------------- packages/cubejs-backend-native/js/index.ts | 12 +- .../src/node_obj_deserializer.rs | 2 +- .../cubejs-backend-native/src/orchestrator.rs | 88 +++++++----- rust/cubeorchestrator/src/lib.rs | 4 +- ...sage_parser.rs => query_message_parser.rs} | 53 +++++-- ...transform.rs => query_result_transform.rs} | 32 +++-- rust/cubeorchestrator/src/transport.rs | 8 +- 8 files changed, 174 insertions(+), 160 deletions(-) rename rust/cubeorchestrator/src/{cubestore_message_parser.rs => query_message_parser.rs} (70%) rename rust/cubeorchestrator/src/{cubestore_result_transform.rs => query_result_transform.rs} (94%) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 1f903531d3c7b..405bd189c97a0 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -11,9 +11,9 @@ import { QueryAlias, } from '@cubejs-backend/shared'; import { - getFinalCubestoreResult, - getFinalCubestoreResultArray, - getFinalCubestoreResultMulti, + getFinalQueryResult, + getFinalQueryResultArray, + getFinalQueryResultMulti, transformData as transformDataNative, TransformDataResponse } from '@cubejs-backend/native'; @@ -123,10 +123,8 @@ function systemAsyncHandler(handler: (req: Request & { context: ExtendedRequestC function cleanupResult(result) { return { ...result, - dataCb: undefined, rawData: undefined, transformDataParams: undefined, - isNative: undefined, }; } @@ -1647,23 +1645,8 @@ class ApiGateway { }; // We postpone data transformation until the last minute - // in case when all responses are native - we process them in native part - const dataCb: TransformDataResponseCb = response.data.isNative ? - async () => { - const jsonData = await transformDataNative( - transformDataParams, response.data.getNativeRef() - ); - return JSON.parse(jsonData.result) as TransformDataResponse; - } - : - async () => transformData({ - ...transformDataParams, - data: response.data, - }); - return { query: normalizedQuery, - dataCb, rawData: response.data, transformDataParams, lastRefreshTime: response.lastRefreshTime?.toISOString(), @@ -1685,7 +1668,6 @@ class ApiGateway { external: response.external, slowQuery: Boolean(response.slowQuery), total: normalizedQuery.total ? response.total : null, - isNative: response.data.isNative }; } @@ -1844,57 +1826,30 @@ class ApiGateway { context, ); - const allNative = results.every(r => r.isNative); - if (props.queryType === 'multi') { - // If all query results are from Cubestore (are native) - // we prepare the final json result on native side - if (allNative) { - const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[Object[], any[], Object[]]>( - ([transformList, rawList, resultList], r) => { - transformList.push(r.transformDataParams); - rawList.push(r.rawData.getNativeRef()); - resultList.push(cleanupResult(r)); - return [transformList, rawList, resultList]; - }, - [[], [], []] - ); + // We prepare the final json result on native side + const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[Object[], any[], Object[]]>( + ([transformList, rawList, resultList], r) => { + transformList.push(r.transformDataParams); + rawList.push(r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData); + resultList.push(cleanupResult(r)); + return [transformList, rawList, resultList]; + }, + [[], [], []] + ); - const responseDataObj = { - queryType, - results: cleanResultList, - slowQuery - }; + const responseDataObj = { + queryType, + results: cleanResultList, + slowQuery + }; - res(await getFinalCubestoreResultMulti(transformDataJson, rawDataRef, responseDataObj)); - } else { - // if we have mixed query results (there are js and native) - // we prepare results separately: on js and native sides - // and serve final response from JS side - res({ - queryType, - results: await Promise.all(results.map(async (r) => { - const data = await r.dataCb(); - return { - ...cleanupResult(r), - data, - }; - })), - pivotQuery: getPivotQuery(queryType, normalizedQueries), - slowQuery - }); - } - } else if (allNative) { + res(await getFinalQueryResultMulti(transformDataJson, rawDataRef, responseDataObj)); + } else { // We prepare the full final json result on native side const r = results[0]; - const rawDataRef = r.rawData.getNativeRef(); - res(await getFinalCubestoreResult(r.transformDataParams, rawDataRef, cleanupResult(r))); - } else { - const data = await results[0].dataCb(); - res({ - ...cleanupResult(results[0]), - data, - }); + const rawData = r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData; + res(await getFinalQueryResult(r.transformDataParams, rawData, cleanupResult(r))); } } catch (e: any) { this.handleError({ @@ -2024,40 +1979,22 @@ class ApiGateway { }) ); - const allNative = results.every(r => r.isNative); - if (!request.streaming) { - // If all query results are from Cubestore (are native) - // we prepare the final json result on native side - if (allNative) { - const [transformDataJson, rawDataRef, resultDataJson] = (results as { - transformDataParams: any; - rawData: { getNativeRef: () => any }; - }[]).reduce<[Object[], any[], Object[]]>( - ([transformList, rawList, resultList], r) => { - transformList.push(r.transformDataParams); - rawList.push(r.rawData.getNativeRef()); - resultList.push(cleanupResult(r)); - return [transformList, rawList, resultList]; - }, - [[], [], []] - ); + // We prepare the final json result on native side + const [transformDataJson, rawData, resultDataJson] = (results as { + transformDataParams: any; + rawData: { isNative: boolean, getNativeRef: () => any }; + }[]).reduce<[Object[], any[], Object[]]>( + ([transformList, rawList, resultList], r) => { + transformList.push(r.transformDataParams); + rawList.push(r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData); + resultList.push(cleanupResult(r)); + return [transformList, rawList, resultList]; + }, + [[], [], []] + ); - res(await getFinalCubestoreResultArray(transformDataJson, rawDataRef, resultDataJson)); - } else { - // if we have mixed query results (there are js and native) - // we prepare results separately: on js and native sides - // and serve final response from JS side - res({ - results: await Promise.all(results.map(async (r) => { - const data = await r.dataCb(); - return { - ...cleanupResult(r), - data, - }; - })), - }); - } + res(await getFinalQueryResultArray(transformDataJson, rawData, resultDataJson)); } else { res(results[0]); } diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 073055026615f..f07a4fc0ed00b 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -389,22 +389,22 @@ export const transformData = (transformDataObj: Object, rows: any): Promise => { +export const getFinalQueryResult = (transformDataObj: Object, rows: any, resultData: Object): Promise => { const native = loadNative(); - return native.getFinalCubestoreResult(transformDataObj, rows, resultData); + return native.getFinalQueryResult(transformDataObj, rows, resultData); }; -export const getFinalCubestoreResultArray = (transformDataArr: Object[], rows: any[], resultDataArr: Object[]): Promise => { +export const getFinalQueryResultArray = (transformDataArr: Object[], rows: any[], resultDataArr: Object[]): Promise => { const native = loadNative(); - return native.getFinalCubestoreResultArray(transformDataArr, rows, resultDataArr); + return native.getFinalQueryResultArray(transformDataArr, rows, resultDataArr); }; -export const getFinalCubestoreResultMulti = (transformDataArr: Object[], rows: any[], responseData: Object): Promise => { +export const getFinalQueryResultMulti = (transformDataArr: Object[], rows: any[], responseData: Object): Promise => { const native = loadNative(); - return native.getFinalCubestoreResultMulti(transformDataArr, rows, responseData); + return native.getFinalQueryResultMulti(transformDataArr, rows, responseData); }; export interface PyConfiguration { diff --git a/packages/cubejs-backend-native/src/node_obj_deserializer.rs b/packages/cubejs-backend-native/src/node_obj_deserializer.rs index 3b666599e568f..95787b4275665 100644 --- a/packages/cubejs-backend-native/src/node_obj_deserializer.rs +++ b/packages/cubejs-backend-native/src/node_obj_deserializer.rs @@ -103,7 +103,7 @@ impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> { } Err(JsDeserializationError( - "Unsupported type for deserialization".to_string(), + "Unsupported number type for deserialization".to_string(), )) } else if self.value.is_a::(self.cx) { let value = self diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index 861a36e4d4ce7..95854cbd50950 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -1,10 +1,10 @@ use crate::node_obj_deserializer::JsValueDeserializer; -use cubeorchestrator::cubestore_message_parser::CubeStoreResult; -use cubeorchestrator::cubestore_result_transform::{ +use cubeorchestrator::query_message_parser::QueryResult; +use cubeorchestrator::query_result_transform::{ get_final_cubestore_result_array, RequestResultArray, RequestResultData, RequestResultDataMulti, TransformedData, }; -use cubeorchestrator::transport::TransformDataRequest; +use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; use neon::context::{Context, FunctionContext, ModuleContext}; use neon::handle::Handle; use neon::object::Object; @@ -22,9 +22,9 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { )?; cx.export_function("getCubestoreResult", get_cubestore_result)?; cx.export_function("transformQueryData", transform_query_data)?; - cx.export_function("getFinalCubestoreResult", final_cubestore_result)?; - cx.export_function("getFinalCubestoreResultMulti", final_cubestore_result_multi)?; - cx.export_function("getFinalCubestoreResultArray", final_cubestore_result_array)?; + cx.export_function("getFinalQueryResult", final_query_result)?; + cx.export_function("getFinalQueryResultMulti", final_query_result_multi)?; + cx.export_function("getFinalQueryResultArray", final_query_result_array)?; Ok(()) } @@ -50,12 +50,32 @@ where } } +fn extract_query_result( + cx: &mut FunctionContext<'_>, + data_arg: Handle, +) -> Result, anyhow::Error> { + if let Ok(js_box) = data_arg.downcast::>, _>(cx) { + Ok(Arc::clone(&js_box)) + } else if let Ok(js_array) = data_arg.downcast::(cx) { + let deserializer = JsValueDeserializer::new(cx, js_array.upcast()); + let js_raw_data: JsRawData = Deserialize::deserialize(deserializer)?; + + QueryResult::from_js_raw_data(js_raw_data) + .map(Arc::new) + .map_err(anyhow::Error::from) + } else { + Err(anyhow::anyhow!( + "Second argument must be an Array of JsBox> or JsArray" + )) + } +} + pub fn parse_cubestore_result_message(mut cx: FunctionContext) -> JsResult { let msg = cx.argument::(0)?; let msg_data = msg.as_slice(&cx).to_vec(); let promise = cx - .task(move || CubeStoreResult::from_fb(&msg_data)) + .task(move || QueryResult::from_cubestore_fb(&msg_data)) .promise(move |mut cx, res| match res { Ok(result) => Ok(cx.boxed(Arc::new(result))), Err(err) => cx.throw_error(err.to_string()), @@ -65,7 +85,7 @@ pub fn parse_cubestore_result_message(mut cx: FunctionContext) -> JsResult JsResult { - let result = cx.argument::>>(0)?; + let result = cx.argument::>>(0)?; let js_array = cx.execute_scoped(|mut cx| { let js_array = JsArray::new(&mut cx, result.rows.len()); @@ -99,7 +119,7 @@ pub fn transform_query_data(mut cx: FunctionContext) -> JsResult { Err(err) => return cx.throw_error(err.to_string()), }; - let cube_store_result = cx.argument::>>(1)?; + let cube_store_result = cx.argument::>>(1)?; let cube_store_result = Arc::clone(&cube_store_result); let promise = cx @@ -126,7 +146,7 @@ pub fn transform_query_data(mut cx: FunctionContext) -> JsResult { Ok(promise) } -pub fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { +pub fn final_query_result(mut cx: FunctionContext) -> JsResult { let transform_data_js_object = cx.argument::(0)?; let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); let transform_request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) @@ -135,8 +155,12 @@ pub fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Err(err) => return cx.throw_error(err.to_string()), }; - let cube_store_result = cx.argument::>>(1)?; - let cube_store_result = Arc::clone(&cube_store_result); + let data_arg = cx.argument::(1)?; + let cube_store_result: Arc = match extract_query_result(&mut cx, data_arg) { + Ok(query_result) => query_result, + Err(err) => return cx.throw_error(err.to_string()), + }; + let result_data_js_object = cx.argument::(2)?; let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); let mut result_data: RequestResultData = match Deserialize::deserialize(deserializer) { @@ -158,7 +182,7 @@ pub fn final_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(promise) } -pub fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult { +pub fn final_query_result_array(mut cx: FunctionContext) -> JsResult { let transform_data_array = cx.argument::(0)?; let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); let transform_requests: Vec = match Deserialize::deserialize(deserializer) @@ -167,16 +191,14 @@ pub fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult return cx.throw_error(err.to_string()), }; - let cube_store_array = cx.argument::(1)?; - let cube_store_results_boxed: Vec>>> = cube_store_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) - .collect::>()?; - let cube_store_results: Vec> = cube_store_results_boxed - .iter() - .map(|handle| (**handle).clone()) - .collect(); + let data_array = cx.argument::(1)?; + let mut cube_store_results: Vec> = vec![]; + for data_arg in data_array.to_vec(&mut cx)? { + match extract_query_result(&mut cx, data_arg) { + Ok(query_result) => cube_store_results.push(query_result), + Err(err) => return cx.throw_error(err.to_string()), + }; + } let results_data_array = cx.argument::(2)?; let deserializer = JsValueDeserializer::new(&mut cx, results_data_array); @@ -207,7 +229,7 @@ pub fn final_cubestore_result_array(mut cx: FunctionContext) -> JsResult JsResult { +pub fn final_query_result_multi(mut cx: FunctionContext) -> JsResult { let transform_data_array = cx.argument::(0)?; let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); let transform_requests: Vec = match Deserialize::deserialize(deserializer) @@ -216,16 +238,14 @@ pub fn final_cubestore_result_multi(mut cx: FunctionContext) -> JsResult return cx.throw_error(err.to_string()), }; - let cube_store_array = cx.argument::(1)?; - let cube_store_results_boxed: Vec>>> = cube_store_array - .to_vec(&mut cx)? - .into_iter() - .map(|js_value| js_value.downcast_or_throw::>, _>(&mut cx)) - .collect::>()?; - let cube_store_results: Vec> = cube_store_results_boxed - .iter() - .map(|handle| (**handle).clone()) - .collect(); + let data_array = cx.argument::(1)?; + let mut cube_store_results: Vec> = vec![]; + for data_arg in data_array.to_vec(&mut cx)? { + match extract_query_result(&mut cx, data_arg) { + Ok(query_result) => cube_store_results.push(query_result), + Err(err) => return cx.throw_error(err.to_string()), + }; + } let result_data_js_object = cx.argument::(2)?; let deserializer = JsValueDeserializer::new(&mut cx, result_data_js_object); diff --git a/rust/cubeorchestrator/src/lib.rs b/rust/cubeorchestrator/src/lib.rs index 6532689df15d9..03f0453c16db7 100644 --- a/rust/cubeorchestrator/src/lib.rs +++ b/rust/cubeorchestrator/src/lib.rs @@ -1,3 +1,3 @@ -pub mod cubestore_message_parser; -pub mod cubestore_result_transform; +pub mod query_message_parser; +pub mod query_result_transform; pub mod transport; diff --git a/rust/cubeorchestrator/src/cubestore_message_parser.rs b/rust/cubeorchestrator/src/query_message_parser.rs similarity index 70% rename from rust/cubeorchestrator/src/cubestore_message_parser.rs rename to rust/cubeorchestrator/src/query_message_parser.rs index 2be4df110a251..a7660cbf501a2 100644 --- a/rust/cubeorchestrator/src/cubestore_message_parser.rs +++ b/rust/cubeorchestrator/src/query_message_parser.rs @@ -1,7 +1,9 @@ -use crate::cubestore_result_transform::{DBResponsePrimitive, DBResponseValue}; +use crate::{ + query_result_transform::{DBResponsePrimitive, DBResponseValue}, + transport::JsRawData, +}; use cubeshared::codegen::{root_as_http_message, HttpCommand}; use neon::prelude::Finalize; -use serde::Deserialize; use std::collections::HashMap; #[derive(Debug)] @@ -29,18 +31,18 @@ impl std::fmt::Display for ParseError { impl std::error::Error for ParseError {} -#[derive(Debug, Clone, Deserialize)] -pub struct CubeStoreResult { +#[derive(Debug, Clone)] +pub struct QueryResult { pub columns: Vec, pub rows: Vec>, pub columns_pos: HashMap, } -impl Finalize for CubeStoreResult {} +impl Finalize for QueryResult {} -impl CubeStoreResult { - pub fn from_fb(msg_data: &[u8]) -> Result { - let mut result = CubeStoreResult { +impl QueryResult { + pub fn from_cubestore_fb(msg_data: &[u8]) -> Result { + let mut result = QueryResult { columns: vec![], rows: vec![], columns_pos: HashMap::new(), @@ -101,4 +103,39 @@ impl CubeStoreResult { _ => Err(ParseError::UnsupportedCommand), } } + + pub fn from_js_raw_data(js_raw_data: JsRawData) -> Result { + if js_raw_data.is_empty() { + return Err(ParseError::EmptyResultSet); + } + + let first_row = &js_raw_data[0]; + let columns: Vec = first_row.keys().cloned().collect(); + let columns_pos: HashMap = columns + .iter() + .enumerate() + .map(|(index, column)| (column.clone(), index)) + .collect(); + + let rows: Vec> = js_raw_data + .into_iter() + .map(|row_map| { + columns + .iter() + .map(|col| { + row_map + .get(col) + .map(|val| DBResponseValue::Primitive(val.clone())) + .unwrap_or(DBResponseValue::Primitive(DBResponsePrimitive::Null)) + }) + .collect() + }) + .collect(); + + Ok(QueryResult { + columns, + rows, + columns_pos, + }) + } } diff --git a/rust/cubeorchestrator/src/cubestore_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs similarity index 94% rename from rust/cubeorchestrator/src/cubestore_result_transform.rs rename to rust/cubeorchestrator/src/query_result_transform.rs index 3dc1c5ef01d16..328cb68b4b8ef 100644 --- a/rust/cubeorchestrator/src/cubestore_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -1,5 +1,5 @@ use crate::{ - cubestore_message_parser::CubeStoreResult, + query_message_parser::QueryResult, transport::{ ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, ResultType, TransformDataRequest, @@ -115,7 +115,7 @@ pub fn get_blending_response_key( pub fn get_members( query_type: &QueryType, query: &NormalizedQuery, - db_data: &CubeStoreResult, + db_data: &QueryResult, alias_to_member_name_map: &HashMap, annotation: &HashMap, ) -> Result { @@ -337,13 +337,19 @@ pub fn get_pivot_query( let mut merged_dimensions = HashSet::new(); for query in queries { - merged_measures.extend(query.measures.iter().cloned()); + if let Some(measures) = &query.measures { + merged_measures.extend(measures.iter().cloned()); + } if let Some(dimensions) = &query.dimensions { merged_dimensions.extend(dimensions.iter().cloned()); } } - pivot_query.measures = merged_measures.into_iter().collect(); + pivot_query.measures = if !merged_measures.is_empty() { + Some(merged_measures.into_iter().collect()) + } else { + None + }; pivot_query.dimensions = if !merged_dimensions.is_empty() { Some(merged_dimensions.into_iter().collect()) } else { @@ -378,7 +384,7 @@ pub fn get_pivot_query( pub fn get_final_cubestore_result_array( transform_requests: &[TransformDataRequest], - cube_store_results: &[Arc], + cube_store_results: &[Arc], result_data: &mut [RequestResultData], ) -> Result<()> { for (transform_data, cube_store_result, result) in multizip(( @@ -406,7 +412,7 @@ impl TransformedData { /// Transforms queried data array to the output format. pub fn transform( request_data: &TransformDataRequest, - cube_store_result: &CubeStoreResult, + cube_store_result: &QueryResult, ) -> Result { let alias_to_member_name_map = &request_data.alias_to_member_name_map; let annotation = &request_data.annotation; @@ -469,6 +475,7 @@ pub struct RequestResultDataMulti { pub query_type: QueryType, pub results: Vec, #[serde(rename = "pivotQuery")] + #[serde(skip_serializing_if = "Option::is_none")] pub pivot_query: Option, #[serde(rename = "slowQuery")] pub slow_query: bool, @@ -480,7 +487,7 @@ impl RequestResultDataMulti { pub fn prepare_results( &mut self, request_data: &[TransformDataRequest], - cube_store_result: &[Arc], + cube_store_result: &[Arc], ) -> Result<()> { for (transform_data, cube_store_result, result) in multizip(( request_data.iter(), @@ -506,14 +513,19 @@ impl RequestResultDataMulti { pub struct RequestResultData { pub query: NormalizedQuery, #[serde(rename = "lastRefreshTime")] + #[serde(skip_serializing_if = "Option::is_none")] pub last_refresh_time: Option, #[serde(rename = "refreshKeyValues")] + #[serde(skip_serializing_if = "Option::is_none")] pub refresh_key_values: Option, #[serde(rename = "usedPreAggregations")] + #[serde(skip_serializing_if = "Option::is_none")] pub used_pre_aggregations: Option, #[serde(rename = "transformedQuery")] + #[serde(skip_serializing_if = "Option::is_none")] pub transformed_query: Option, #[serde(rename = "requestId")] + #[serde(skip_serializing_if = "Option::is_none")] pub request_id: Option, pub annotation: HashMap>, #[serde(rename = "dataSource")] @@ -521,11 +533,14 @@ pub struct RequestResultData { #[serde(rename = "dbType")] pub db_type: String, #[serde(rename = "extDbType")] + #[serde(skip_serializing_if = "Option::is_none")] pub ext_db_type: Option, pub external: bool, #[serde(rename = "slowQuery")] pub slow_query: bool, + #[serde(skip_serializing_if = "Option::is_none")] pub total: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub data: Option, } @@ -534,7 +549,7 @@ impl RequestResultData { pub fn prepare_results( &mut self, request_data: &TransformDataRequest, - cube_store_result: &CubeStoreResult, + cube_store_result: &QueryResult, ) -> Result<()> { let transformed = TransformedData::transform(request_data, cube_store_result)?; self.data = Some(transformed); @@ -549,6 +564,7 @@ pub struct RequestResultArray { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] pub enum DBResponsePrimitive { Null, Boolean(bool), diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 77d4c409e7151..1511f7041ba6f 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -1,3 +1,4 @@ +use crate::query_result_transform::DBResponsePrimitive; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::{collections::HashMap, fmt::Display}; @@ -242,15 +243,16 @@ pub struct Query { pub renew_query: Option, #[serde(skip_serializing_if = "Option::is_none")] pub ungrouped: Option, - #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "responseFormat")] + #[serde(skip_serializing_if = "Option::is_none")] pub response_format: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct NormalizedQuery { + #[serde(skip_serializing_if = "Option::is_none")] // pub measures: Vec, - pub measures: Vec, + pub measures: Option>, #[serde(skip_serializing_if = "Option::is_none")] // pub dimensions: Option>, pub dimensions: Option>, @@ -301,3 +303,5 @@ pub struct TransformDataRequest { #[serde(rename = "resType")] pub res_type: Option, } + +pub type JsRawData = Vec>; From e8e4914e705a28314ebb1245906041df21d974d0 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 21:57:57 +0200 Subject: [PATCH 065/128] =?UTF-8?q?fix=20dtos=20for=C2=A0native=20query=20?= =?UTF-8?q?processing=20(thnx=20unit=20tests)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/helpers/toConfigMap.ts | 2 +- .../src/query_result_transform.rs | 33 ++++++++++------- rust/cubeorchestrator/src/transport.rs | 35 +++++++++++++++++-- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/packages/cubejs-api-gateway/src/helpers/toConfigMap.ts b/packages/cubejs-api-gateway/src/helpers/toConfigMap.ts index e95cb8aba0786..5766d0763a847 100644 --- a/packages/cubejs-api-gateway/src/helpers/toConfigMap.ts +++ b/packages/cubejs-api-gateway/src/helpers/toConfigMap.ts @@ -28,7 +28,7 @@ type MetaConfigMap = { }; /** - * Convert cpecified array of MetaConfig objects to the + * Convert specified array of MetaConfig objects to the * MetaConfigMap. */ function toConfigMap(metaConfig: MetaConfig[]): MetaConfigMap { diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 328cb68b4b8ef..2eb566c128dbe 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -1,8 +1,8 @@ use crate::{ query_message_parser::QueryResult, transport::{ - ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, QueryType, ResultType, - TransformDataRequest, + AnnotatedConfigItem, ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, + QueryType, ResultType, TransformDataRequest, }, }; use anyhow::{bail, Context, Result}; @@ -197,7 +197,8 @@ pub fn get_compact_row( if let Some(alias) = members_to_alias_map.get(m) { if let Some(key) = columns_pos.get(alias) { if let Some(value) = db_row.get(*key) { - row.push(transform_value(value.clone(), &annotation_item.member_type)); + let mtype = annotation_item.member_type.as_deref().unwrap_or(""); + row.push(transform_value(value.clone(), mtype)); } } } @@ -214,9 +215,9 @@ pub fn get_compact_row( if let Some(alias) = members_to_alias_map.get(&blending_key) { if let Some(key) = columns_pos.get(alias) { if let Some(value) = db_row.get(*key) { - let member_type = annotation - .get(alias) - .map_or("", |annotation_item| &annotation_item.member_type); + let member_type = annotation.get(alias).map_or("", |annotation_item| { + annotation_item.member_type.as_deref().unwrap_or("") + }); row.push(transform_value(value.clone(), member_type)); } @@ -263,8 +264,13 @@ pub fn get_vanilla_row( } }; - let transformed_value = - transform_value(value.clone(), &annotation_for_member.member_type); + let transformed_value = transform_value( + value.clone(), + annotation_for_member + .member_type + .as_ref() + .unwrap_or(&"".to_string()), + ); // Handle deprecated time dimensions without granularity let path: Vec<&str> = member_name.split(MEMBER_SEPARATOR).collect(); @@ -527,15 +533,18 @@ pub struct RequestResultData { #[serde(rename = "requestId")] #[serde(skip_serializing_if = "Option::is_none")] pub request_id: Option, - pub annotation: HashMap>, + pub annotation: HashMap>, #[serde(rename = "dataSource")] - pub data_source: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub data_source: Option, #[serde(rename = "dbType")] - pub db_type: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub db_type: Option, #[serde(rename = "extDbType")] #[serde(skip_serializing_if = "Option::is_none")] pub ext_db_type: Option, - pub external: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub external: Option, #[serde(rename = "slowQuery")] pub slow_query: bool, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 1511f7041ba6f..13970432d4123 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -118,7 +118,9 @@ pub struct ParsedMemberExpression { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct QueryTimeDimension { pub dimension: String, + #[serde(rename = "dateRange")] pub date_range: Option>, + #[serde(rename = "compareDateRange")] pub compare_date_range: Option>, pub granularity: Option, } @@ -140,13 +142,15 @@ pub struct GranularityMeta { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ConfigItem { - pub title: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, #[serde(skip_serializing_if = "Option::is_none")] pub short_title: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "type")] - pub member_type: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub member_type: Option, #[serde(skip_serializing_if = "Option::is_none")] pub format: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -161,6 +165,31 @@ pub struct ConfigItem { pub granularities: Option>, } +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AnnotatedConfigItem { + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub short_title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "type")] + #[serde(skip_serializing_if = "Option::is_none")] + pub member_type: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub format: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub meta: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "drillMembers")] + pub drill_members: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(rename = "drillMembersGrouped")] + pub drill_members_grouped: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub granularity: Option, +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Order { pub id: String, @@ -172,7 +201,7 @@ pub struct NormalizedQueryFilter { pub member: String, pub operator: FilterOperator, #[serde(skip_serializing_if = "Option::is_none")] - pub values: Option>, + pub values: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub dimension: Option, } From b377e97c8d33574db0c6d03d71f2f32e9164d738 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 21:58:15 +0200 Subject: [PATCH 066/128] cache loadNative --- packages/cubejs-backend-native/js/index.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index f07a4fc0ed00b..e6275c64cfc1e 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -118,14 +118,22 @@ export type TransformDataResponseNative = { result: string }; +let loadedNative: any = null; + export function loadNative() { + if (loadedNative) { + return loadedNative; + } + // Development version if (fs.existsSync(path.join(__dirname, '/../../index.node'))) { - return require(path.join(__dirname, '/../../index.node')); + loadedNative = require(path.join(__dirname, '/../../index.node')); + return loadedNative; } if (fs.existsSync(path.join(__dirname, '/../../native/index.node'))) { - return require(path.join(__dirname, '/../../native/index.node')); + loadedNative = require(path.join(__dirname, '/../../native/index.node')); + return loadedNative; } throw new Error( @@ -133,10 +141,6 @@ export function loadNative() { ); } -export function isSupported(): boolean { - return fs.existsSync(path.join(__dirname, '/../../index.node')) || fs.existsSync(path.join(__dirname, '/../../native/index.node')); -} - function wrapNativeFunctionWithChannelCallback( fn: (extra: any) => unknown | Promise, ) { From 380da29a26b826b7fc677fb6453e52ebab183202 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:01:21 +0200 Subject: [PATCH 067/128] remove not needed anymore native.transformQueryData --- packages/cubejs-api-gateway/src/gateway.ts | 2 - packages/cubejs-backend-native/js/index.ts | 17 -------- .../cubejs-backend-native/src/orchestrator.rs | 40 +------------------ 3 files changed, 1 insertion(+), 58 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 405bd189c97a0..82d44f1994b31 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -14,8 +14,6 @@ import { getFinalQueryResult, getFinalQueryResultArray, getFinalQueryResultMulti, - transformData as transformDataNative, - TransformDataResponse } from '@cubejs-backend/native'; import type { Application as ExpressApplication, diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index e6275c64cfc1e..e08b23f0d6173 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -107,17 +107,6 @@ export type DBResponsePrimitive = number | string; -export type TransformDataResponse = { - members: string[], - dataset: DBResponsePrimitive[][] -} | { - [member: string]: DBResponsePrimitive -}[]; - -export type TransformDataResponseNative = { - result: string -}; - let loadedNative: any = null; export function loadNative() { @@ -387,12 +376,6 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; -export const transformData = (transformDataObj: Object, rows: any): Promise => { - const native = loadNative(); - - return native.transformQueryData(transformDataObj, rows); -}; - export const getFinalQueryResult = (transformDataObj: Object, rows: any, resultData: Object): Promise => { const native = loadNative(); diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index 95854cbd50950..2395a93ff4955 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -1,8 +1,7 @@ use crate::node_obj_deserializer::JsValueDeserializer; use cubeorchestrator::query_message_parser::QueryResult; use cubeorchestrator::query_result_transform::{ - get_final_cubestore_result_array, RequestResultArray, RequestResultData, - RequestResultDataMulti, TransformedData, + get_final_cubestore_result_array, RequestResultArray, RequestResultData, RequestResultDataMulti, }; use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; use neon::context::{Context, FunctionContext, ModuleContext}; @@ -21,7 +20,6 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { parse_cubestore_result_message, )?; cx.export_function("getCubestoreResult", get_cubestore_result)?; - cx.export_function("transformQueryData", transform_query_data)?; cx.export_function("getFinalQueryResult", final_query_result)?; cx.export_function("getFinalQueryResultMulti", final_query_result_multi)?; cx.export_function("getFinalQueryResultArray", final_query_result_array)?; @@ -110,42 +108,6 @@ pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult { Ok(js_array.upcast()) } -pub fn transform_query_data(mut cx: FunctionContext) -> JsResult { - let transform_data_js_object = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); - - let request_data: TransformDataRequest = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let cube_store_result = cx.argument::>>(1)?; - let cube_store_result = Arc::clone(&cube_store_result); - - let promise = cx - .task(move || { - let transformed = TransformedData::transform(&request_data, &cube_store_result)?; - - match serde_json::to_string(&transformed) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |mut cx, json_data| match json_data { - Ok(json_data) => { - let js_string = cx.string(json_data); - - let js_result = cx.empty_object(); - js_result.set(&mut cx, "result", js_string)?; - - Ok(js_result) - } - Err(err) => cx.throw_error(err.to_string()), - }); - - Ok(promise) -} - pub fn final_query_result(mut cx: FunctionContext) -> JsResult { let transform_data_js_object = cx.argument::(0)?; let deserializer = JsValueDeserializer::new(&mut cx, transform_data_js_object); From 9a0230f85faf3742341bdb016e6f4cfa0ad6946c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:19:54 +0200 Subject: [PATCH 068/128] =?UTF-8?q?add=20Build=20native=20for=C2=A0unit=20?= =?UTF-8?q?tests=20in=C2=A0CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 057532433495d..c5af396bfd84f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -95,6 +95,8 @@ 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) From c4d8bffb9935a573bd69c9aa9f130a9e77955461 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:28:52 +0200 Subject: [PATCH 069/128] refactor serde annotations --- .../src/query_result_transform.rs | 14 +--- rust/cubeorchestrator/src/transport.rs | 64 ++++--------------- 2 files changed, 16 insertions(+), 62 deletions(-) diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 2eb566c128dbe..d97264149881d 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -476,14 +476,12 @@ impl TransformedData { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct RequestResultDataMulti { - #[serde(rename = "queryType")] pub query_type: QueryType, pub results: Vec, - #[serde(rename = "pivotQuery")] #[serde(skip_serializing_if = "Option::is_none")] pub pivot_query: Option, - #[serde(rename = "slowQuery")] pub slow_query: bool, } @@ -516,36 +514,28 @@ impl RequestResultDataMulti { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct RequestResultData { pub query: NormalizedQuery, - #[serde(rename = "lastRefreshTime")] #[serde(skip_serializing_if = "Option::is_none")] pub last_refresh_time: Option, - #[serde(rename = "refreshKeyValues")] #[serde(skip_serializing_if = "Option::is_none")] pub refresh_key_values: Option, - #[serde(rename = "usedPreAggregations")] #[serde(skip_serializing_if = "Option::is_none")] pub used_pre_aggregations: Option, - #[serde(rename = "transformedQuery")] #[serde(skip_serializing_if = "Option::is_none")] pub transformed_query: Option, - #[serde(rename = "requestId")] #[serde(skip_serializing_if = "Option::is_none")] pub request_id: Option, pub annotation: HashMap>, - #[serde(rename = "dataSource")] #[serde(skip_serializing_if = "Option::is_none")] pub data_source: Option, - #[serde(rename = "dbType")] #[serde(skip_serializing_if = "Option::is_none")] pub db_type: Option, - #[serde(rename = "extDbType")] #[serde(skip_serializing_if = "Option::is_none")] pub ext_db_type: Option, #[serde(skip_serializing_if = "Option::is_none")] pub external: Option, - #[serde(rename = "slowQuery")] pub slow_query: bool, #[serde(skip_serializing_if = "Option::is_none")] pub total: Option, diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 13970432d4123..506eeced0eec3 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -4,21 +4,18 @@ use serde_json::Value; use std::{collections::HashMap, fmt::Display}; #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum ResultType { - #[serde(rename = "default")] Default, - #[serde(rename = "compact")] Compact, } #[derive(Default, Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum QueryType { - #[serde(rename = "regularQuery")] #[default] RegularQuery, - #[serde(rename = "compareDateRangeQuery")] CompareDateRangeQuery, - #[serde(rename = "blendingQuery")] BlendingQuery, } @@ -34,56 +31,35 @@ impl Display for QueryType { } #[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum MemberType { - #[serde(rename = "measures")] Measures, - #[serde(rename = "dimensions")] Dimensions, - #[serde(rename = "segments")] Segments, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub enum FilterOperator { - #[serde(rename = "equals")] Equals, - #[serde(rename = "notEquals")] NotEquals, - #[serde(rename = "contains")] Contains, - #[serde(rename = "notContains")] NotContains, - #[serde(rename = "in")] In, - #[serde(rename = "notIn")] NotIn, - #[serde(rename = "gt")] Gt, - #[serde(rename = "gte")] Gte, - #[serde(rename = "lt")] Lt, - #[serde(rename = "lte")] Lte, - #[serde(rename = "set")] Set, - #[serde(rename = "notSet")] NotSet, - #[serde(rename = "inDateRange")] InDateRange, - #[serde(rename = "notInDateRange")] NotInDateRange, - #[serde(rename = "onTheDate")] OnTheDate, - #[serde(rename = "beforeDate")] BeforeDate, - #[serde(rename = "beforeOrOnDate")] BeforeOrOnDate, - #[serde(rename = "afterDate")] AfterDate, - #[serde(rename = "afterOrOnDate")] AfterOrOnDate, - #[serde(rename = "measureFilter")] MeasureFilter, } @@ -95,6 +71,7 @@ pub struct QueryFilter { } #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] pub struct GroupingSet { pub group_type: String, pub id: u32, @@ -102,25 +79,22 @@ pub struct GroupingSet { } #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] pub struct ParsedMemberExpression { pub expression: Vec, - #[serde(rename = "cubeName")] pub cube_name: String, pub name: String, - #[serde(rename = "expressionName")] pub expression_name: String, pub definition: String, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "groupingSet")] pub grouping_set: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct QueryTimeDimension { pub dimension: String, - #[serde(rename = "dateRange")] pub date_range: Option>, - #[serde(rename = "compareDateRange")] pub compare_date_range: Option>, pub granularity: Option, } @@ -141,6 +115,7 @@ pub struct GranularityMeta { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct ConfigItem { #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, @@ -156,16 +131,15 @@ pub struct ConfigItem { #[serde(skip_serializing_if = "Option::is_none")] pub meta: Option, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "drillMembers")] pub drill_members: Option>, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "drillMembersGrouped")] pub drill_members_grouped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub granularities: Option>, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct AnnotatedConfigItem { #[serde(skip_serializing_if = "Option::is_none")] pub title: Option, @@ -181,10 +155,8 @@ pub struct AnnotatedConfigItem { #[serde(skip_serializing_if = "Option::is_none")] pub meta: Option, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "drillMembers")] pub drill_members: Option>, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "drillMembersGrouped")] pub drill_members_grouped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub granularity: Option, @@ -209,6 +181,7 @@ pub struct NormalizedQueryFilter { // TODO: Not used, as all members are made as Strings for now // XXX: Omitted function variant #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] +#[serde(untagged)] pub enum MemberOrMemberExpression { Member(String), MemberExpression(ParsedMemberExpression), @@ -240,6 +213,7 @@ pub enum LogicalFilter { } #[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct Query { // pub measures: Vec, pub measures: Vec, @@ -248,7 +222,6 @@ pub struct Query { pub dimensions: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub filters: Option>, - #[serde(rename = "timeDimensions")] #[serde(skip_serializing_if = "Option::is_none")] pub time_dimensions: Option>, #[serde(skip_serializing_if = "Option::is_none")] @@ -261,23 +234,21 @@ pub struct Query { #[serde(skip_serializing_if = "Option::is_none")] pub total: Option, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "totalQuery")] pub total_query: Option, #[serde(skip_serializing_if = "Option::is_none")] pub order: Option, #[serde(skip_serializing_if = "Option::is_none")] pub timezone: Option, - #[serde(rename = "renewQuery")] #[serde(skip_serializing_if = "Option::is_none")] pub renew_query: Option, #[serde(skip_serializing_if = "Option::is_none")] pub ungrouped: Option, - #[serde(rename = "responseFormat")] #[serde(skip_serializing_if = "Option::is_none")] pub response_format: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct NormalizedQuery { #[serde(skip_serializing_if = "Option::is_none")] // pub measures: Vec, @@ -286,7 +257,6 @@ pub struct NormalizedQuery { // pub dimensions: Option>, pub dimensions: Option>, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "timeDimensions")] pub time_dimensions: Option>, // pub segments: Option>, #[serde(skip_serializing_if = "Option::is_none")] @@ -298,38 +268,32 @@ pub struct NormalizedQuery { #[serde(skip_serializing_if = "Option::is_none")] pub total: Option, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "totalQuery")] pub total_query: Option, #[serde(skip_serializing_if = "Option::is_none")] pub timezone: Option, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "renewQuery")] pub renew_query: Option, #[serde(skip_serializing_if = "Option::is_none")] pub ungrouped: Option, - #[serde(rename = "responseFormat")] + #[serde(skip_serializing_if = "Option::is_none")] pub response_format: Option, #[serde(skip_serializing_if = "Option::is_none")] pub filters: Option>, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "rowLimit")] pub row_limit: Option, #[serde(skip_serializing_if = "Option::is_none")] pub order: Option>, #[serde(skip_serializing_if = "Option::is_none")] - #[serde(rename = "queryType")] pub query_type: Option, } #[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] pub struct TransformDataRequest { - #[serde(rename = "aliasToMemberNameMap")] pub alias_to_member_name_map: HashMap, pub annotation: HashMap, pub query: NormalizedQuery, - #[serde(rename = "queryType")] pub query_type: Option, - #[serde(rename = "resType")] pub res_type: Option, } From c828005457a26d2a41efd838305db89c509f4c44 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:33:22 +0200 Subject: [PATCH 070/128] remove unused --- packages/cubejs-api-gateway/src/gateway.ts | 2 -- packages/cubejs-api-gateway/src/types/responses.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 82d44f1994b31..8409f3448a26f 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -87,7 +87,6 @@ import { createJWKsFetcher } from './jwk'; import { SQLServer, SQLServerConstructorOptions } from './sql-server'; import { getJsonQueryFromGraphQLQuery, makeSchema } from './graphql'; import { ConfigItem, prepareAnnotation } from './helpers/prepareAnnotation'; -import transformData from './helpers/transformData'; import { transformCube, transformMeasure, @@ -96,7 +95,6 @@ import { transformJoins, transformPreAggregations, } from './helpers/transformMetaExtended'; -import { TransformDataResponseCb } from './types/responses'; type HandleErrorOptions = { e: any, diff --git a/packages/cubejs-api-gateway/src/types/responses.ts b/packages/cubejs-api-gateway/src/types/responses.ts index aa09b3b2fcfba..d5e1d8ea1e0aa 100644 --- a/packages/cubejs-api-gateway/src/types/responses.ts +++ b/packages/cubejs-api-gateway/src/types/responses.ts @@ -33,5 +33,3 @@ export type TransformDataRequest = { queryType: QueryType, resType?: ResultType }; - -export type TransformDataResponseCb = () => Promise; From aaf9b33f16c81f87da00bd56eb46910ce908e163 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:44:07 +0200 Subject: [PATCH 071/128] annotate native query results processing functions --- packages/cubejs-backend-native/js/index.ts | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index e08b23f0d6173..2f2e3327f9e7f 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -376,18 +376,42 @@ export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => return native.getCubestoreResult(ref); }; +/** + * Transform and prepare single query final result data that is sent to the client. + * + * @param transformDataObj Data needed to transform raw query results + * @param rows Raw data received from the source DB via driver or reference to a native CubeStore response result + * @param resultData Final query result structure without actual data + * @return {Promise} ArrayBuffer with json-serialized data which should be directly sent to the client + */ export const getFinalQueryResult = (transformDataObj: Object, rows: any, resultData: Object): Promise => { const native = loadNative(); return native.getFinalQueryResult(transformDataObj, rows, resultData); }; +/** + * Transform and prepare multiple query final results data that is sent to the client (used in sqlApiLoad). + * + * @param transformDataArr Array of data needed to transform raw query results + * @param rows Array of raw data received from the source DB via driver or reference to native CubeStore response results + * @param resultDataArr Array of final query result structures without actual data + * @return {Promise} ArrayBuffer with json-serialized data which should be directly sent to the client + */ export const getFinalQueryResultArray = (transformDataArr: Object[], rows: any[], resultDataArr: Object[]): Promise => { const native = loadNative(); return native.getFinalQueryResultArray(transformDataArr, rows, resultDataArr); }; +/** + * Transform and prepare multiple query final results data into a single response structure. + * + * @param transformDataArr Array of data needed to transform raw query results + * @param rows Array of raw data received from the source DB via driver or reference to native CubeStore response results + * @param responseData Final combined query result structure without actual data + * @return {Promise} ArrayBuffer with json-serialized data which should be directly sent to the client + */ export const getFinalQueryResultMulti = (transformDataArr: Object[], rows: any[], responseData: Object): Promise => { const native = loadNative(); From a04f1f4693f4dce6f30672faaadb656bb6071674 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 22:47:08 +0200 Subject: [PATCH 072/128] =?UTF-8?q?add=20Build=20native=20for=C2=A0unit=20?= =?UTF-8?q?tests=20in=C2=A0CI=20for=20Debian=20without=20pushing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c5af396bfd84f..53480a93a0492 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -605,6 +605,8 @@ jobs: retry_wait_seconds: 15 timeout_minutes: 20 command: yarn install --frozen-lockfile + - name: Build native (no python) + run: cd packages/cubejs-backend-native && npm run native:build-release - name: Build client run: yarn build - name: Lerna tsc From 5e305a3ad2acf630a0893cf74e4da6d980da7873 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 23:15:58 +0200 Subject: [PATCH 073/128] add few unit tests --- .../test/helpers/transformValue.test.ts | 25 -- .../src/query_result_transform.rs | 294 +++++++++++++++++- 2 files changed, 293 insertions(+), 26 deletions(-) delete mode 100644 packages/cubejs-api-gateway/test/helpers/transformValue.test.ts diff --git a/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts b/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts deleted file mode 100644 index 20637e2fe8dcd..0000000000000 --- a/packages/cubejs-api-gateway/test/helpers/transformValue.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @license Apache-2.0 - * @copyright Cube Dev, Inc. - * @fileoverview transformValue function unit tests. - */ - -/* globals describe,test,expect */ -import moment from 'moment'; - -import { transformValue } from '../../src/helpers/transformData'; - -describe('transformValue helper', () => { - test('object with the time value', () => { - const date = Date(); - expect(transformValue(date, 'time')).toBe( - moment.utc(date).format(moment.HTML5_FMT.DATETIME_LOCAL_MS) - ); - }); - test('object with the Date value', () => { - const date = new Date(); - expect(transformValue(date, 'date')).toBe( - moment(date).format(moment.HTML5_FMT.DATETIME_LOCAL_MS) - ); - }); -}); diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index d97264149881d..db241cd6b17df 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -562,7 +562,7 @@ pub struct RequestResultArray { pub results: Vec, } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(untagged)] pub enum DBResponsePrimitive { Null, @@ -601,3 +601,295 @@ impl Display for DBResponseValue { write!(f, "{}", str) } } + +#[cfg(test)] +mod tests { + use super::*; + use chrono::{TimeZone, Utc, Timelike}; + use anyhow::Result; + + #[test] + fn test_transform_value_datetime_to_time() { + let dt = Utc.with_ymd_and_hms(2024, 1, 1, 12, 30, 15) + .unwrap() + .with_nanosecond(123_000_000) + .unwrap(); + let value = DBResponseValue::DateTime(dt); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.123Z".to_string()) + ); + } + + #[test] + fn test_transform_value_datetime_empty_type() { + let dt = Utc.with_ymd_and_hms(2024, 1, 1, 12, 30, 15) + .unwrap() + .with_nanosecond(123_000_000) + .unwrap(); + let value = DBResponseValue::DateTime(dt); + let result = transform_value(value, ""); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.123Z".to_string()) + ); + } + + #[test] + fn test_transform_value_string_to_time_valid_rfc3339() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "2024-01-01T12:30:15.123Z".to_string(), + )); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.123Z".to_string()) + ); + } + + #[test] + fn test_transform_value_string_to_time_invalid_rfc3339() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "invalid-date".to_string(), + )); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("invalid-date".to_string()) + ); + } + + #[test] + fn test_transform_value_primitive_string_type_not_time() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "some-string".to_string(), + )); + let result = transform_value(value, "other"); + + assert_eq!( + result, + DBResponsePrimitive::String("some-string".to_string()) + ); + } + + #[test] + fn test_transform_value_object() { + let obj_value = DBResponsePrimitive::String("object-value".to_string()); + let value = DBResponseValue::Object { value: obj_value.clone() }; + let result = transform_value(value, "time"); + + assert_eq!(result, obj_value); + } + + #[test] + fn test_transform_value_fallback_to_null() { + let value = DBResponseValue::DateTime(Utc::now()); + let result = transform_value(value, "unknown"); + + assert_eq!(result, DBResponsePrimitive::Null); + } + + #[test] + fn test_get_date_range_value_valid_range() -> Result<()> { + let time_dimensions = vec![QueryTimeDimension { + dimension: "some-dim".to_string(), + date_range: Some(vec![ + "2024-01-01T00:00:00Z".to_string(), + "2024-01-31T23:59:59Z".to_string(), + ]), + compare_date_range: None, + granularity: None, + }]; + + let result = get_date_range_value(Some(&time_dimensions))?; + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T00:00:00Z - 2024-01-31T23:59:59Z".to_string()) + ); + Ok(()) + } + + #[test] + fn test_get_date_range_value_no_time_dimensions() { + let result = get_date_range_value(None); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "QueryTimeDimension should be specified for the compare date range query." + ); + } + + #[test] + fn test_get_date_range_value_empty_time_dimensions() { + let time_dimensions: Vec = vec![]; + + let result = get_date_range_value(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "No time dimension provided." + ); + } + + #[test] + fn test_get_date_range_value_missing_date_range() { + let time_dimensions = vec![QueryTimeDimension { + dimension: "dim".to_string(), + date_range: None, + compare_date_range: None, + granularity: None, + }]; + + let result = get_date_range_value(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "Inconsistent QueryTimeDimension configuration: dateRange required." + ); + } + + #[test] + fn test_get_date_range_value_single_date_range() { + let time_dimensions = vec![QueryTimeDimension { + dimension: "dim".to_string(), + date_range: Some(vec!["2024-01-01T00:00:00Z".to_string()]), + compare_date_range: None, + granularity: None, + }]; + + let result = get_date_range_value(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "Inconsistent dateRange configuration for the compare date range query: 2024-01-01T00:00:00Z" + ); + } + + #[test] + fn test_get_blending_query_key_valid_granularity() -> Result<()> { + let time_dimensions = vec![QueryTimeDimension { + dimension: "dim".to_string(), + granularity: Some("day".to_string()), + date_range: None, + compare_date_range: None, + }]; + + let result = get_blending_query_key(Some(&time_dimensions))?; + assert_eq!(result, "time.day"); + Ok(()) + } + + #[test] + fn test_get_blending_query_key_no_time_dimensions() { + let result = get_blending_query_key(None); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "QueryTimeDimension should be specified for the blending query." + ); + } + + #[test] + fn test_get_blending_query_key_empty_time_dimensions() { + let time_dimensions: Vec = vec![]; + + let result = get_blending_query_key(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "QueryTimeDimension should be specified for the blending query." + ); + } + + #[test] + fn test_get_blending_query_key_missing_granularity() { + let time_dimensions = vec![QueryTimeDimension { + dimension: "dim".to_string(), + granularity: None, + date_range: None, + compare_date_range: None, + }]; + + let result = get_blending_query_key(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + format!( + "Inconsistent QueryTimeDimension configuration for the blending query, granularity required: {:?}", + QueryTimeDimension { + dimension: "dim".to_string(), + granularity: None, + date_range: None, + compare_date_range: None, + } + ) + ); + } + + #[test] + fn test_get_blending_response_key_valid_dimension_and_granularity() -> Result<()> { + let time_dimensions = vec![QueryTimeDimension { + dimension: "orders.created_at".to_string(), + granularity: Some("day".to_string()), + date_range: None, + compare_date_range: None, + }]; + + let result = get_blending_response_key(Some(&time_dimensions))?; + assert_eq!(result, "orders.created_at.day"); + Ok(()) + } + + #[test] + fn test_get_blending_response_key_no_time_dimensions() { + let result = get_blending_response_key(None); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "QueryTimeDimension should be specified for the blending query." + ); + } + + #[test] + fn test_get_blending_response_key_empty_time_dimensions() { + let time_dimensions: Vec = vec![]; + + let result = get_blending_response_key(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "QueryTimeDimension should be specified for the blending query." + ); + } + + #[test] + fn test_get_blending_response_key_missing_granularity() { + let time_dimensions = vec![QueryTimeDimension { + dimension: "orders.created_at".to_string(), + granularity: None, + date_range: None, + compare_date_range: None, + }]; + + let result = get_blending_response_key(Some(&time_dimensions)); + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + format!( + "Inconsistent QueryTimeDimension configuration for the blending query, granularity required: {:?}", + QueryTimeDimension { + dimension: "orders.created_at".to_string(), + granularity: None, + date_range: None, + compare_date_range: None, + } + ) + ); + } + +} From 172c526f5c0ba81608fdda9f6b39af30a7165430 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 17 Dec 2024 23:42:51 +0200 Subject: [PATCH 074/128] fix some tests --- .../src/query_result_transform.rs | 61 +++++++++++++------ rust/cubeorchestrator/src/transport.rs | 4 ++ 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index db241cd6b17df..3bff70a4cbe05 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -6,7 +6,7 @@ use crate::{ }, }; use anyhow::{bail, Context, Result}; -use chrono::{DateTime, SecondsFormat, Utc}; +use chrono::{DateTime, NaiveDateTime, SecondsFormat, TimeZone, Utc}; use itertools::multizip; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -27,13 +27,20 @@ pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimiti match value { DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { let formatted = dt.to_rfc3339_opts(SecondsFormat::Millis, true); - DBResponsePrimitive::String(formatted) + DBResponsePrimitive::String(formatted.trim_end_matches('Z').to_string()) } DBResponseValue::Primitive(DBResponsePrimitive::String(ref s)) if type_ == "time" => { let formatted = DateTime::parse_from_rfc3339(s) .map(|dt| dt.to_rfc3339_opts(SecondsFormat::Millis, true)) - .unwrap_or_else(|_| s.clone()); - DBResponsePrimitive::String(formatted) + .unwrap_or_else(|_| { + match NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f") { + Ok(dt) => Utc + .from_utc_datetime(&dt) + .to_rfc3339_opts(SecondsFormat::Millis, true), + Err(_) => s.clone(), + } + }); + DBResponsePrimitive::String(formatted.trim_end_matches('Z').to_string()) } DBResponseValue::Primitive(p) => p, DBResponseValue::Object { value } => value, @@ -272,6 +279,8 @@ pub fn get_vanilla_row( .unwrap_or(&"".to_string()), ); + row.insert(member_name.clone(), transformed_value.clone()); + // Handle deprecated time dimensions without granularity let path: Vec<&str> = member_name.split(MEMBER_SEPARATOR).collect(); let member_name_without_granularity = @@ -284,8 +293,6 @@ pub fn get_vanilla_row( }) { row.insert(member_name_without_granularity, transformed_value); - } else { - row.insert(member_name.clone(), transformed_value); } } } @@ -605,12 +612,13 @@ impl Display for DBResponseValue { #[cfg(test)] mod tests { use super::*; - use chrono::{TimeZone, Utc, Timelike}; use anyhow::Result; + use chrono::{TimeZone, Timelike, Utc}; #[test] fn test_transform_value_datetime_to_time() { - let dt = Utc.with_ymd_and_hms(2024, 1, 1, 12, 30, 15) + let dt = Utc + .with_ymd_and_hms(2024, 1, 1, 12, 30, 15) .unwrap() .with_nanosecond(123_000_000) .unwrap(); @@ -619,13 +627,14 @@ mod tests { assert_eq!( result, - DBResponsePrimitive::String("2024-01-01T12:30:15.123Z".to_string()) + DBResponsePrimitive::String("2024-01-01T12:30:15.123".to_string()) ); } #[test] fn test_transform_value_datetime_empty_type() { - let dt = Utc.with_ymd_and_hms(2024, 1, 1, 12, 30, 15) + let dt = Utc + .with_ymd_and_hms(2024, 1, 1, 12, 30, 15) .unwrap() .with_nanosecond(123_000_000) .unwrap(); @@ -634,30 +643,42 @@ mod tests { assert_eq!( result, - DBResponsePrimitive::String("2024-01-01T12:30:15.123Z".to_string()) + DBResponsePrimitive::String("2024-01-01T12:30:15.123".to_string()) ); } #[test] fn test_transform_value_string_to_time_valid_rfc3339() { let value = DBResponseValue::Primitive(DBResponsePrimitive::String( - "2024-01-01T12:30:15.123Z".to_string(), + "2024-01-01T12:30:15.123".to_string(), )); let result = transform_value(value, "time"); assert_eq!( result, - DBResponsePrimitive::String("2024-01-01T12:30:15.123Z".to_string()) + DBResponsePrimitive::String("2024-01-01T12:30:15.123".to_string()) ); } #[test] - fn test_transform_value_string_to_time_invalid_rfc3339() { + fn test_transform_value_string_wo_t_to_time_valid_rfc3339() { let value = DBResponseValue::Primitive(DBResponsePrimitive::String( - "invalid-date".to_string(), + "2024-01-01 12:30:15.123".to_string(), )); let result = transform_value(value, "time"); + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.123".to_string()) + ); + } + + #[test] + fn test_transform_value_string_to_time_invalid_rfc3339() { + let value = + DBResponseValue::Primitive(DBResponsePrimitive::String("invalid-date".to_string())); + let result = transform_value(value, "time"); + assert_eq!( result, DBResponsePrimitive::String("invalid-date".to_string()) @@ -666,9 +687,8 @@ mod tests { #[test] fn test_transform_value_primitive_string_type_not_time() { - let value = DBResponseValue::Primitive(DBResponsePrimitive::String( - "some-string".to_string(), - )); + let value = + DBResponseValue::Primitive(DBResponsePrimitive::String("some-string".to_string())); let result = transform_value(value, "other"); assert_eq!( @@ -680,7 +700,9 @@ mod tests { #[test] fn test_transform_value_object() { let obj_value = DBResponsePrimitive::String("object-value".to_string()); - let value = DBResponseValue::Object { value: obj_value.clone() }; + let value = DBResponseValue::Object { + value: obj_value.clone(), + }; let result = transform_value(value, "time"); assert_eq!(result, obj_value); @@ -891,5 +913,4 @@ mod tests { ) ); } - } diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 506eeced0eec3..91f597391e2eb 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -61,6 +61,10 @@ pub enum FilterOperator { AfterDate, AfterOrOnDate, MeasureFilter, + EndsWith, + NotEndsWith, + StartsWith, + NotStartsWith, } #[derive(Debug, Serialize, Deserialize)] From 189f6b31426430f2fac93d9ad55be4a0c9683300 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 00:23:26 +0200 Subject: [PATCH 075/128] =?UTF-8?q?attempt=20to=C2=A0fix=20native=20build/?= =?UTF-8?q?test=20in=C2=A0docker-dev=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 53480a93a0492..45b8254bb044b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -567,17 +567,6 @@ 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 - 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 uses: actions/setup-node@v4 with: @@ -605,12 +594,28 @@ jobs: retry_wait_seconds: 15 timeout_minutes: 20 command: yarn install --frozen-lockfile - - name: Build native (no python) - run: cd packages/cubejs-backend-native && npm run native:build-release - name: Build client 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/ From b0418fdaf546c20e053fb6312110832ad22ec17f Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 00:47:57 +0200 Subject: [PATCH 076/128] fix empty result set issue --- .../src/query_message_parser.rs | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/rust/cubeorchestrator/src/query_message_parser.rs b/rust/cubeorchestrator/src/query_message_parser.rs index a7660cbf501a2..8d406906ceda1 100644 --- a/rust/cubeorchestrator/src/query_message_parser.rs +++ b/rust/cubeorchestrator/src/query_message_parser.rs @@ -64,38 +64,39 @@ impl QueryResult { .command_as_http_result_set() .ok_or(ParseError::EmptyResultSet)?; - let result_set_columns = result_set.columns().ok_or(ParseError::EmptyResultSet)?; + if let Some(result_set_columns) = result_set.columns() { + if result_set_columns.iter().any(|c| c.is_empty()) { + return Err(ParseError::ColumnNameNotDefined); + } - if result_set_columns.iter().any(|c| c.is_empty()) { - return Err(ParseError::ColumnNameNotDefined); - } - - let (columns, columns_pos): (Vec<_>, HashMap<_, _>) = result_set_columns - .iter() - .enumerate() - .map(|(index, column_name)| { - (column_name.to_owned(), (column_name.to_owned(), index)) - }) - .unzip(); - - result.columns = columns; - result.columns_pos = columns_pos; - - let result_set_rows = result_set.rows().ok_or(ParseError::EmptyResultSet)?; - result.rows = Vec::with_capacity(result_set_rows.len()); - - for row in result_set_rows.iter() { - let values = row.values().ok_or(ParseError::NullRow)?; - let row_obj: Vec<_> = values + let (columns, columns_pos): (Vec<_>, HashMap<_, _>) = result_set_columns .iter() - .map(|val| { - DBResponseValue::Primitive(DBResponsePrimitive::String( - val.string_value().unwrap_or("").to_owned(), - )) + .enumerate() + .map(|(index, column_name)| { + (column_name.to_owned(), (column_name.to_owned(), index)) }) - .collect(); + .unzip(); + + result.columns = columns; + result.columns_pos = columns_pos; + } - result.rows.push(row_obj); + if let Some(result_set_rows) = result_set.rows() { + result.rows = Vec::with_capacity(result_set_rows.len()); + + for row in result_set_rows.iter() { + let values = row.values().ok_or(ParseError::NullRow)?; + let row_obj: Vec<_> = values + .iter() + .map(|val| { + DBResponseValue::Primitive(DBResponsePrimitive::String( + val.string_value().unwrap_or("").to_owned(), + )) + }) + .collect(); + + result.rows.push(row_obj); + } } Ok(result) @@ -106,7 +107,11 @@ impl QueryResult { pub fn from_js_raw_data(js_raw_data: JsRawData) -> Result { if js_raw_data.is_empty() { - return Err(ParseError::EmptyResultSet); + return Ok(QueryResult { + columns: vec![], + rows: vec![], + columns_pos: HashMap::new(), + }); } let first_row = &js_raw_data[0]; From 473f64f103dd0cec08b14d8033358b18d69ce958 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 13:19:06 +0200 Subject: [PATCH 077/128] =?UTF-8?q?another=20fix=20in=C2=A0datetime=20pars?= =?UTF-8?q?ing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/query_result_transform.rs | 56 ++++++++++++++----- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 3bff70a4cbe05..5abb33232c8f7 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -6,7 +6,7 @@ use crate::{ }, }; use anyhow::{bail, Context, Result}; -use chrono::{DateTime, NaiveDateTime, SecondsFormat, TimeZone, Utc}; +use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; use itertools::multizip; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -26,21 +26,25 @@ pub const MEMBER_SEPARATOR: &str = "."; pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { match value { DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { - let formatted = dt.to_rfc3339_opts(SecondsFormat::Millis, true); - DBResponsePrimitive::String(formatted.trim_end_matches('Z').to_string()) + DBResponsePrimitive::String(dt.with_timezone(&Utc).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) } DBResponseValue::Primitive(DBResponsePrimitive::String(ref s)) if type_ == "time" => { let formatted = DateTime::parse_from_rfc3339(s) - .map(|dt| dt.to_rfc3339_opts(SecondsFormat::Millis, true)) - .unwrap_or_else(|_| { - match NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f") { - Ok(dt) => Utc - .from_utc_datetime(&dt) - .to_rfc3339_opts(SecondsFormat::Millis, true), - Err(_) => s.clone(), - } - }); - DBResponsePrimitive::String(formatted.trim_end_matches('Z').to_string()) + .map(|dt| dt.format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + .or_else(|_| { + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f") + .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + }) + .or_else(|_| { + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z") + .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + }) + .or_else(|_| { + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %:z") + .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + }) + .unwrap_or_else(|_| s.clone()); + DBResponsePrimitive::String(formatted) } DBResponseValue::Primitive(p) => p, DBResponseValue::Object { value } => value, @@ -673,6 +677,32 @@ mod tests { ); } + #[test] + fn test_transform_value_string_with_tz_offset_to_time_valid_rfc3339() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "2024-01-01 12:30:15.123 +00:00".to_string(), + )); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.123".to_string()) + ); + } + + #[test] + fn test_transform_value_string_with_tz_to_time_valid_rfc3339() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "2024-01-01 12:30:15.123 UTC".to_string(), + )); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.123".to_string()) + ); + } + #[test] fn test_transform_value_string_to_time_invalid_rfc3339() { let value = From 45b1ca4b3486c04a232ae736e01e585613b6f41d Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 13:19:24 +0200 Subject: [PATCH 078/128] =?UTF-8?q?another=20fix=20in=C2=A0deserialization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust/cubeorchestrator/src/transport.rs | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 91f597391e2eb..46d2556786a4d 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -67,7 +67,7 @@ pub enum FilterOperator { NotStartsWith, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct QueryFilter { pub member: String, pub operator: FilterOperator, @@ -135,13 +135,21 @@ pub struct ConfigItem { #[serde(skip_serializing_if = "Option::is_none")] pub meta: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub drill_members: Option>, + pub drill_members: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub drill_members_grouped: Option, + pub drill_members_grouped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub granularities: Option>, } +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DrillMembersGrouped { + #[serde(skip_serializing_if = "Option::is_none")] + pub measures: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub dimensions: Option>, +} + #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct AnnotatedConfigItem { @@ -191,29 +199,23 @@ pub enum MemberOrMemberExpression { MemberExpression(ParsedMemberExpression), } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct LogicalAndFilter { - pub and: Vec, + pub and: Vec, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct LogicalOrFilter { - pub or: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub enum QueryFilterOrLogicalFilter { - QueryFilter(QueryFilter), - LogicalAndFilter(LogicalAndFilter), - LogicalOrFilter(LogicalOrFilter), + pub or: Vec, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum LogicalFilter { +pub enum QueryFilterOrLogicalFilter { QueryFilter(QueryFilter), LogicalAndFilter(LogicalAndFilter), LogicalOrFilter(LogicalOrFilter), + NormalizedQueryFilter(NormalizedQueryFilter), } #[derive(Debug, Serialize, Deserialize)] @@ -225,7 +227,7 @@ pub struct Query { // pub dimensions: Option>, pub dimensions: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option>, + pub filters: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub time_dimensions: Option>, #[serde(skip_serializing_if = "Option::is_none")] @@ -282,7 +284,7 @@ pub struct NormalizedQuery { #[serde(skip_serializing_if = "Option::is_none")] pub response_format: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option>, + pub filters: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub row_limit: Option, #[serde(skip_serializing_if = "Option::is_none")] From 4983d14c3f00bbed623211b1d66891ed96fb449f Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 13:21:38 +0200 Subject: [PATCH 079/128] =?UTF-8?q?another=20fix=20in=C2=A0datetime=20pars?= =?UTF-8?q?ing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/query_result_transform.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 5abb33232c8f7..6eed13f7373ea 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -35,6 +35,10 @@ pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimiti NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f") .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) }) + .or_else(|_| { + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") + .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + }) .or_else(|_| { NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z") .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) @@ -677,6 +681,19 @@ mod tests { ); } + #[test] + fn test_transform_value_string_wo_mssec_to_time_valid_rfc3339() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "2024-01-01 12:30:15".to_string(), + )); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.000".to_string()) + ); + } + #[test] fn test_transform_value_string_with_tz_offset_to_time_valid_rfc3339() { let value = DBResponseValue::Primitive(DBResponsePrimitive::String( From 8a8dabcc0f1f4bfd5e91cfd8fd7717f4d5ae682c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 13:24:10 +0200 Subject: [PATCH 080/128] update postgres-native-cubestore-response-full.test.ts.snap --- ...ative-cubestore-response-full.test.ts.snap | 1070 ++++++++++++----- 1 file changed, 748 insertions(+), 322 deletions(-) diff --git a/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap b/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap index 0c15db38f231c..801a0174fbbc5 100644 --- a/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap +++ b/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Complex Rollup: complex_rollup 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Complex Rollup: complex_rollup 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -1797,7 +1797,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Extended nested Rollup over asterisk: extended_nested_rollup_over_asterisk 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Extended nested Rollup over asterisk: extended_nested_rollup_over_asterisk 1`] = ` Array [ Object { "SUM(a.count)": "1", @@ -2247,7 +2247,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = ` Array [ Object { "category": null, @@ -2261,7 +2261,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup over asterisk: nested_rollup_over_asterisk 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Nested Rollup over asterisk: nested_rollup_over_asterisk 1`] = ` Array [ Object { "SUM(a.count)": "1", @@ -3064,7 +3064,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup with aliases: nested_rollup_with_aliases 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Nested Rollup with aliases: nested_rollup_with_aliases 1`] = ` Array [ Object { "SUM(a.cnt)": "1", @@ -3867,7 +3867,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup: nested_rollup 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Nested Rollup: nested_rollup 1`] = ` Array [ Object { "SUM(a.cnt)": "1", @@ -4670,7 +4670,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Rollup over exprs: rollup_over_exprs 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Rollup over exprs: rollup_over_exprs 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -5473,7 +5473,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Rollup with aliases: rollup_with_aliases 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Rollup with aliases: rollup_with_aliases 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -7270,7 +7270,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Simple Rollup: simple_rollup 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Simple Rollup: simple_rollup 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -8073,7 +8073,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: metabase count cast to float32 from push down: metabase_count_cast_to_float32_from_push_down 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: metabase count cast to float32 from push down: metabase_count_cast_to_float32_from_push_down 1`] = ` Array [ Object { "a0": 41, @@ -8081,7 +8081,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: post-aggregate percentage of total: post_aggregate_percentage_of_total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: post-aggregate percentage of total: post_aggregate_percentage_of_total 1`] = ` Array [ Object { "SUM(BigECommerce.percentageOfTotalForStatus)": 100, @@ -8089,7 +8089,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: powerbi min max push down: powerbi_min_max_push_down 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: powerbi min max push down: powerbi_min_max_push_down 1`] = ` Array [ Object { "a0": 2020-12-25T00:00:00.000Z, @@ -8098,7 +8098,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: powerbi min max ungrouped flag: powerbi_min_max_ungrouped_flag 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: powerbi min max ungrouped flag: powerbi_min_max_ungrouped_flag 1`] = ` Array [ Object { "a0": "39", @@ -8108,7 +8108,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: reuse params: reuse_params 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: reuse params: reuse_params 1`] = ` Array [ Object { "c0": 2020-01-01T00:00:00.000Z, @@ -8117,7 +8117,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: ungrouped pre-agg: ungrouped_pre_agg 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver SQL API: ungrouped pre-agg: ungrouped_pre_agg 1`] = ` Array [ Object { "productName": "Canon PC1080F Personal Copier", @@ -8298,7 +8298,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: contains + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8467,7 +8467,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: contains + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8636,9 +8636,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: contains + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: endsWith filter + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AJ-10780", @@ -8735,7 +8735,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: endsWith filter + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8904,9 +8904,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: endsWith filter + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notEndsWith filter + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8983,9 +8983,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, second 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notEndsWith filter + dimensions, second 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, third 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notEndsWith filter + dimensions, third 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9154,7 +9154,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notStartsWith + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "BB-11545", @@ -9307,7 +9307,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notStartsWith + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "CA-12775", @@ -9436,7 +9436,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, third 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notStartsWith + dimensions, third 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9605,7 +9605,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: startsWith + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9626,7 +9626,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: startsWith + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9671,9 +9671,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: startsWith + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: contains dimensions, first 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -9708,7 +9708,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: contains dimensions, second 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -9833,9 +9833,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: contains dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: endsWith + dimensions, first 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -9870,7 +9870,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: endsWith + dimensions, second 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -10055,9 +10055,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: endsWith + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: startsWith + dimensions, first 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -10122,7 +10122,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: startsWith + dimensions, second 1`] = ` Array [ Object { "ECommerce.category": "Office Supplies", @@ -10292,9 +10292,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: startsWith + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains + dimensions + order, first 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10309,7 +10309,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains + dimensions + order, second 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10334,9 +10334,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains + dimensions + order, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains with special chars + dimensions 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains with special chars + dimensions 1`] = ` Array [ Object { "Products.productName": "Logitech di_Novo Edge Keyboard", @@ -10344,7 +10344,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: endsWith filter + dimensions + order, first 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10429,7 +10429,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: endsWith filter + dimensions + order, second 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10524,9 +10524,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: endsWith filter + dimensions + order, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: startsWith filter + dimensions + order, first 1`] = ` Array [ Object { "Products.category": "Office Supplies", @@ -10541,7 +10541,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: startsWith filter + dimensions + order, second 1`] = ` Array [ Object { "Products.category": "Office Supplies", @@ -10571,9 +10571,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: startsWith filter + dimensions + order, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response pre-aggregations Customers: running total without time dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver pre-aggregations Customers: running total without time dimension 1`] = ` Array [ Object { "Customers.runningTotal": "41", @@ -10581,7 +10581,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: null boolean 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: null boolean 1`] = ` Array [ Object { "BigECommerce.returning": null, @@ -10589,7 +10589,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: null sum 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: null sum 1`] = ` Array [ Object { "BigECommerce.totalSales": null, @@ -10597,417 +10597,730 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: partitioned pre-agg 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: partitioned pre-agg 1`] = ` Array [ Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", "BigECommerce.productName": "Balt Solid Wood Rectangular Table", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", "BigECommerce.totalQuantity": "4", }, Object { - "BigECommerce.orderDate": "2020-02-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", "BigECommerce.productName": "Canon PC1080F Personal Copier", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", "BigECommerce.totalQuantity": "8", }, Object { - "BigECommerce.orderDate": "2020-04-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", "BigECommerce.productName": "Google Nexus 6", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", "BigECommerce.productName": "Google Nexus 7", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", "BigECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "DMI Eclipse Executive Suite Bookcases", "BigECommerce.totalQuantity": "1", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "HTC One", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", "BigECommerce.totalQuantity": "6", }, Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", "BigECommerce.productName": "Project Tote Personal File", "BigECommerce.totalQuantity": "1", }, Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", "BigECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", "BigECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", "BigECommerce.totalQuantity": "7", }, Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", "BigECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", "BigECommerce.totalQuantity": "4", }, Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", "BigECommerce.productName": "OIC #2 Pencils, Medium Soft", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", "BigECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", "BigECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", "BigECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", "BigECommerce.productName": "Magna Visual Magnetic Picture Hangers", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Google Nexus 5", "BigECommerce.totalQuantity": "11", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", "BigECommerce.totalQuantity": "4", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Linden 10 Round Wall Clock, Black", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Logitech di_Novo Edge Keyboard", "BigECommerce.totalQuantity": "9", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", "BigECommerce.totalQuantity": "3", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Recycled Eldon Regeneration Jumbo File", "BigECommerce.totalQuantity": "4", }, Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", "BigECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "BigECommerce.totalQuantity": "4", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Canon PC1080F Personal Copier", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", "BigECommerce.totalQuantity": "4", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", "BigECommerce.totalQuantity": "5", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Magna Visual Magnetic Picture Hangers", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Okidata C610n Printer", "BigECommerce.totalQuantity": "2", }, Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", "BigECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", "BigECommerce.totalQuantity": "5", }, ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: partitioned pre-agg with multi time dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: partitioned pre-agg with multi time dimension 1`] = ` Array [ Object { - "BigECommerce.completedDate": "2020-01-02T00:00:00.000Z", + "BigECommerce.completedDate": "2020-01-02T00:00:00.000", + "BigECommerce.completedDate.day": "2020-01-02T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.day": "2020-01-01T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-01-24T00:00:00.000Z", + "BigECommerce.completedDate": "2020-01-24T00:00:00.000", + "BigECommerce.completedDate.day": "2020-01-24T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-01-23T00:00:00.000Z", + "BigECommerce.orderDate": "2020-01-23T00:00:00.000", + "BigECommerce.orderDate.day": "2020-01-23T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-02-17T00:00:00.000Z", + "BigECommerce.completedDate": "2020-02-17T00:00:00.000", + "BigECommerce.completedDate.day": "2020-02-17T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-02-16T00:00:00.000Z", + "BigECommerce.orderDate": "2020-02-16T00:00:00.000", + "BigECommerce.orderDate.day": "2020-02-16T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-03-18T00:00:00.000Z", + "BigECommerce.completedDate": "2020-03-18T00:00:00.000", + "BigECommerce.completedDate.day": "2020-03-18T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-03-17T00:00:00.000Z", + "BigECommerce.orderDate": "2020-03-17T00:00:00.000", + "BigECommerce.orderDate.day": "2020-03-17T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-03-27T00:00:00.000Z", + "BigECommerce.completedDate": "2020-03-27T00:00:00.000", + "BigECommerce.completedDate.day": "2020-03-27T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-03-26T00:00:00.000Z", + "BigECommerce.orderDate": "2020-03-26T00:00:00.000", + "BigECommerce.orderDate.day": "2020-03-26T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-04-11T00:00:00.000Z", + "BigECommerce.completedDate": "2020-04-11T00:00:00.000", + "BigECommerce.completedDate.day": "2020-04-11T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-04-10T00:00:00.000Z", + "BigECommerce.orderDate": "2020-04-10T00:00:00.000", + "BigECommerce.orderDate.day": "2020-04-10T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-05-14T00:00:00.000Z", + "BigECommerce.completedDate": "2020-05-14T00:00:00.000", + "BigECommerce.completedDate.day": "2020-05-14T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-05-13T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-13T00:00:00.000", + "BigECommerce.orderDate.day": "2020-05-13T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-05-15T00:00:00.000Z", + "BigECommerce.completedDate": "2020-05-15T00:00:00.000", + "BigECommerce.completedDate.day": "2020-05-15T00:00:00.000", "BigECommerce.count": "2", - "BigECommerce.orderDate": "2020-05-14T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-14T00:00:00.000", + "BigECommerce.orderDate.day": "2020-05-14T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-05-28T00:00:00.000Z", + "BigECommerce.completedDate": "2020-05-28T00:00:00.000", + "BigECommerce.completedDate.day": "2020-05-28T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-05-27T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-27T00:00:00.000", + "BigECommerce.orderDate.day": "2020-05-27T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-05-30T00:00:00.000Z", + "BigECommerce.completedDate": "2020-05-30T00:00:00.000", + "BigECommerce.completedDate.day": "2020-05-30T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-05-29T00:00:00.000Z", + "BigECommerce.orderDate": "2020-05-29T00:00:00.000", + "BigECommerce.orderDate.day": "2020-05-29T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-06-04T00:00:00.000Z", + "BigECommerce.completedDate": "2020-06-04T00:00:00.000", + "BigECommerce.completedDate.day": "2020-06-04T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-06-03T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-03T00:00:00.000", + "BigECommerce.orderDate.day": "2020-06-03T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-06-11T00:00:00.000Z", + "BigECommerce.completedDate": "2020-06-11T00:00:00.000", + "BigECommerce.completedDate.day": "2020-06-11T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-06-10T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-10T00:00:00.000", + "BigECommerce.orderDate.day": "2020-06-10T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-06-12T00:00:00.000Z", + "BigECommerce.completedDate": "2020-06-12T00:00:00.000", + "BigECommerce.completedDate.day": "2020-06-12T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-06-11T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-11T00:00:00.000", + "BigECommerce.orderDate.day": "2020-06-11T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-06-16T00:00:00.000Z", + "BigECommerce.completedDate": "2020-06-16T00:00:00.000", + "BigECommerce.completedDate.day": "2020-06-16T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-06-15T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-15T00:00:00.000", + "BigECommerce.orderDate.day": "2020-06-15T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-06-18T00:00:00.000Z", + "BigECommerce.completedDate": "2020-06-18T00:00:00.000", + "BigECommerce.completedDate.day": "2020-06-18T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-06-17T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-17T00:00:00.000", + "BigECommerce.orderDate.day": "2020-06-17T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-06-26T00:00:00.000Z", + "BigECommerce.completedDate": "2020-06-26T00:00:00.000", + "BigECommerce.completedDate.day": "2020-06-26T00:00:00.000", "BigECommerce.count": "2", - "BigECommerce.orderDate": "2020-06-25T00:00:00.000Z", + "BigECommerce.orderDate": "2020-06-25T00:00:00.000", + "BigECommerce.orderDate.day": "2020-06-25T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-09-02T00:00:00.000Z", + "BigECommerce.completedDate": "2020-09-02T00:00:00.000", + "BigECommerce.completedDate.day": "2020-09-02T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.day": "2020-09-01T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-09-03T00:00:00.000Z", + "BigECommerce.completedDate": "2020-09-03T00:00:00.000", + "BigECommerce.completedDate.day": "2020-09-03T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-09-02T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-02T00:00:00.000", + "BigECommerce.orderDate.day": "2020-09-02T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-09-09T00:00:00.000Z", + "BigECommerce.completedDate": "2020-09-09T00:00:00.000", + "BigECommerce.completedDate.day": "2020-09-09T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-09-08T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-08T00:00:00.000", + "BigECommerce.orderDate.day": "2020-09-08T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-09-18T00:00:00.000Z", + "BigECommerce.completedDate": "2020-09-18T00:00:00.000", + "BigECommerce.completedDate.day": "2020-09-18T00:00:00.000", "BigECommerce.count": "2", - "BigECommerce.orderDate": "2020-09-17T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-17T00:00:00.000", + "BigECommerce.orderDate.day": "2020-09-17T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-09-24T00:00:00.000Z", + "BigECommerce.completedDate": "2020-09-24T00:00:00.000", + "BigECommerce.completedDate.day": "2020-09-24T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-09-23T00:00:00.000Z", + "BigECommerce.orderDate": "2020-09-23T00:00:00.000", + "BigECommerce.orderDate.day": "2020-09-23T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-10-13T00:00:00.000Z", + "BigECommerce.completedDate": "2020-10-13T00:00:00.000", + "BigECommerce.completedDate.day": "2020-10-13T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-10-12T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-12T00:00:00.000", + "BigECommerce.orderDate.day": "2020-10-12T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-10-20T00:00:00.000Z", + "BigECommerce.completedDate": "2020-10-20T00:00:00.000", + "BigECommerce.completedDate.day": "2020-10-20T00:00:00.000", "BigECommerce.count": "2", - "BigECommerce.orderDate": "2020-10-19T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-19T00:00:00.000", + "BigECommerce.orderDate.day": "2020-10-19T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-01T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-01T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-01T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-10-30T00:00:00.000Z", + "BigECommerce.orderDate": "2020-10-30T00:00:00.000", + "BigECommerce.orderDate.day": "2020-10-30T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-03T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-03T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-03T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-02T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-02T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-02T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-06T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-06T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-06T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-05T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-05T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-05T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-07T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-07T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-07T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-06T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-06T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-06T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-12T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-12T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-12T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-11T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-11T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-11T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-13T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-13T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-13T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-12T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-12T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-12T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-17T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-17T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-17T00:00:00.000", "BigECommerce.count": "2", - "BigECommerce.orderDate": "2020-11-16T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-16T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-16T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-22T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-22T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-22T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-21T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-21T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-21T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-11-29T00:00:00.000Z", + "BigECommerce.completedDate": "2020-11-29T00:00:00.000", + "BigECommerce.completedDate.day": "2020-11-29T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-11-28T00:00:00.000Z", + "BigECommerce.orderDate": "2020-11-28T00:00:00.000", + "BigECommerce.orderDate.day": "2020-11-28T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-12-02T00:00:00.000Z", + "BigECommerce.completedDate": "2020-12-02T00:00:00.000", + "BigECommerce.completedDate.day": "2020-12-02T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.day": "2020-12-01T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-12-03T00:00:00.000Z", + "BigECommerce.completedDate": "2020-12-03T00:00:00.000", + "BigECommerce.completedDate.day": "2020-12-03T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-12-02T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-02T00:00:00.000", + "BigECommerce.orderDate.day": "2020-12-02T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-12-05T00:00:00.000Z", + "BigECommerce.completedDate": "2020-12-05T00:00:00.000", + "BigECommerce.completedDate.day": "2020-12-05T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-12-04T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-04T00:00:00.000", + "BigECommerce.orderDate.day": "2020-12-04T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-12-15T00:00:00.000Z", + "BigECommerce.completedDate": "2020-12-15T00:00:00.000", + "BigECommerce.completedDate.day": "2020-12-15T00:00:00.000", "BigECommerce.count": "2", - "BigECommerce.orderDate": "2020-12-14T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-14T00:00:00.000", + "BigECommerce.orderDate.day": "2020-12-14T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-12-25T00:00:00.000Z", + "BigECommerce.completedDate": "2020-12-25T00:00:00.000", + "BigECommerce.completedDate.day": "2020-12-25T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-12-24T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-24T00:00:00.000", + "BigECommerce.orderDate.day": "2020-12-24T00:00:00.000", }, Object { - "BigECommerce.completedDate": "2020-12-26T00:00:00.000Z", + "BigECommerce.completedDate": "2020-12-26T00:00:00.000", + "BigECommerce.completedDate.day": "2020-12-26T00:00:00.000", "BigECommerce.count": "1", - "BigECommerce.orderDate": "2020-12-25T00:00:00.000Z", + "BigECommerce.orderDate": "2020-12-25T00:00:00.000", + "BigECommerce.orderDate.day": "2020-12-25T00:00:00.000", + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling count_distinct_approx window by 2 day 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": 1, + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Day": null, }, ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 day 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling count_distinct_approx window by 2 month 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 2, + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 3, + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 3, + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 3, + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 6, + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 12, + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 7, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 6, + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 9, + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 11, + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Month": 15, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling count_distinct_approx window by 2 week 1`] = ` +Array [ + Object { + "BigECommerce.orderDate": "2020-01-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 1, + }, + Object { + "BigECommerce.orderDate": "2020-02-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 1, + }, + Object { + "BigECommerce.orderDate": "2020-03-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 1, + }, + Object { + "BigECommerce.orderDate": "2020-04-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": null, + }, + Object { + "BigECommerce.orderDate": "2020-05-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 2, + }, + Object { + "BigECommerce.orderDate": "2020-06-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 3, + }, + Object { + "BigECommerce.orderDate": "2020-07-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": null, + }, + Object { + "BigECommerce.orderDate": "2020-08-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": null, + }, + Object { + "BigECommerce.orderDate": "2020-09-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 3, + }, + Object { + "BigECommerce.orderDate": "2020-10-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 2, + }, + Object { + "BigECommerce.orderDate": "2020-11-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 2, + }, + Object { + "BigECommerce.orderDate": "2020-12-01T00:00:00.000", + "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", + "BigECommerce.rollingCountApproxBy2Week": 2, + }, +] +`; + +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling window by 2 day 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -11072,7 +11385,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 month 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling window by 2 month 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -11137,7 +11450,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 week 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling window by 2 week 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -11202,9 +11515,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: totalProfitYearAgo 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: totalProfitYearAgo 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + limit 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + limit 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11249,7 +11562,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + limit + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order + limit + total + offset 1`] = ` Array [ Object { "Customers.customerId": "GA-14725", @@ -11294,7 +11607,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + limit + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order + limit + total 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11339,7 +11652,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order + total + offset 1`] = ` Array [ Object { "Customers.customerId": "BS-11380", @@ -11348,7 +11661,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11517,7 +11830,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + total 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11686,7 +11999,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11855,7 +12168,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: count by cities + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: count by cities + order 1`] = ` Array [ Object { "ECommerce.city": "Columbus", @@ -11964,7 +12277,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + limit 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + limit 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -12119,7 +12432,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + limit + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order + limit + total + offset 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -12274,7 +12587,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + limit + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order + limit + total 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -12429,7 +12742,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order + total + offset 1`] = ` Array [ Object { "ECommerce.category": "Office Supplies", @@ -12449,7 +12762,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -13114,7 +13427,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + total 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -13779,7 +14092,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -14444,422 +14757,502 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: partitioned pre-agg 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: partitioned pre-agg 1`] = ` Array [ Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-01-01T00:00:00.000", "ECommerce.productName": "Balt Solid Wood Rectangular Table", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-01-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-02-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-02-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-02-01T00:00:00.000", "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-03-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-03-01T00:00:00.000", "ECommerce.productName": "Canon PC1080F Personal Copier", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-03-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-03-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2020-04-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-04-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-04-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-05-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-05-01T00:00:00.000", "ECommerce.productName": "Google Nexus 6", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-05-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-05-01T00:00:00.000", "ECommerce.productName": "Google Nexus 7", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-05-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-05-01T00:00:00.000", "ECommerce.productName": "OIC #2 Pencils, Medium Soft", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-05-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-05-01T00:00:00.000", "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-05-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-05-01T00:00:00.000", "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", "ECommerce.totalQuantity": "1", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.productName": "HTC One", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.productName": "OIC #2 Pencils, Medium Soft", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", "ECommerce.totalQuantity": "6", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.productName": "Project Tote Personal File", "ECommerce.totalQuantity": "1", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", "ECommerce.totalQuantity": "7", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.productName": "OIC #2 Pencils, Medium Soft", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-10-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-10-01T00:00:00.000", "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-10-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-10-01T00:00:00.000", "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-10-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-10-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-10-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-10-01T00:00:00.000", "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Google Nexus 5", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Logitech di_Novo Edge Keyboard", "ECommerce.totalQuantity": "9", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Canon PC1080F Personal Copier", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Okidata C610n Printer", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", "ECommerce.totalQuantity": "5", }, ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: partitioned pre-agg higher granularity 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: partitioned pre-agg higher granularity 1`] = ` Array [ Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Balt Solid Wood Rectangular Table", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Canon PC1080F Personal Copier", "ECommerce.totalQuantity": "7", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", "ECommerce.totalQuantity": "1", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Google Nexus 5", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Google Nexus 6", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Google Nexus 7", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "HTC One", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", "ECommerce.totalQuantity": "6", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "14", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Logitech di_Novo Edge Keyboard", "ECommerce.totalQuantity": "9", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "OIC #2 Pencils, Medium Soft", "ECommerce.totalQuantity": "9", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Okidata C610n Printer", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Project Tote Personal File", "ECommerce.totalQuantity": "1", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", "ECommerce.totalQuantity": "3", }, ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery 1`] = ` Array [ Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-01-01T00:00:00.000", "ECommerce.totalProfit": "29.6548", "ECommerce.totalSales": "259.876", }, Object { - "ECommerce.orderDate": "2020-02-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-02-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-02-01T00:00:00.000", "ECommerce.totalProfit": "6.1992", "ECommerce.totalSales": "18.368", }, Object { - "ECommerce.orderDate": "2020-03-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-03-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-03-01T00:00:00.000", "ECommerce.totalProfit": "583.5945", "ECommerce.totalSales": "2471.56", }, Object { - "ECommerce.orderDate": "2020-04-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-04-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-04-01T00:00:00.000", "ECommerce.totalProfit": "6.4176", "ECommerce.totalSales": "36.672", }, Object { - "ECommerce.orderDate": "2020-05-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-05-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-05-01T00:00:00.000", "ECommerce.totalProfit": "353.6849", "ECommerce.totalSales": "1288.21", }, Object { - "ECommerce.orderDate": "2020-06-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-06-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-06-01T00:00:00.000", "ECommerce.totalProfit": "34.2361", "ECommerce.totalSales": "728.734", }, Object { - "ECommerce.orderDate": "2020-09-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-09-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-09-01T00:00:00.000", "ECommerce.totalProfit": "461.1332", "ECommerce.totalSales": "2340.872", }, Object { - "ECommerce.orderDate": "2020-10-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-10-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-10-01T00:00:00.000", "ECommerce.totalProfit": "139.997", "ECommerce.totalSales": "2219.468", }, Object { - "ECommerce.orderDate": "2020-11-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-11-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-11-01T00:00:00.000", "ECommerce.totalProfit": "1132.6617", "ECommerce.totalSales": "5573.922", }, Object { - "ECommerce.orderDate": "2020-12-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-12-01T00:00:00.000", + "ECommerce.orderDate.month": "2020-12-01T00:00:00.000", "ECommerce.totalProfit": "303.9737", "ECommerce.totalSales": "2434.222", }, ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + limit + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order + limit + total 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -14914,7 +15307,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + limit 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order + limit 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -14969,7 +15362,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order + total 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -15114,7 +15507,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -15259,177 +15652,210 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + dimension 1`] = ` Array [ Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Balt Solid Wood Rectangular Table", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-01-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Canon PC1080F Personal Copier", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "DMI Eclipse Executive Suite Bookcases", "ECommerce.totalQuantity": "1", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Google Nexus 6", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Google Nexus 7", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "HTC One", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.1", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.2", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "OIC #2 Pencils, Medium Soft", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Plymouth Boxed Rubber Bands by Plymouth", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Project Tote Personal File", "ECommerce.totalQuantity": "1", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Tyvek Side-Opening Peel & Seel Expanding Envelopes", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2020-07-01T00:00:00.000Z", + "ECommerce.orderDate": "2020-07-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2020-07-01T00:00:00.000", "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Anderson Hickey Conga Table Tops & Accessories", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Canon PC1080F Personal Copier", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Global Adaptabilites Bookcase, Cherry/Storm Gray Finish", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Google Nexus 5", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Harbour Creations 67200 Series Stacking Chairs", "ECommerce.totalQuantity": "11", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Hewlett Packard 610 Color Digital Copier / Printer", "ECommerce.totalQuantity": "3", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Iceberg Nesting Folding Chair, 19w x 6d x 43h", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Kingston Digital DataTraveler 16GB USB 2.0", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Lexmark 20R1285 X6650 Wireless All-in-One Printer", "ECommerce.totalQuantity": "6", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Linden 10 Round Wall Clock, Black", "ECommerce.totalQuantity": "7", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Logitech di_Novo Edge Keyboard", "ECommerce.totalQuantity": "9", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Magna Visual Magnetic Picture Hangers", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "OIC #2 Pencils, Medium Soft", "ECommerce.totalQuantity": "5", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Okidata C610n Printer", "ECommerce.totalQuantity": "2", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Panasonic KP-380BK Classic Electric Pencil Sharpener", "ECommerce.totalQuantity": "8", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Recycled Eldon Regeneration Jumbo File", "ECommerce.totalQuantity": "4", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box", "ECommerce.totalQuantity": "9", }, Object { - "ECommerce.orderDate": "2021-01-01T00:00:00.000Z", + "ECommerce.orderDate": "2021-01-01T00:00:00.000", + "ECommerce.orderDate.half_year": "2021-01-01T00:00:00.000", "ECommerce.productName": "Wausau Papers Astrobrights Colored Envelopes", "ECommerce.totalQuantity": "3", }, ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + no dimension 1`] = ` Array [ Object { "ECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -15449,7 +15875,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year + dimension 1`] = ` Array [ Object { "ECommerce.city": "Lorain", @@ -15634,7 +16060,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year + no dimension 1`] = ` Array [ Object { "ECommerce.count": "1", @@ -15654,7 +16080,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year_by_1st_april + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year_by_1st_april + dimension 1`] = ` Array [ Object { "ECommerce.city": "Decatur", @@ -15845,7 +16271,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year_by_1st_april + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year_by_1st_april + no dimension 1`] = ` Array [ Object { "ECommerce.count": "6", @@ -15865,7 +16291,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by three_months_by_march + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by three_months_by_march + dimension 1`] = ` Array [ Object { "ECommerce.city": "Decatur", @@ -16068,7 +16494,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by three_months_by_march + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by three_months_by_march + no dimension 1`] = ` Array [ Object { "ECommerce.count": "3", @@ -16098,7 +16524,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading 1`] = ` Array [ Object { "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", @@ -16138,7 +16564,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing 1`] = ` Array [ Object { "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", @@ -16178,7 +16604,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByUnbounded 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByUnbounded 1`] = ` Array [ Object { "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", From 5e0be307bbcf6c257e06828003702a03106221fb Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 14:23:08 +0200 Subject: [PATCH 081/128] =?UTF-8?q?another=20fix=20in=C2=A0deserialization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/node_obj_deserializer.rs | 12 ++++ .../src/query_result_transform.rs | 25 ++++--- rust/cubeorchestrator/src/transport.rs | 68 +++++++------------ 3 files changed, 51 insertions(+), 54 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_obj_deserializer.rs b/packages/cubejs-backend-native/src/node_obj_deserializer.rs index 95787b4275665..2ba669048a8a1 100644 --- a/packages/cubejs-backend-native/src/node_obj_deserializer.rs +++ b/packages/cubejs-backend-native/src/node_obj_deserializer.rs @@ -130,6 +130,18 @@ impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> { || self.value.is_a::(self.cx) { visitor.visit_none() + } else if self.value.is_a::(self.cx) + { + // We can do nothing with the JS functions in native + // so let's save them as string for potential usage later + // in JS side if needed + let value = self + .value + .downcast::(self.cx) + .or_throw(self.cx)? + .to_string(self.cx)? + .value(self.cx); + visitor.visit_string(value) } else { Err(JsDeserializationError( "Unsupported type for deserialization".to_string(), diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 6eed13f7373ea..43972cde74d59 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -1,8 +1,8 @@ use crate::{ query_message_parser::QueryResult, transport::{ - AnnotatedConfigItem, ConfigItem, MembersMap, NormalizedQuery, QueryTimeDimension, - QueryType, ResultType, TransformDataRequest, + AnnotatedConfigItem, ConfigItem, MemberOrMemberExpression, MembersMap, NormalizedQuery, + QueryTimeDimension, QueryType, ResultType, TransformDataRequest, }, }; use anyhow::{bail, Context, Result}; @@ -162,10 +162,11 @@ pub fn get_members( let calc_member = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); if path.len() == 3 - && query - .dimensions - .as_ref() - .map_or(true, |dims| !dims.iter().any(|dim| *dim == calc_member)) + && query.dimensions.as_ref().map_or(true, |dims| { + !dims + .iter() + .any(|dim| *dim == MemberOrMemberExpression::Member(calc_member.clone())) + }) { members.insert(calc_member, column.clone()); } @@ -295,9 +296,11 @@ pub fn get_vanilla_row( format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); if path.len() == 3 && query.dimensions.as_ref().map_or(true, |dims| { - !dims - .iter() - .any(|dim| *dim == member_name_without_granularity) + !dims.iter().any(|dim| { + *dim == MemberOrMemberExpression::Member( + member_name_without_granularity.clone(), + ) + }) }) { row.insert(member_name_without_granularity, transformed_value); @@ -389,7 +392,9 @@ pub fn get_pivot_query( } } QueryType::CompareDateRangeQuery => { - let mut dimensions = vec!["compareDateRange".to_string()]; + let mut dimensions = vec![MemberOrMemberExpression::Member( + "compareDateRange".to_string(), + )]; if let Some(dims) = pivot_query.dimensions { dimensions.extend(dims.clone()); } diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index 46d2556786a4d..d595952a2fae7 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -82,14 +82,31 @@ pub struct GroupingSet { pub sub_id: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] +pub struct MemberExpression { + #[serde(skip_deserializing)] + pub expression: Option, + pub cube_name: String, + pub name: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub expression_name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub definition: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub grouping_set: Option, +} + #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct ParsedMemberExpression { pub expression: Vec, pub cube_name: String, pub name: String, - pub expression_name: String, - pub definition: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub expression_name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub definition: Option, #[serde(skip_serializing_if = "Option::is_none")] pub grouping_set: Option, } @@ -196,7 +213,8 @@ pub struct NormalizedQueryFilter { #[serde(untagged)] pub enum MemberOrMemberExpression { Member(String), - MemberExpression(ParsedMemberExpression), + ParsedMemberExpression(ParsedMemberExpression), + MemberExpression(MemberExpression), } #[derive(Debug, Clone, Serialize, Deserialize)] @@ -218,55 +236,17 @@ pub enum QueryFilterOrLogicalFilter { NormalizedQueryFilter(NormalizedQueryFilter), } -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Query { - // pub measures: Vec, - pub measures: Vec, - #[serde(skip_serializing_if = "Option::is_none")] - // pub dimensions: Option>, - pub dimensions: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub time_dimensions: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - // pub segments: Option>, - pub segments: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub offset: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub total: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub total_query: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub order: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub timezone: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub renew_query: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub ungrouped: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub response_format: Option, -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct NormalizedQuery { #[serde(skip_serializing_if = "Option::is_none")] - // pub measures: Vec, - pub measures: Option>, + pub measures: Option>, #[serde(skip_serializing_if = "Option::is_none")] - // pub dimensions: Option>, - pub dimensions: Option>, + pub dimensions: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub time_dimensions: Option>, - // pub segments: Option>, #[serde(skip_serializing_if = "Option::is_none")] - pub segments: Option>, + pub segments: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, #[serde(skip_serializing_if = "Option::is_none")] From f99e804bd240131c7fbb8a1127fff74dcf3e0c98 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 14:23:15 +0200 Subject: [PATCH 082/128] cargo fmt --- .../src/node_obj_deserializer.rs | 3 +- .../src/query_result_transform.rs | 34 ++++++++++++++----- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_obj_deserializer.rs b/packages/cubejs-backend-native/src/node_obj_deserializer.rs index 2ba669048a8a1..8540d2e3dbf8a 100644 --- a/packages/cubejs-backend-native/src/node_obj_deserializer.rs +++ b/packages/cubejs-backend-native/src/node_obj_deserializer.rs @@ -130,8 +130,7 @@ impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> { || self.value.is_a::(self.cx) { visitor.visit_none() - } else if self.value.is_a::(self.cx) - { + } else if self.value.is_a::(self.cx) { // We can do nothing with the JS functions in native // so let's save them as string for potential usage later // in JS side if needed diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 43972cde74d59..37aaa99cd5c77 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -26,26 +26,42 @@ pub const MEMBER_SEPARATOR: &str = "."; pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimitive { match value { DBResponseValue::DateTime(dt) if type_ == "time" || type_.is_empty() => { - DBResponsePrimitive::String(dt.with_timezone(&Utc).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + DBResponsePrimitive::String( + dt.with_timezone(&Utc) + .format("%Y-%m-%dT%H:%M:%S%.3f") + .to_string(), + ) } DBResponseValue::Primitive(DBResponsePrimitive::String(ref s)) if type_ == "time" => { let formatted = DateTime::parse_from_rfc3339(s) .map(|dt| dt.format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) .or_else(|_| { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f") - .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f").map(|dt| { + Utc.from_utc_datetime(&dt) + .format("%Y-%m-%dT%H:%M:%S%.3f") + .to_string() + }) }) .or_else(|_| { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S") - .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S").map(|dt| { + Utc.from_utc_datetime(&dt) + .format("%Y-%m-%dT%H:%M:%S%.3f") + .to_string() + }) }) .or_else(|_| { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z") - .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z").map(|dt| { + Utc.from_utc_datetime(&dt) + .format("%Y-%m-%dT%H:%M:%S%.3f") + .to_string() + }) }) .or_else(|_| { - NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %:z") - .map(|dt| Utc.from_utc_datetime(&dt).format("%Y-%m-%dT%H:%M:%S%.3f").to_string()) + NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %:z").map(|dt| { + Utc.from_utc_datetime(&dt) + .format("%Y-%m-%dT%H:%M:%S%.3f") + .to_string() + }) }) .unwrap_or_else(|_| s.clone()); DBResponsePrimitive::String(formatted) From 2401a89e2f606da81cc352dba5282251a35c0b7c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 15:00:46 +0200 Subject: [PATCH 083/128] =?UTF-8?q?another=20fix=20in=C2=A0datetime=20pars?= =?UTF-8?q?ing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/query_result_transform.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 37aaa99cd5c77..5d6295463d822 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -49,6 +49,13 @@ pub fn transform_value(value: DBResponseValue, type_: &str) -> DBResponsePrimiti .to_string() }) }) + .or_else(|_| { + NaiveDateTime::parse_from_str(s, "%Y-%m-%dT%H:%M:%S").map(|dt| { + Utc.from_utc_datetime(&dt) + .format("%Y-%m-%dT%H:%M:%S%.3f") + .to_string() + }) + }) .or_else(|_| { NaiveDateTime::parse_from_str(s, "%Y-%m-%d %H:%M:%S%.3f %Z").map(|dt| { Utc.from_utc_datetime(&dt) @@ -715,6 +722,19 @@ mod tests { ); } + #[test] + fn test_transform_value_string_wo_mssec_w_t_to_time_valid_rfc3339() { + let value = DBResponseValue::Primitive(DBResponsePrimitive::String( + "2024-01-01T12:30:15".to_string(), + )); + let result = transform_value(value, "time"); + + assert_eq!( + result, + DBResponsePrimitive::String("2024-01-01T12:30:15.000".to_string()) + ); + } + #[test] fn test_transform_value_string_with_tz_offset_to_time_valid_rfc3339() { let value = DBResponseValue::Primitive(DBResponsePrimitive::String( From 240e3886f942efef4c4a6a7e1ef511658aa009c4 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 15:02:03 +0200 Subject: [PATCH 084/128] update postgres-native-cubestore-response-full.test.ts.snap --- ...ative-cubestore-response-full.test.ts.snap | 377 +++++------------- 1 file changed, 91 insertions(+), 286 deletions(-) diff --git a/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap b/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap index 801a0174fbbc5..89df58fefe8ed 100644 --- a/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap +++ b/packages/cubejs-testing-drivers/test/__snapshots__/postgres-native-cubestore-response-full.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Complex Rollup: complex_rollup 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Complex Rollup: complex_rollup 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -1797,7 +1797,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Extended nested Rollup over asterisk: extended_nested_rollup_over_asterisk 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Extended nested Rollup over asterisk: extended_nested_rollup_over_asterisk 1`] = ` Array [ Object { "SUM(a.count)": "1", @@ -2247,7 +2247,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: NULLS FIRST/LAST SQL push down: nulls_first_last_sql_push_down 1`] = ` Array [ Object { "category": null, @@ -2261,7 +2261,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Nested Rollup over asterisk: nested_rollup_over_asterisk 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup over asterisk: nested_rollup_over_asterisk 1`] = ` Array [ Object { "SUM(a.count)": "1", @@ -3064,7 +3064,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Nested Rollup with aliases: nested_rollup_with_aliases 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup with aliases: nested_rollup_with_aliases 1`] = ` Array [ Object { "SUM(a.cnt)": "1", @@ -3867,7 +3867,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Nested Rollup: nested_rollup 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Nested Rollup: nested_rollup 1`] = ` Array [ Object { "SUM(a.cnt)": "1", @@ -4670,7 +4670,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Rollup over exprs: rollup_over_exprs 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Rollup over exprs: rollup_over_exprs 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -5473,7 +5473,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Rollup with aliases: rollup_with_aliases 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Rollup with aliases: rollup_with_aliases 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -7270,7 +7270,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: Simple Rollup: simple_rollup 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: Simple Rollup: simple_rollup 1`] = ` Array [ Object { "SUM(ECommerce.count)": "1", @@ -8073,7 +8073,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: metabase count cast to float32 from push down: metabase_count_cast_to_float32_from_push_down 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: metabase count cast to float32 from push down: metabase_count_cast_to_float32_from_push_down 1`] = ` Array [ Object { "a0": 41, @@ -8081,7 +8081,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: post-aggregate percentage of total: post_aggregate_percentage_of_total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: post-aggregate percentage of total: post_aggregate_percentage_of_total 1`] = ` Array [ Object { "SUM(BigECommerce.percentageOfTotalForStatus)": 100, @@ -8089,7 +8089,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: powerbi min max push down: powerbi_min_max_push_down 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: powerbi min max push down: powerbi_min_max_push_down 1`] = ` Array [ Object { "a0": 2020-12-25T00:00:00.000Z, @@ -8098,7 +8098,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: powerbi min max ungrouped flag: powerbi_min_max_ungrouped_flag 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: powerbi min max ungrouped flag: powerbi_min_max_ungrouped_flag 1`] = ` Array [ Object { "a0": "39", @@ -8108,7 +8108,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: reuse params: reuse_params 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: reuse params: reuse_params 1`] = ` Array [ Object { "c0": 2020-01-01T00:00:00.000Z, @@ -8117,7 +8117,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver SQL API: ungrouped pre-agg: ungrouped_pre_agg 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response SQL API: ungrouped pre-agg: ungrouped_pre_agg 1`] = ` Array [ Object { "productName": "Canon PC1080F Personal Copier", @@ -8298,7 +8298,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: contains + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8467,7 +8467,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: contains + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8636,9 +8636,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: contains + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: contains + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: endsWith filter + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AJ-10780", @@ -8735,7 +8735,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: endsWith filter + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8904,9 +8904,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: endsWith filter + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: endsWith filter + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notEndsWith filter + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -8983,9 +8983,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notEndsWith filter + dimensions, second 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, second 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notEndsWith filter + dimensions, third 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notEndsWith filter + dimensions, third 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9154,7 +9154,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notStartsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "BB-11545", @@ -9307,7 +9307,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notStartsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "CA-12775", @@ -9436,7 +9436,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: notStartsWith + dimensions, third 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: notStartsWith + dimensions, third 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9605,7 +9605,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: startsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, first 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9626,7 +9626,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: startsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, second 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -9671,9 +9671,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Customers: startsWith + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Customers: startsWith + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: contains dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, first 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -9708,7 +9708,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: contains dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, second 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -9833,9 +9833,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: contains dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: contains dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: endsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, first 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -9870,7 +9870,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: endsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, second 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -10055,9 +10055,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: endsWith + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: endsWith + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: startsWith + dimensions, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, first 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -10122,7 +10122,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: startsWith + dimensions, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, second 1`] = ` Array [ Object { "ECommerce.category": "Office Supplies", @@ -10292,9 +10292,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering ECommerce: startsWith + dimensions, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering ECommerce: startsWith + dimensions, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains + dimensions + order, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, first 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10309,7 +10309,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains + dimensions + order, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, second 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10334,9 +10334,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains + dimensions + order, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains + dimensions + order, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: contains with special chars + dimensions 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: contains with special chars + dimensions 1`] = ` Array [ Object { "Products.productName": "Logitech di_Novo Edge Keyboard", @@ -10344,7 +10344,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: endsWith filter + dimensions + order, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, first 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10429,7 +10429,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: endsWith filter + dimensions + order, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, second 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -10524,9 +10524,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: endsWith filter + dimensions + order, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: endsWith filter + dimensions + order, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: startsWith filter + dimensions + order, first 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, first 1`] = ` Array [ Object { "Products.category": "Office Supplies", @@ -10541,7 +10541,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: startsWith filter + dimensions + order, second 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, second 1`] = ` Array [ Object { "Products.category": "Office Supplies", @@ -10571,9 +10571,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver filtering Products: startsWith filter + dimensions + order, third 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response filtering Products: startsWith filter + dimensions + order, third 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver pre-aggregations Customers: running total without time dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response pre-aggregations Customers: running total without time dimension 1`] = ` Array [ Object { "Customers.runningTotal": "41", @@ -10581,7 +10581,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: null boolean 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: null boolean 1`] = ` Array [ Object { "BigECommerce.returning": null, @@ -10589,7 +10589,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: null sum 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: null sum 1`] = ` Array [ Object { "BigECommerce.totalSales": null, @@ -10597,7 +10597,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: partitioned pre-agg 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: partitioned pre-agg 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -10854,7 +10854,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: partitioned pre-agg with multi time dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: partitioned pre-agg with multi time dimension 1`] = ` Array [ Object { "BigECommerce.completedDate": "2020-01-02T00:00:00.000", @@ -11125,202 +11125,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling count_distinct_approx window by 2 day 1`] = ` -Array [ - Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-02-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-04-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-07-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-08-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": 1, - }, - Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, - Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Day": null, - }, -] -`; - -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling count_distinct_approx window by 2 month 1`] = ` -Array [ - Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 2, - }, - Object { - "BigECommerce.orderDate": "2020-02-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 3, - }, - Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 3, - }, - Object { - "BigECommerce.orderDate": "2020-04-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 3, - }, - Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 6, - }, - Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 12, - }, - Object { - "BigECommerce.orderDate": "2020-07-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 7, - }, - Object { - "BigECommerce.orderDate": "2020-08-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": null, - }, - Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 6, - }, - Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 9, - }, - Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 11, - }, - Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Month": 15, - }, -] -`; - -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling count_distinct_approx window by 2 week 1`] = ` -Array [ - Object { - "BigECommerce.orderDate": "2020-01-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-01-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 1, - }, - Object { - "BigECommerce.orderDate": "2020-02-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-02-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 1, - }, - Object { - "BigECommerce.orderDate": "2020-03-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-03-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 1, - }, - Object { - "BigECommerce.orderDate": "2020-04-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-04-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": null, - }, - Object { - "BigECommerce.orderDate": "2020-05-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-05-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 2, - }, - Object { - "BigECommerce.orderDate": "2020-06-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-06-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 3, - }, - Object { - "BigECommerce.orderDate": "2020-07-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-07-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": null, - }, - Object { - "BigECommerce.orderDate": "2020-08-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-08-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": null, - }, - Object { - "BigECommerce.orderDate": "2020-09-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-09-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 3, - }, - Object { - "BigECommerce.orderDate": "2020-10-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-10-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 2, - }, - Object { - "BigECommerce.orderDate": "2020-11-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-11-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 2, - }, - Object { - "BigECommerce.orderDate": "2020-12-01T00:00:00.000", - "BigECommerce.orderDate.month": "2020-12-01T00:00:00.000", - "BigECommerce.rollingCountApproxBy2Week": 2, - }, -] -`; - -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling window by 2 day 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 day 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -11385,7 +11190,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling window by 2 month 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 month 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -11450,7 +11255,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: rolling window by 2 week 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: rolling window by 2 week 1`] = ` Array [ Object { "BigECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -11515,9 +11320,9 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying BigECommerce: totalProfitYearAgo 1`] = `Array []`; +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying BigECommerce: totalProfitYearAgo 1`] = `Array []`; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + limit 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + limit 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11562,7 +11367,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order + limit + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + limit + total + offset 1`] = ` Array [ Object { "Customers.customerId": "GA-14725", @@ -11607,7 +11412,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order + limit + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + limit + total 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11652,7 +11457,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order + total + offset 1`] = ` Array [ Object { "Customers.customerId": "BS-11380", @@ -11661,7 +11466,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + order 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11830,7 +11635,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions + total 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -11999,7 +11804,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Customers: dimensions 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Customers: dimensions 1`] = ` Array [ Object { "Customers.customerId": "AH-10465", @@ -12168,7 +11973,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: count by cities + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: count by cities + order 1`] = ` Array [ Object { "ECommerce.city": "Columbus", @@ -12277,7 +12082,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + limit 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + limit 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -12432,7 +12237,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order + limit + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + limit + total + offset 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -12587,7 +12392,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order + limit + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + limit + total 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -12742,7 +12547,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order + total + offset 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order + total + offset 1`] = ` Array [ Object { "ECommerce.category": "Office Supplies", @@ -12762,7 +12567,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + order 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -13427,7 +13232,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions + total 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -14092,7 +13897,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: dimensions 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: dimensions 1`] = ` Array [ Object { "ECommerce.category": "Furniture", @@ -14757,7 +14562,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: partitioned pre-agg 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: partitioned pre-agg 1`] = ` Array [ Object { "ECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -15014,7 +14819,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: partitioned pre-agg higher granularity 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: partitioned pre-agg higher granularity 1`] = ` Array [ Object { "ECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -15187,7 +14992,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery 1`] = ` Array [ Object { "ECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -15252,7 +15057,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order + limit + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + limit + total 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -15307,7 +15112,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order + limit 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + limit 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -15362,7 +15167,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order + total 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order + total 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -15507,7 +15312,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying Products: dimensions + order 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying Products: dimensions + order 1`] = ` Array [ Object { "Products.category": "Furniture", @@ -15652,7 +15457,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + dimension 1`] = ` Array [ Object { "ECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -15855,7 +15660,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities (with preaggregation) ECommerce: totalQuantity by half_year + no dimension 1`] = ` Array [ Object { "ECommerce.orderDate": "2020-01-01T00:00:00.000", @@ -15875,7 +15680,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year + dimension 1`] = ` Array [ Object { "ECommerce.city": "Lorain", @@ -16060,7 +15865,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year + no dimension 1`] = ` Array [ Object { "ECommerce.count": "1", @@ -16080,7 +15885,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year_by_1st_april + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year_by_1st_april + dimension 1`] = ` Array [ Object { "ECommerce.city": "Decatur", @@ -16271,7 +16076,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by half_year_by_1st_april + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by half_year_by_1st_april + no dimension 1`] = ` Array [ Object { "ECommerce.count": "6", @@ -16291,7 +16096,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by three_months_by_march + dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by three_months_by_march + dimension 1`] = ` Array [ Object { "ECommerce.city": "Decatur", @@ -16494,7 +16299,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by three_months_by_march + no dimension 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by three_months_by_march + no dimension 1`] = ` Array [ Object { "ECommerce.count": "3", @@ -16524,7 +16329,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByLeading 1`] = ` Array [ Object { "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", @@ -16564,7 +16369,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByTrailing 1`] = ` Array [ Object { "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", @@ -16604,7 +16409,7 @@ Array [ ] `; -exports[`Queries with the @cubejs-backend/postgres-driver querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByUnbounded 1`] = ` +exports[`Queries with the @cubejs-backend/postgres-driver native-cubestore-response querying custom granularities ECommerce: count by two_mo_by_feb + no dimension + rollingCountByUnbounded 1`] = ` Array [ Object { "ECommerce.customOrderDateNoPreAgg": "2019-12-01T10:00:00.000", From 21f10c8e2eae5ee3e74d20ece34707142c4052f5 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 15:13:55 +0200 Subject: [PATCH 085/128] =?UTF-8?q?attempt=20to=C2=A0fix=20native=20build/?= =?UTF-8?q?test=20in=C2=A0docker-dev=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/drivers-tests.yml | 4 ++-- .github/workflows/push.yml | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/drivers-tests.yml b/.github/workflows/drivers-tests.yml index 72c07397cf35d..6401cc5dccc71 100644 --- a/.github/workflows/drivers-tests.yml +++ b/.github/workflows/drivers-tests.yml @@ -117,8 +117,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: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 45b8254bb044b..9207790e43cb4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -541,6 +541,8 @@ jobs: - 5000:5000 strategy: matrix: + node-version: [ 20 ] + target: [ "x86_64-unknown-linux-gnu" ] dockerfile: - dev.Dockerfile include: @@ -567,10 +569,29 @@ jobs: df -h - name: Checkout uses: actions/checkout@v4 - - name: Use Node.js 20.x + - 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: 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 cargo-cp-artifact@0.1 + - 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" @@ -582,8 +603,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: From 8870e50d7d1e1a071e8a5e64318d3c00a69694b8 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 15:37:04 +0200 Subject: [PATCH 086/128] add some comments --- .../cubejs-backend-native/src/node_obj_deserializer.rs | 10 +--------- rust/cubeorchestrator/src/transport.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/cubejs-backend-native/src/node_obj_deserializer.rs b/packages/cubejs-backend-native/src/node_obj_deserializer.rs index 8540d2e3dbf8a..d9ed815682792 100644 --- a/packages/cubejs-backend-native/src/node_obj_deserializer.rs +++ b/packages/cubejs-backend-native/src/node_obj_deserializer.rs @@ -132,15 +132,7 @@ impl<'de, 'a, 'b> Deserializer<'de> for JsValueDeserializer<'a, 'b> { visitor.visit_none() } else if self.value.is_a::(self.cx) { // We can do nothing with the JS functions in native - // so let's save them as string for potential usage later - // in JS side if needed - let value = self - .value - .downcast::(self.cx) - .or_throw(self.cx)? - .to_string(self.cx)? - .value(self.cx); - visitor.visit_string(value) + visitor.visit_none() } else { Err(JsDeserializationError( "Unsupported type for deserialization".to_string(), diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index d595952a2fae7..e7cf56044a4b2 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -82,11 +82,15 @@ pub struct GroupingSet { pub sub_id: Option, } +// We can do nothing with JS functions here, +// but to keep DTOs in sync with reality, let's keep it. +type JsFunction = String; + #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct MemberExpression { - #[serde(skip_deserializing)] - pub expression: Option, + // Made as Option and JsValueDeserializer set's it to None. + pub expression: Option, pub cube_name: String, pub name: String, #[serde(skip_serializing_if = "Option::is_none")] From 751d6e43fc3824a89856e0bc73e2e7b0ec7c4ef6 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 17:16:41 +0200 Subject: [PATCH 087/128] =?UTF-8?q?edits=20in=20result=20processing=20when?= =?UTF-8?q?=C2=A0streaming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 6 +++--- rust/cubeorchestrator/src/transport.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 8409f3448a26f..428485f528ddc 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1975,7 +1975,9 @@ class ApiGateway { }) ); - if (!request.streaming) { + if (request.streaming) { + res(results[0]); + } else { // We prepare the final json result on native side const [transformDataJson, rawData, resultDataJson] = (results as { transformDataParams: any; @@ -1991,8 +1993,6 @@ class ApiGateway { ); res(await getFinalQueryResultArray(transformDataJson, rawData, resultDataJson)); - } else { - res(results[0]); } } } catch (e: any) { diff --git a/rust/cubeorchestrator/src/transport.rs b/rust/cubeorchestrator/src/transport.rs index e7cf56044a4b2..5bcd358a28a40 100644 --- a/rust/cubeorchestrator/src/transport.rs +++ b/rust/cubeorchestrator/src/transport.rs @@ -84,7 +84,7 @@ pub struct GroupingSet { // We can do nothing with JS functions here, // but to keep DTOs in sync with reality, let's keep it. -type JsFunction = String; +pub type JsFunction = String; #[derive(Debug, Clone, Serialize, Deserialize, Hash, Eq, PartialEq)] #[serde(rename_all = "camelCase")] From dd7f6b8562fb12ef7385c2cfdc030f5bf5477a71 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 19:32:16 +0200 Subject: [PATCH 088/128] fix native response processing via websocket --- packages/cubejs-server/src/websocket-server.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-server/src/websocket-server.ts b/packages/cubejs-server/src/websocket-server.ts index 6e4b101ccd23d..971c04db1d19f 100644 --- a/packages/cubejs-server/src/websocket-server.ts +++ b/packages/cubejs-server/src/websocket-server.ts @@ -36,7 +36,21 @@ export class WebSocketServer { throw new Error(`Socket for ${connectionId} is not found found`); } - connectionIdToSocket[connectionId].send(JSON.stringify(message)); + let messageStr: string; + + if (message.message instanceof ArrayBuffer) { + // In case we already have a JSON-serialized query result, we don't want to parse/stringify + // it again - it's too expensive, instead we serialize the rest of the message and then + // inject query result json into message. + const resMsg = new TextDecoder().decode(message.message); + message.message = "~XXXXX~"; + messageStr = JSON.stringify(message); + messageStr = messageStr.replace(`"~XXXXX~"`, resMsg); + } else { + messageStr = JSON.stringify(message); + } + + connectionIdToSocket[connectionId].send(messageStr); }); this.wsServer.on('connection', (ws) => { From 677e5db338350019ac8975ad48cba6e8856413a5 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 18 Dec 2024 22:37:09 +0200 Subject: [PATCH 089/128] fix yarn lock --- yarn.lock | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/yarn.lock b/yarn.lock index 82230ebe0e521..e81a341037e3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5303,11 +5303,6 @@ tiny-invariant "^1.3.3" valid-url "^1.0.9" -"@cubejs-backend/cubesql@1.1.9": - version "1.1.9" - resolved "https://registry.yarnpkg.com/@cubejs-backend/cubesql/-/cubesql-1.1.9.tgz#d87e7ec0a0ff9776242ad7ba6015fbc68ccd0a47" - integrity sha512-3BFNxFQOY/hPBtLGrrSJ1xVVZsz1K/IzDXfdHyjSCOh38GOXHPy6tC77+MEIGcvjIrPO2me77FZ4P5cZjKGgKg== - "@cubejs-backend/dotenv@^9.0.2": version "9.0.2" resolved "https://registry.yarnpkg.com/@cubejs-backend/dotenv/-/dotenv-9.0.2.tgz#c3679091b702f0fd38de120c5a63943fcdc0dcbf" @@ -5324,15 +5319,6 @@ uuid "9.0.0" winston "3.8.2" -"@cubejs-backend/native@1.1.9": - version "1.1.9" - resolved "https://registry.yarnpkg.com/@cubejs-backend/native/-/native-1.1.9.tgz#66cec2caa56ae6a9369c042ddfaf0896ec2d80c9" - integrity sha512-HA9yVlI0UDvKbKjKK+cFmGgSbUfwIyp41X1q+NATzmWGFFVlzth3iS2YJ/H7Mshng6FqmCphzmshaGrSWs4cCw== - dependencies: - "@cubejs-backend/cubesql" "1.1.9" - "@cubejs-backend/shared" "1.1.8" - "@cubejs-infra/post-installer" "^0.0.7" - "@cubejs-backend/shared@0.33.20": version "0.33.20" resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-0.33.20.tgz#3d9fa60041599cca9fe4c04df05daa4b8ab8675f" @@ -5353,26 +5339,6 @@ throttle-debounce "^3.0.1" uuid "^8.3.2" -"@cubejs-backend/shared@1.1.8": - version "1.1.8" - resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-1.1.8.tgz#3bca511f0f779edc22c2f684a7f76bc52577e9a1" - integrity sha512-DtW4w3ha/nsgWYPwWPvifmMNEHM85Kdv2jg/apZaqTd4HtgXzX71GNSrz2dH03gihuJnYsZBZrZMpqYjdZkKdA== - dependencies: - "@oclif/color" "^0.1.2" - bytes "^3.1.0" - cli-progress "^3.9.0" - cross-spawn "^7.0.3" - decompress "^4.2.1" - env-var "^6.3.0" - fs-extra "^9.1.0" - http-proxy-agent "^4.0.1" - moment-range "^4.0.1" - moment-timezone "^0.5.33" - node-fetch "^2.6.1" - shelljs "^0.8.5" - throttle-debounce "^3.0.1" - uuid "^8.3.2" - "@cubejs-infra/post-installer@^0.0.7": version "0.0.7" resolved "https://registry.yarnpkg.com/@cubejs-infra/post-installer/-/post-installer-0.0.7.tgz#a28d2d03e5b7b69a64020d75194a7078cf911d2d" From cfb2f45d1579f2884f48969dd1c07bac75b44829 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 19 Dec 2024 11:37:50 +0200 Subject: [PATCH 090/128] =?UTF-8?q?attempt=20to=C2=A0fix=20native=20build/?= =?UTF-8?q?test=20in=C2=A0cloud=20integration=20tests=20in=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cloud.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/cloud.yml b/.github/workflows/cloud.yml index 81ea469639f83..528c4b5eedf01 100644 --- a/.github/workflows/cloud.yml +++ b/.github/workflows/cloud.yml @@ -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 cargo-cp-artifact@0.1 + - 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" @@ -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: From fdaad921f7b4d101c884577c5ffa8de8e33b2041 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 19 Dec 2024 20:23:51 +0200 Subject: [PATCH 091/128] =?UTF-8?q?recreated=20unit=20tests=20for=C2=A0tra?= =?UTF-8?q?nsform=20data=20in=C2=A0native?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/helpers/transformData.test.ts | 1337 --------------- .../src/query_result_transform.rs | 1518 ++++++++++++++++- 2 files changed, 1507 insertions(+), 1348 deletions(-) delete mode 100644 packages/cubejs-api-gateway/test/helpers/transformData.test.ts diff --git a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts b/packages/cubejs-api-gateway/test/helpers/transformData.test.ts deleted file mode 100644 index 52d637817bf7d..0000000000000 --- a/packages/cubejs-api-gateway/test/helpers/transformData.test.ts +++ /dev/null @@ -1,1337 +0,0 @@ -/** - * @license Apache-2.0 - * @copyright Cube Dev, Inc. - * @fileoverview transformData related helpers unit tests. - */ - -/* globals describe,test,expect */ -/* eslint-disable import/no-duplicates */ -/* eslint-disable @typescript-eslint/no-duplicate-imports */ - -import { - QueryTimeDimension, - NormalizedQuery, -} from '../../src/types/query'; -import { - QueryType as QueryTypeEnum, - ResultType as ResultTypeEnum, -} from '../../src/types/enums'; -import { - ConfigItem, -} from '../../src/helpers/prepareAnnotation'; -import transformDataDefault - from '../../src/helpers/transformData'; -import { - COMPARE_DATE_RANGE_FIELD, - COMPARE_DATE_RANGE_SEPARATOR, - BLENDING_QUERY_KEY_PREFIX, - BLENDING_QUERY_RES_SEPARATOR, - MEMBER_SEPARATOR, - getDateRangeValue, - getBlendingQueryKey, - getBlendingResponseKey, - getMembers, - getCompactRow, - getVanillaRow, - transformData, -} from '../../src/helpers/transformData'; -import { - QueryType, -} from '../../src/types/strings'; -import { DBResponseValue } from '../../src/types/responses'; - -const mockData = { - regular_discount_by_city: { - query: { - dimensions: [ - 'ECommerceRecordsUs2021.city' - ], - measures: [ - 'ECommerceRecordsUs2021.avg_discount' - ], - limit: 2 - }, - data: { - aliasToMemberNameMap: { - e_commerce_records_us2021__avg_discount: 'ECommerceRecordsUs2021.avg_discount', - e_commerce_records_us2021__city: 'ECommerceRecordsUs2021.city' - }, - annotation: { - 'ECommerceRecordsUs2021.avg_discount': { - title: 'E Commerce Records Us2021 Avg Discount', - shortTitle: 'Avg Discount', - type: 'number', - drillMembers: [], - drillMembersGrouped: { - measures: [], - dimensions: [] - } - }, - 'ECommerceRecordsUs2021.city': { - title: 'E Commerce Records Us2021 City', - shortTitle: 'City', - type: 'string' - } - }, - data: [ - { - e_commerce_records_us2021__city: 'Missouri City', - e_commerce_records_us2021__avg_discount: '0.80000000000000000000' - }, - { - e_commerce_records_us2021__city: 'Abilene', - e_commerce_records_us2021__avg_discount: '0.80000000000000000000' - } - ], - query: { - dimensions: [ - 'ECommerceRecordsUs2021.city' - ], - measures: [ - 'ECommerceRecordsUs2021.avg_discount' - ], - limit: 2, - rowLimit: 2, - timezone: 'UTC', - order: [], - filters: [], - timeDimensions: [] - }, - queryType: 'regularQuery', - result_default: [ - { - 'ECommerceRecordsUs2021.city': 'Missouri City', - 'ECommerceRecordsUs2021.avg_discount': '0.80000000000000000000' - }, - { - 'ECommerceRecordsUs2021.city': 'Abilene', - 'ECommerceRecordsUs2021.avg_discount': '0.80000000000000000000' - } - ], - result_compact: { - members: ['ECommerceRecordsUs2021.city', 'ECommerceRecordsUs2021.avg_discount'], - dataset: [['Missouri City', '0.80000000000000000000'], ['Abilene', '0.80000000000000000000']], - } - } - }, - regular_profit_by_postal_code: { - query: { - dimensions: [ - 'ECommerceRecordsUs2021.postalCode' - ], - measures: [ - 'ECommerceRecordsUs2021.avg_profit' - ], - limit: 2 - }, - data: { - aliasToMemberNameMap: { - e_commerce_records_us2021__avg_profit: 'ECommerceRecordsUs2021.avg_profit', - e_commerce_records_us2021__postal_code: 'ECommerceRecordsUs2021.postalCode' - }, - annotation: { - 'ECommerceRecordsUs2021.avg_profit': { - title: 'E Commerce Records Us2021 Avg Profit', - shortTitle: 'Avg Profit', - type: 'number', - drillMembers: [], - drillMembersGrouped: { - measures: [], - dimensions: [] - } - }, - 'ECommerceRecordsUs2021.postalCode': { - title: 'E Commerce Records Us2021 Postal Code', - shortTitle: 'Postal Code', - type: 'string' - } - }, - data: [ - { - e_commerce_records_us2021__postal_code: '95823', - e_commerce_records_us2021__avg_profit: '646.1258666666666667' - }, - { - e_commerce_records_us2021__postal_code: '64055', - e_commerce_records_us2021__avg_profit: '487.8315000000000000' - } - ], - query: { - dimensions: [ - 'ECommerceRecordsUs2021.postalCode' - ], - measures: [ - 'ECommerceRecordsUs2021.avg_profit' - ], - limit: 2, - rowLimit: 2, - timezone: 'UTC', - order: [], - filters: [], - timeDimensions: [] - }, - queryType: 'regularQuery', - result_default: [ - { - 'ECommerceRecordsUs2021.postalCode': '95823', - 'ECommerceRecordsUs2021.avg_profit': '646.1258666666666667' - }, - { - 'ECommerceRecordsUs2021.postalCode': '64055', - 'ECommerceRecordsUs2021.avg_profit': '487.8315000000000000' - } - ], - result_compact: { - members: [ - 'ECommerceRecordsUs2021.postalCode', - 'ECommerceRecordsUs2021.avg_profit', - ], - dataset: [ - ['95823', '646.1258666666666667'], - ['64055', '487.8315000000000000'] - ], - } - } - }, - compare_date_range_count_by_order_date: { - http_params: { - queryType: 'whatever value or nothing, \'multi\' to apply pivot transformation' - }, - query: { - measures: ['ECommerceRecordsUs2021.count'], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'day', - compareDateRange: [ - ['2020-01-01', '2020-01-31'], - ['2020-03-01', '2020-03-31'] - ] - } - ], - limit: 2 - }, - data: [{ - aliasToMemberNameMap: { - e_commerce_records_us2021__count: 'ECommerceRecordsUs2021.count', - e_commerce_records_us2021__order_date_day: 'ECommerceRecordsUs2021.orderDate.day' - }, - annotation: { - 'ECommerceRecordsUs2021.count': { - title: 'E Commerce Records Us2021 Count', - shortTitle: 'Count', - type: 'number', - drillMembers: [ - 'ECommerceRecordsUs2021.city', - 'ECommerceRecordsUs2021.country', - 'ECommerceRecordsUs2021.customerId', - 'ECommerceRecordsUs2021.orderId', - 'ECommerceRecordsUs2021.productId', - 'ECommerceRecordsUs2021.productName', - 'ECommerceRecordsUs2021.orderDate' - ], - drillMembersGrouped: { - measures: [], - dimensions: [ - 'ECommerceRecordsUs2021.city', - 'ECommerceRecordsUs2021.country', - 'ECommerceRecordsUs2021.customerId', - 'ECommerceRecordsUs2021.orderId', - 'ECommerceRecordsUs2021.productId', - 'ECommerceRecordsUs2021.productName', - 'ECommerceRecordsUs2021.orderDate' - ] - } - }, - 'ECommerceRecordsUs2021.orderDate.day': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - }, - 'ECommerceRecordsUs2021.orderDate': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - } - }, - data: [ - { - e_commerce_records_us2021__order_date_day: '2020-01-01T00:00:00.000', - e_commerce_records_us2021__count: '10' - }, - { - e_commerce_records_us2021__order_date_day: '2020-01-02T00:00:00.000', - e_commerce_records_us2021__count: '8' - } - ], - query: { - measures: [ - 'ECommerceRecordsUs2021.count' - ], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'day', - dateRange: [ - '2020-01-01T00:00:00.000', - '2020-01-31T23:59:59.999' - ] - } - ], - limit: 2, - rowLimit: 2, - timezone: 'UTC', - order: [], - filters: [], - dimensions: [] - }, - queryType: 'compareDateRangeQuery', - result_default: [ - { - 'ECommerceRecordsUs2021.orderDate.day': '2020-01-01T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-01-01T00:00:00.000', - 'ECommerceRecordsUs2021.count': '10', - compareDateRange: '2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999' - }, - { - 'ECommerceRecordsUs2021.orderDate.day': '2020-01-02T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-01-02T00:00:00.000', - 'ECommerceRecordsUs2021.count': '8', - compareDateRange: '2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999' - } - ], - result_compact: { - members: [ - 'ECommerceRecordsUs2021.orderDate.day', - 'ECommerceRecordsUs2021.orderDate', - 'ECommerceRecordsUs2021.count', - 'compareDateRange', - ], - dataset: [ - [ - '2020-01-01T00:00:00.000', - '2020-01-01T00:00:00.000', - '10', - '2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999', - ], - [ - '2020-01-02T00:00:00.000', - '2020-01-02T00:00:00.000', - '8', - '2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999' - ], - ], - }, - }, { - aliasToMemberNameMap: { - e_commerce_records_us2021__count: 'ECommerceRecordsUs2021.count', - e_commerce_records_us2021__order_date_day: 'ECommerceRecordsUs2021.orderDate.day' - }, - annotation: { - 'ECommerceRecordsUs2021.count': { - title: 'E Commerce Records Us2021 Count', - shortTitle: 'Count', - type: 'number', - drillMembers: [ - 'ECommerceRecordsUs2021.city', - 'ECommerceRecordsUs2021.country', - 'ECommerceRecordsUs2021.customerId', - 'ECommerceRecordsUs2021.orderId', - 'ECommerceRecordsUs2021.productId', - 'ECommerceRecordsUs2021.productName', - 'ECommerceRecordsUs2021.orderDate' - ], - drillMembersGrouped: { - measures: [], - dimensions: [ - 'ECommerceRecordsUs2021.city', - 'ECommerceRecordsUs2021.country', - 'ECommerceRecordsUs2021.customerId', - 'ECommerceRecordsUs2021.orderId', - 'ECommerceRecordsUs2021.productId', - 'ECommerceRecordsUs2021.productName', - 'ECommerceRecordsUs2021.orderDate' - ] - } - }, - 'ECommerceRecordsUs2021.orderDate.day': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - }, - 'ECommerceRecordsUs2021.orderDate': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - } - }, - data: [ - { - e_commerce_records_us2021__order_date_day: '2020-03-02T00:00:00.000', - e_commerce_records_us2021__count: '11' - }, - { - e_commerce_records_us2021__order_date_day: '2020-03-03T00:00:00.000', - e_commerce_records_us2021__count: '7' - } - ], - query: { - measures: [ - 'ECommerceRecordsUs2021.count' - ], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'day', - dateRange: [ - '2020-03-01T00:00:00.000', - '2020-03-31T23:59:59.999' - ] - } - ], - limit: 2, - rowLimit: 2, - timezone: 'UTC', - order: [], - filters: [], - dimensions: [] - }, - queryType: 'compareDateRangeQuery', - result_default: [ - { - 'ECommerceRecordsUs2021.orderDate.day': '2020-03-02T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-03-02T00:00:00.000', - 'ECommerceRecordsUs2021.count': '11', - compareDateRange: '2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999' - }, - { - 'ECommerceRecordsUs2021.orderDate.day': '2020-03-03T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-03-03T00:00:00.000', - 'ECommerceRecordsUs2021.count': '7', - compareDateRange: '2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999' - } - ], - result_compact: { - members: [ - 'ECommerceRecordsUs2021.orderDate.day', - 'ECommerceRecordsUs2021.orderDate', - 'ECommerceRecordsUs2021.count', - 'compareDateRange', - ], - dataset: [ - [ - '2020-03-02T00:00:00.000', - '2020-03-02T00:00:00.000', - '11', - '2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999', - ], - [ - '2020-03-03T00:00:00.000', - '2020-03-03T00:00:00.000', - '7', - '2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999' - ], - ], - }, - }] - }, - blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode: { - http_params: { - queryType: 'whatever value or nothing, \'multi\' to apply pivot transformation' - }, - query: [{ - measures: ['ECommerceRecordsUs2021.avg_discount'], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'month', - dateRange: ['2020-01-01', '2020-12-30'] - } - ], - filters: [{ - member: 'ECommerceRecordsUs2021.shipMode', - operator: 'equals', - values: ['Standard Class'] - }], - limit: 2 - }, { - measures: ['ECommerceRecordsUs2021.avg_discount'], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'month', - dateRange: ['2020-01-01', '2020-12-30'] - } - ], - filters: [{ - member: 'ECommerceRecordsUs2021.shipMode', - operator: 'equals', - values: ['First Class'] - }], - limit: 2 - }], - data: [{ - aliasToMemberNameMap: { - e_commerce_records_us2021__avg_discount: 'ECommerceRecordsUs2021.avg_discount', - e_commerce_records_us2021__order_date_month: 'ECommerceRecordsUs2021.orderDate.month' - }, - annotation: { - 'ECommerceRecordsUs2021.avg_discount': { - title: 'E Commerce Records Us2021 Avg Discount', - shortTitle: 'Avg Discount', - type: 'number', - drillMembers: [], - drillMembersGrouped: { - measures: [], - dimensions: [] - } - }, - 'ECommerceRecordsUs2021.orderDate.month': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - }, - 'ECommerceRecordsUs2021.orderDate': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - } - }, - data: [ - { - e_commerce_records_us2021__order_date_month: '2020-01-01T00:00:00.000', - e_commerce_records_us2021__avg_discount: '0.15638297872340425532' - }, - { - e_commerce_records_us2021__order_date_month: '2020-02-01T00:00:00.000', - e_commerce_records_us2021__avg_discount: '0.17573529411764705882' - } - ], - query: { - measures: [ - 'ECommerceRecordsUs2021.avg_discount' - ], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'month', - dateRange: [ - '2020-01-01T00:00:00.000', - '2020-12-30T23:59:59.999' - ] - } - ], - filters: [ - { - operator: 'equals', - values: [ - 'Standard Class' - ], - member: 'ECommerceRecordsUs2021.shipMode' - } - ], - limit: 2, - rowLimit: 2, - timezone: 'UTC', - order: [], - dimensions: [] - }, - queryType: 'blendingQuery', - result_default: [ - { - 'ECommerceRecordsUs2021.orderDate.month': '2020-01-01T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-01-01T00:00:00.000', - 'ECommerceRecordsUs2021.avg_discount': '0.15638297872340425532', - 'time.month': '2020-01-01T00:00:00.000' - }, - { - 'ECommerceRecordsUs2021.orderDate.month': '2020-02-01T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-02-01T00:00:00.000', - 'ECommerceRecordsUs2021.avg_discount': '0.17573529411764705882', - 'time.month': '2020-02-01T00:00:00.000' - } - ], - result_compact: { - members: [ - 'ECommerceRecordsUs2021.orderDate.month', - 'ECommerceRecordsUs2021.orderDate', - 'ECommerceRecordsUs2021.avg_discount', - 'time.month', - ], - dataset: [ - [ - '2020-01-01T00:00:00.000', - '2020-01-01T00:00:00.000', - '0.15638297872340425532', - '2020-01-01T00:00:00.000', - ], - [ - '2020-02-01T00:00:00.000', - '2020-02-01T00:00:00.000', - '0.17573529411764705882', - '2020-02-01T00:00:00.000', - ], - ], - }, - }, { - aliasToMemberNameMap: { - e_commerce_records_us2021__avg_discount: 'ECommerceRecordsUs2021.avg_discount', - e_commerce_records_us2021__order_date_month: 'ECommerceRecordsUs2021.orderDate.month' - }, - annotation: { - 'ECommerceRecordsUs2021.avg_discount': { - title: 'E Commerce Records Us2021 Avg Discount', - shortTitle: 'Avg Discount', - type: 'number', - drillMembers: [], - drillMembersGrouped: { - measures: [], - dimensions: [] - } - }, - 'ECommerceRecordsUs2021.orderDate.month': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - }, - 'ECommerceRecordsUs2021.orderDate': { - title: 'E Commerce Records Us2021 Order Date', - shortTitle: 'Order Date', - type: 'time' - } - }, - data: [ - { - e_commerce_records_us2021__order_date_month: '2020-01-01T00:00:00.000', - e_commerce_records_us2021__avg_discount: '0.28571428571428571429' - }, - { - e_commerce_records_us2021__order_date_month: '2020-02-01T00:00:00.000', - e_commerce_records_us2021__avg_discount: '0.21777777777777777778' - } - ], - query: { - measures: [ - 'ECommerceRecordsUs2021.avg_discount' - ], - timeDimensions: [ - { - dimension: 'ECommerceRecordsUs2021.orderDate', - granularity: 'month', - dateRange: [ - '2020-01-01T00:00:00.000', - '2020-12-30T23:59:59.999' - ] - } - ], - filters: [ - { - operator: 'equals', - values: [ - 'First Class' - ], - member: 'ECommerceRecordsUs2021.shipMode' - } - ], - limit: 2, - rowLimit: 2, - timezone: 'UTC', - order: [], - dimensions: [] - }, - queryType: 'blendingQuery', - result_default: [{ - 'ECommerceRecordsUs2021.orderDate.month': '2020-01-01T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-01-01T00:00:00.000', - 'ECommerceRecordsUs2021.avg_discount': '0.28571428571428571429', - 'time.month': '2020-01-01T00:00:00.000' - }, - { - 'ECommerceRecordsUs2021.orderDate.month': '2020-02-01T00:00:00.000', - 'ECommerceRecordsUs2021.orderDate': '2020-02-01T00:00:00.000', - 'ECommerceRecordsUs2021.avg_discount': '0.21777777777777777778', - 'time.month': '2020-02-01T00:00:00.000' - }], - result_compact: { - members: [ - 'ECommerceRecordsUs2021.orderDate.month', - 'ECommerceRecordsUs2021.orderDate', - 'ECommerceRecordsUs2021.avg_discount', - 'time.month', - ], - dataset: [ - [ - '2020-01-01T00:00:00.000', - '2020-01-01T00:00:00.000', - '0.28571428571428571429', - '2020-01-01T00:00:00.000', - ], - [ - '2020-02-01T00:00:00.000', - '2020-02-01T00:00:00.000', - '0.21777777777777777778', - '2020-02-01T00:00:00.000', - ], - ], - }, - }] - } -}; - -describe('transformData helpers', () => { - test('export looks as expected', () => { - expect(transformDataDefault).toBeDefined(); - expect(COMPARE_DATE_RANGE_FIELD).toBeDefined(); - expect(COMPARE_DATE_RANGE_SEPARATOR).toBeDefined(); - expect(BLENDING_QUERY_KEY_PREFIX).toBeDefined(); - expect(BLENDING_QUERY_RES_SEPARATOR).toBeDefined(); - expect(MEMBER_SEPARATOR).toBeDefined(); - expect(getDateRangeValue).toBeDefined(); - expect(getBlendingQueryKey).toBeDefined(); - expect(getBlendingResponseKey).toBeDefined(); - expect(getMembers).toBeDefined(); - expect(getCompactRow).toBeDefined(); - expect(getVanillaRow).toBeDefined(); - expect(transformData).toBeDefined(); - expect(transformData).toEqual(transformDataDefault); - }); - - test('getDateRangeValue helper', () => { - const timeDimensions = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data[0] - .query - .timeDimensions - ) - ) as QueryTimeDimension[]; - - expect(() => { getDateRangeValue(); }).toThrow( - 'QueryTimeDimension should be specified ' + - 'for the compare date range query.' - ); - - expect(() => { - getDateRangeValue([ - { prop: 'val' } as unknown as QueryTimeDimension - ]); - }).toThrow( - `${'Inconsistent QueryTimeDimension configuration ' + - 'for the compare date range query, dateRange required: '}${ - ({ prop: 'val' }).toString()}` - ); - - expect(() => { - getDateRangeValue([ - { dateRange: 'val' } as unknown as QueryTimeDimension - ]); - }).toThrow( - 'Inconsistent dateRange configuration for the ' + - 'compare date range query: val' - ); - - expect(getDateRangeValue(timeDimensions)).toEqual( - `${ - // @ts-ignore - timeDimensions[0].dateRange[0] - }${ - COMPARE_DATE_RANGE_SEPARATOR - }${ - // @ts-ignore - timeDimensions[0].dateRange[1] - }` - ); - }); - - test('getBlendingQueryKey helper', () => { - const timeDimensions = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data[0] - .query - .timeDimensions - ) - ) as QueryTimeDimension[]; - - expect(() => { - getBlendingQueryKey(); - }).toThrow( - 'QueryTimeDimension should be specified ' + - 'for the blending query.' - ); - - expect(() => { - getBlendingQueryKey([ - { prop: 'val' } as unknown as QueryTimeDimension - ]); - }).toThrow( - 'Inconsistent QueryTimeDimension configuration ' + - `for the blending query, granularity required: ${ - ({ prop: 'val' }).toString()}` - ); - - expect(getBlendingQueryKey(timeDimensions)) - .toEqual(`${ - BLENDING_QUERY_KEY_PREFIX - }${ - timeDimensions[0].granularity - }`); - }); - - test('getBlendingResponseKey helper', () => { - const timeDimensions = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data[0] - .query - .timeDimensions - ) - ) as QueryTimeDimension[]; - - expect(() => { - getBlendingResponseKey(); - }).toThrow( - 'QueryTimeDimension should be specified ' + - 'for the blending query.' - ); - - expect(() => { - getBlendingResponseKey([ - { prop: 'val' } as unknown as QueryTimeDimension - ]); - }).toThrow( - 'Inconsistent QueryTimeDimension configuration ' + - `for the blending query, granularity required: ${ - ({ prop: 'val' }).toString()}` - ); - - expect(() => { - getBlendingResponseKey([ - { granularity: 'day' } as unknown as QueryTimeDimension - ]); - }).toThrow( - 'Inconsistent QueryTimeDimension configuration ' + - `for the blending query, dimension required: ${ - ({ granularity: 'day' }).toString()}` - ); - - expect(getBlendingResponseKey(timeDimensions)) - .toEqual(`${ - timeDimensions[0].dimension - }${ - BLENDING_QUERY_RES_SEPARATOR - }${ - timeDimensions[0].granularity - }`); - }); - - test('getMembers helper', () => { - let data; - - // throw - data = JSON.parse( - JSON.stringify(mockData.regular_profit_by_postal_code.data) - ); - data.aliasToMemberNameMap = {}; - expect(() => { - getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - ); - }).toThrow( - 'You requested hidden member: \'e_commerce_records_us2021__postal_code\'. ' + - 'Please make it visible using `shown: true`. Please note primaryKey fields are ' + - '`shown: false` by default: ' + - 'https://cube.dev/docs/schema/reference/joins#setting-a-primary-key.' - ); - - // regular - data = JSON.parse( - JSON.stringify(mockData.regular_profit_by_postal_code.data) - ); - data.data = []; - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({}); - - data = JSON.parse( - JSON.stringify(mockData.regular_profit_by_postal_code.data) - ); - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({ - 'ECommerceRecordsUs2021.postalCode': 'e_commerce_records_us2021__postal_code', - 'ECommerceRecordsUs2021.avg_profit': 'e_commerce_records_us2021__avg_profit' - }); - - // compare date range - data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data[0]) - ); - data.data = []; - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({}); - - data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data[0]) - ); - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({ - 'ECommerceRecordsUs2021.orderDate.day': 'e_commerce_records_us2021__order_date_day', - 'ECommerceRecordsUs2021.orderDate': 'e_commerce_records_us2021__order_date_day', - 'ECommerceRecordsUs2021.count': 'e_commerce_records_us2021__count', - compareDateRange: 'compareDateRangeQuery', - }); - - data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data[1]) - ); - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({ - 'ECommerceRecordsUs2021.orderDate.day': 'e_commerce_records_us2021__order_date_day', - 'ECommerceRecordsUs2021.orderDate': 'e_commerce_records_us2021__order_date_day', - 'ECommerceRecordsUs2021.count': 'e_commerce_records_us2021__count', - compareDateRange: 'compareDateRangeQuery', - }); - - // blending - data = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data[0] - ) - ); - data.data = []; - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({}); - - data = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data[0] - ) - ); - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({ - 'ECommerceRecordsUs2021.orderDate.month': 'e_commerce_records_us2021__order_date_month', - 'ECommerceRecordsUs2021.orderDate': 'e_commerce_records_us2021__order_date_month', - 'ECommerceRecordsUs2021.avg_discount': 'e_commerce_records_us2021__avg_discount', - 'time.month': 'e_commerce_records_us2021__order_date_month', - }); - - data = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data[1] - ) - ); - expect(getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - )).toEqual({ - 'ECommerceRecordsUs2021.orderDate.month': 'e_commerce_records_us2021__order_date_month', - 'ECommerceRecordsUs2021.orderDate': 'e_commerce_records_us2021__order_date_month', - 'ECommerceRecordsUs2021.avg_discount': 'e_commerce_records_us2021__avg_discount', - 'time.month': 'e_commerce_records_us2021__order_date_month', - }); - }); - - test('getCompactRow helper', () => { - let data; - let membersMap; - let members; - - // regular - data = JSON.parse( - JSON.stringify(mockData.regular_profit_by_postal_code.data) - ); - membersMap = getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - ); - members = Object.keys(membersMap); - expect(getCompactRow( - membersMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.queryType as QueryType, - members, - data.query.timeDimensions as QueryTimeDimension[], - data.data[0], - )).toEqual(['95823', '646.1258666666666667']); - - data = JSON.parse( - JSON.stringify(mockData.regular_discount_by_city.data) - ); - membersMap = getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - ); - members = Object.keys(membersMap); - expect(getCompactRow( - membersMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.queryType as QueryType, - members, - data.query.timeDimensions as QueryTimeDimension[], - data.data[0], - )).toEqual(['Missouri City', '0.80000000000000000000']); - - // compare date range - data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data[0]) - ); - membersMap = getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - ); - members = Object.keys(membersMap); - expect(getCompactRow( - membersMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.queryType as QueryType, - members, - data.query.timeDimensions as QueryTimeDimension[], - data.data[0], - )).toEqual([ - '2020-01-01T00:00:00.000', - '2020-01-01T00:00:00.000', - '10', - '2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999' - ]); - - data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data[0]) - ); - membersMap = getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - ); - members = Object.keys(membersMap); - expect(getCompactRow( - membersMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.queryType as QueryType, - members, - data.query.timeDimensions as QueryTimeDimension[], - data.data[1], - )).toEqual([ - '2020-01-02T00:00:00.000', - '2020-01-02T00:00:00.000', - '8', - '2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999' - ]); - - // blending - data = JSON.parse( - JSON.stringify(mockData.blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode.data[0]) - ); - membersMap = getMembers( - data.queryType as QueryTypeEnum, - data.query as unknown as NormalizedQuery, - data.data as { [sqlAlias: string]: DBResponseValue }[], - data.aliasToMemberNameMap, - data.annotation, - ); - members = Object.keys(membersMap); - expect(getCompactRow( - membersMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.queryType as QueryType, - members, - data.query.timeDimensions as QueryTimeDimension[], - data.data[0], - )).toEqual([ - '2020-01-01T00:00:00.000', - '2020-01-01T00:00:00.000', - '0.15638297872340425532', - '2020-01-01T00:00:00.000', - ]); - }); - - test('getVanilaRow helper', () => { - const data = JSON.parse( - JSON.stringify(mockData.regular_discount_by_city.data) - ); - delete data.aliasToMemberNameMap.e_commerce_records_us2021__avg_discount; - expect(() => getVanillaRow( - data.aliasToMemberNameMap, - data.annotation as unknown as { [member: string]: ConfigItem }, - data.queryType as QueryType, - data.query as unknown as NormalizedQuery, - data.data[0], - )).toThrow( - 'You requested hidden member: \'e_commerce_records_us2021__avg_discount\'. ' + - 'Please make it visible using `shown: true`. Please note ' + - 'primaryKey fields are `shown: false` by default: ' + - 'https://cube.dev/docs/schema/reference/joins#setting-a-primary-key.' - ); - }); -}); - -describe('transformData default mode', () => { - test('regular discount by city', () => { - let data; - - data = JSON.parse( - JSON.stringify(mockData.regular_discount_by_city.data) - ); - delete data.aliasToMemberNameMap.e_commerce_records_us2021__avg_discount; - expect(() => transformData({ - aliasToMemberNameMap: data.aliasToMemberNameMap, - annotation: data.annotation as unknown as { [member: string]: ConfigItem }, - data: data.data, - query: data.query as unknown as NormalizedQuery, - queryType: data.queryType as QueryType, - })).toThrow(); - - data = JSON.parse( - JSON.stringify(mockData.regular_discount_by_city.data) - ); - expect( - transformData({ - aliasToMemberNameMap: data.aliasToMemberNameMap, - annotation: data.annotation as unknown as { [member: string]: ConfigItem }, - data: data.data, - query: data.query as unknown as NormalizedQuery, - queryType: data.queryType as QueryType, - }) - ).toEqual(data.result_default); - }); - - test('regular profit by postal code', () => { - const data = JSON.parse( - JSON.stringify(mockData.regular_profit_by_postal_code.data) - ); - expect( - transformData({ - aliasToMemberNameMap: data.aliasToMemberNameMap, - annotation: data.annotation as unknown as { [member: string]: ConfigItem }, - data: data.data, - query: data.query as unknown as NormalizedQuery, - queryType: data.queryType as QueryType, - }) - ).toEqual(data.result_default); - }); - - test('compare date range count by order date', () => { - const data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data) - ); - - expect( - transformData({ - aliasToMemberNameMap: data[0].aliasToMemberNameMap, - annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, - data: data[0].data, - query: data[0].query as unknown as NormalizedQuery, - queryType: data[0].queryType as QueryType, - }) - ).toEqual(data[0].result_default); - - expect( - transformData({ - aliasToMemberNameMap: data[1].aliasToMemberNameMap, - annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, - data: data[1].data, - query: data[1].query as unknown as NormalizedQuery, - queryType: data[1].queryType as QueryType, - }) - ).toEqual(data[1].result_default); - }); - - test('blending query avg discount by date range for the first and standard ship mode', () => { - const data = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data - ) - ); - - expect( - transformData({ - aliasToMemberNameMap: data[0].aliasToMemberNameMap, - annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, - data: data[0].data, - query: data[0].query as unknown as NormalizedQuery, - queryType: data[0].queryType as QueryType, - }) - ).toEqual(data[0].result_default); - - expect( - transformData({ - aliasToMemberNameMap: data[1].aliasToMemberNameMap, - annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, - data: data[1].data, - query: data[1].query as unknown as NormalizedQuery, - queryType: data[1].queryType as QueryType, - }) - ).toEqual(data[1].result_default); - }); -}); - -describe('transformData compact mode', () => { - test('regular discount by city', () => { - let data; - - data = JSON.parse( - JSON.stringify(mockData.regular_discount_by_city.data) - ); - delete data.aliasToMemberNameMap.e_commerce_records_us2021__avg_discount; - expect(() => transformData({ - aliasToMemberNameMap: data.aliasToMemberNameMap, - annotation: data.annotation as unknown as { [member: string]: ConfigItem }, - data: data.data, - query: data.query as unknown as NormalizedQuery, - queryType: data.queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - })).toThrow(); - - data = JSON.parse( - JSON.stringify(mockData.regular_discount_by_city.data) - ); - expect( - transformData({ - aliasToMemberNameMap: data.aliasToMemberNameMap, - annotation: data.annotation as unknown as { [member: string]: ConfigItem }, - data: data.data, - query: data.query as unknown as NormalizedQuery, - queryType: data.queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - }) - ).toEqual(data.result_compact); - }); - - test('regular profit by postal code', () => { - const data = JSON.parse( - JSON.stringify(mockData.regular_profit_by_postal_code.data) - ); - expect( - transformData({ - aliasToMemberNameMap: data.aliasToMemberNameMap, - annotation: data.annotation as unknown as { [member: string]: ConfigItem }, - data: data.data, - query: data.query as unknown as NormalizedQuery, - queryType: data.queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - }) - ).toEqual(data.result_compact); - }); - - test('compare date range count by order date', () => { - const data = JSON.parse( - JSON.stringify(mockData.compare_date_range_count_by_order_date.data) - ); - - expect( - transformData({ - aliasToMemberNameMap: data[0].aliasToMemberNameMap, - annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, - data: data[0].data, - query: data[0].query as unknown as NormalizedQuery, - queryType: data[0].queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - }) - ).toEqual(data[0].result_compact); - - expect( - transformData({ - aliasToMemberNameMap: data[1].aliasToMemberNameMap, - annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, - data: data[1].data, - query: data[1].query as unknown as NormalizedQuery, - queryType: data[1].queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - }) - ).toEqual(data[1].result_compact); - }); - - test('blending query avg discount by date range for the first and standard ship mode', () => { - const data = JSON.parse( - JSON.stringify( - mockData - .blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode - .data - ) - ); - - expect( - transformData({ - aliasToMemberNameMap: data[0].aliasToMemberNameMap, - annotation: data[0].annotation as unknown as { [member: string]: ConfigItem }, - data: data[0].data, - query: data[0].query as unknown as NormalizedQuery, - queryType: data[0].queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - }) - ).toEqual(data[0].result_compact); - - expect( - transformData({ - aliasToMemberNameMap: data[1].aliasToMemberNameMap, - annotation: data[1].annotation as unknown as { [member: string]: ConfigItem }, - data: data[1].data, - query: data[1].query as unknown as NormalizedQuery, - queryType: data[1].queryType as QueryType, - resType: ResultTypeEnum.COMPACT, - }) - ).toEqual(data[1].result_compact); - }); -}); diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index 5d6295463d822..e6dd5cfc74487 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -156,11 +156,16 @@ pub fn get_members( db_data: &QueryResult, alias_to_member_name_map: &HashMap, annotation: &HashMap, -) -> Result { - let mut members: MembersMap = HashMap::new(); +) -> Result<(MembersMap, Vec)> { + let mut members_map: MembersMap = HashMap::new(); + // Hashmaps don't guarantee the order of the elements while iterating + // this fires in get_compact_row because members map doesn't hold the members for + // date range queries, which are added later and thus columns in final recordset are not + // in sync with the order of members in members list. + let mut members_arr: Vec = vec![]; if db_data.columns.is_empty() { - return Ok(members); + return Ok((members_map, members_arr)); } for column in db_data.columns.iter() { @@ -179,7 +184,8 @@ pub fn get_members( ); } - members.insert(member_name.clone(), column.clone()); + members_map.insert(member_name.clone(), column.clone()); + members_arr.push(member_name.clone()); let path = member_name.split(MEMBER_SEPARATOR).collect::>(); let calc_member = format!("{}{}{}", path[0], MEMBER_SEPARATOR, path[1]); @@ -191,16 +197,18 @@ pub fn get_members( .any(|dim| *dim == MemberOrMemberExpression::Member(calc_member.clone())) }) { - members.insert(calc_member, column.clone()); + members_map.insert(calc_member.clone(), column.clone()); + members_arr.push(calc_member); } } match query_type { QueryType::CompareDateRangeQuery => { - members.insert( + members_map.insert( COMPARE_DATE_RANGE_FIELD.to_string(), QueryType::CompareDateRangeQuery.to_string(), ); + members_arr.push(COMPARE_DATE_RANGE_FIELD.to_string()); } QueryType::BlendingQuery => { let blending_key = get_blending_query_key(query.time_dimensions.as_ref()) @@ -210,13 +218,15 @@ pub fn get_members( .as_ref() .and_then(|dims| dims.first().cloned()) { - members.insert(blending_key, dim.dimension.clone()); + let val = members_map.get(&dim.dimension).unwrap(); + members_map.insert(blending_key.clone(), val.clone()); + members_arr.push(blending_key); } } _ => {} } - Ok(members) + Ok((members_map, members_arr)) } /// Convert DB response object to the compact output format. @@ -447,7 +457,7 @@ pub fn get_final_cubestore_result_array( Ok(()) } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(untagged)] pub enum TransformedData { Compact { @@ -469,14 +479,13 @@ impl TransformedData { let query_type = &request_data.query_type.clone().unwrap_or_default(); let res_type = request_data.res_type.clone(); - let members_to_alias_map = get_members( + let (members_to_alias_map, members) = get_members( query_type, query, cube_store_result, alias_to_member_name_map, annotation, )?; - let members: Vec = members_to_alias_map.keys().cloned().collect(); match res_type { Some(ResultType::Compact) => { @@ -648,8 +657,730 @@ impl Display for DBResponseValue { #[cfg(test)] mod tests { use super::*; + use crate::transport::JsRawData; use anyhow::Result; use chrono::{TimeZone, Timelike, Utc}; + use serde_json::from_str; + use std::{fmt, sync::LazyLock}; + + type TestSuiteData = HashMap; + + #[derive(Clone, Deserialize)] + #[serde(rename_all = "camelCase")] + struct TestData { + request: TransformDataRequest, + query_result: JsRawData, + final_result_default: Option, + final_result_compact: Option, + } + + const TEST_SUITE_JSON: &str = r#" +{ + "regular_discount_by_city": { + "request": { + "aliasToMemberNameMap": { + "e_commerce_records_us2021__avg_discount": "ECommerceRecordsUs2021.avg_discount", + "e_commerce_records_us2021__city": "ECommerceRecordsUs2021.city" + }, + "annotation": { + "ECommerceRecordsUs2021.avg_discount": { + "title": "E Commerce Records Us2021 Avg Discount", + "shortTitle": "Avg Discount", + "type": "number", + "drillMembers": [], + "drillMembersGrouped": { + "measures": [], + "dimensions": [] + } + }, + "ECommerceRecordsUs2021.city": { + "title": "E Commerce Records Us2021 City", + "shortTitle": "City", + "type": "string" + } + }, + "query": { + "dimensions": [ + "ECommerceRecordsUs2021.city" + ], + "measures": [ + "ECommerceRecordsUs2021.avg_discount" + ], + "limit": 2, + "rowLimit": 2, + "timezone": "UTC", + "order": [], + "filters": [], + "timeDimensions": [] + }, + "queryType": "regularQuery" + }, + "queryResult": [ + { + "e_commerce_records_us2021__city": "Missouri City", + "e_commerce_records_us2021__avg_discount": "0.80000000000000000000" + }, + { + "e_commerce_records_us2021__city": "Abilene", + "e_commerce_records_us2021__avg_discount": "0.80000000000000000000" + } + ], + "finalResultDefault": [ + { + "ECommerceRecordsUs2021.city": "Missouri City", + "ECommerceRecordsUs2021.avg_discount": "0.80000000000000000000" + }, + { + "ECommerceRecordsUs2021.city": "Abilene", + "ECommerceRecordsUs2021.avg_discount": "0.80000000000000000000" + } + ], + "finalResultCompact": { + "members": [ + "ECommerceRecordsUs2021.city", + "ECommerceRecordsUs2021.avg_discount" + ], + "dataset": [ + [ + "Missouri City", + "0.80000000000000000000" + ], + [ + "Abilene", + "0.80000000000000000000" + ] + ] + } + }, + "regular_profit_by_postal_code": { + "request": { + "aliasToMemberNameMap": { + "e_commerce_records_us2021__avg_profit": "ECommerceRecordsUs2021.avg_profit", + "e_commerce_records_us2021__postal_code": "ECommerceRecordsUs2021.postalCode" + }, + "annotation": { + "ECommerceRecordsUs2021.avg_profit": { + "title": "E Commerce Records Us2021 Avg Profit", + "shortTitle": "Avg Profit", + "type": "number", + "drillMembers": [], + "drillMembersGrouped": { + "measures": [], + "dimensions": [] + } + }, + "ECommerceRecordsUs2021.postalCode": { + "title": "E Commerce Records Us2021 Postal Code", + "shortTitle": "Postal Code", + "type": "string" + } + }, + "query": { + "dimensions": [ + "ECommerceRecordsUs2021.postalCode" + ], + "measures": [ + "ECommerceRecordsUs2021.avg_profit" + ], + "limit": 2, + "rowLimit": 2, + "timezone": "UTC", + "order": [], + "filters": [], + "timeDimensions": [] + }, + "queryType": "regularQuery" + }, + "queryResult": [ + { + "e_commerce_records_us2021__postal_code": "95823", + "e_commerce_records_us2021__avg_profit": "646.1258666666666667" + }, + { + "e_commerce_records_us2021__postal_code": "64055", + "e_commerce_records_us2021__avg_profit": "487.8315000000000000" + } + ], + "finalResultDefault": [ + { + "ECommerceRecordsUs2021.postalCode": "95823", + "ECommerceRecordsUs2021.avg_profit": "646.1258666666666667" + }, + { + "ECommerceRecordsUs2021.postalCode": "64055", + "ECommerceRecordsUs2021.avg_profit": "487.8315000000000000" + } + ], + "finalResultCompact": { + "members": [ + "ECommerceRecordsUs2021.postalCode", + "ECommerceRecordsUs2021.avg_profit" + ], + "dataset": [ + [ + "95823", + "646.1258666666666667" + ], + [ + "64055", + "487.8315000000000000" + ] + ] + } + }, + "compare_date_range_count_by_order_date": { + "request": { + "aliasToMemberNameMap": { + "e_commerce_records_us2021__count": "ECommerceRecordsUs2021.count", + "e_commerce_records_us2021__order_date_day": "ECommerceRecordsUs2021.orderDate.day" + }, + "annotation": { + "ECommerceRecordsUs2021.count": { + "title": "E Commerce Records Us2021 Count", + "shortTitle": "Count", + "type": "number", + "drillMembers": [ + "ECommerceRecordsUs2021.city", + "ECommerceRecordsUs2021.country", + "ECommerceRecordsUs2021.customerId", + "ECommerceRecordsUs2021.orderId", + "ECommerceRecordsUs2021.productId", + "ECommerceRecordsUs2021.productName", + "ECommerceRecordsUs2021.orderDate" + ], + "drillMembersGrouped": { + "measures": [], + "dimensions": [ + "ECommerceRecordsUs2021.city", + "ECommerceRecordsUs2021.country", + "ECommerceRecordsUs2021.customerId", + "ECommerceRecordsUs2021.orderId", + "ECommerceRecordsUs2021.productId", + "ECommerceRecordsUs2021.productName", + "ECommerceRecordsUs2021.orderDate" + ] + } + }, + "ECommerceRecordsUs2021.orderDate.day": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + }, + "ECommerceRecordsUs2021.orderDate": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + } + }, + "query": { + "measures": [ + "ECommerceRecordsUs2021.count" + ], + "timeDimensions": [ + { + "dimension": "ECommerceRecordsUs2021.orderDate", + "granularity": "day", + "dateRange": [ + "2020-01-01T00:00:00.000", + "2020-01-31T23:59:59.999" + ] + } + ], + "limit": 2, + "rowLimit": 2, + "timezone": "UTC", + "order": [], + "filters": [], + "dimensions": [] + }, + "queryType": "compareDateRangeQuery" + }, + "queryResult": [ + { + "e_commerce_records_us2021__order_date_day": "2020-01-01T00:00:00.000", + "e_commerce_records_us2021__count": "10" + }, + { + "e_commerce_records_us2021__order_date_day": "2020-01-02T00:00:00.000", + "e_commerce_records_us2021__count": "8" + } + ], + "finalResultDefault": [ + { + "ECommerceRecordsUs2021.orderDate.day": "2020-01-01T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-01-01T00:00:00.000", + "ECommerceRecordsUs2021.count": "10", + "compareDateRange": "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999" + }, + { + "ECommerceRecordsUs2021.orderDate.day": "2020-01-02T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-01-02T00:00:00.000", + "ECommerceRecordsUs2021.count": "8", + "compareDateRange": "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999" + } + ], + "finalResultCompact": { + "members": [ + "ECommerceRecordsUs2021.orderDate.day", + "ECommerceRecordsUs2021.orderDate", + "ECommerceRecordsUs2021.count", + "compareDateRange" + ], + "dataset": [ + [ + "2020-01-01T00:00:00.000", + "2020-01-01T00:00:00.000", + "10", + "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999" + ], + [ + "2020-01-02T00:00:00.000", + "2020-01-02T00:00:00.000", + "8", + "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999" + ] + ] + } + }, + "compare_date_range_count_by_order_date2": { + "request": { + "aliasToMemberNameMap": { + "e_commerce_records_us2021__count": "ECommerceRecordsUs2021.count", + "e_commerce_records_us2021__order_date_day": "ECommerceRecordsUs2021.orderDate.day" + }, + "annotation": { + "ECommerceRecordsUs2021.count": { + "title": "E Commerce Records Us2021 Count", + "shortTitle": "Count", + "type": "number", + "drillMembers": [ + "ECommerceRecordsUs2021.city", + "ECommerceRecordsUs2021.country", + "ECommerceRecordsUs2021.customerId", + "ECommerceRecordsUs2021.orderId", + "ECommerceRecordsUs2021.productId", + "ECommerceRecordsUs2021.productName", + "ECommerceRecordsUs2021.orderDate" + ], + "drillMembersGrouped": { + "measures": [], + "dimensions": [ + "ECommerceRecordsUs2021.city", + "ECommerceRecordsUs2021.country", + "ECommerceRecordsUs2021.customerId", + "ECommerceRecordsUs2021.orderId", + "ECommerceRecordsUs2021.productId", + "ECommerceRecordsUs2021.productName", + "ECommerceRecordsUs2021.orderDate" + ] + } + }, + "ECommerceRecordsUs2021.orderDate.day": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + }, + "ECommerceRecordsUs2021.orderDate": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + } + }, + "query": { + "measures": [ + "ECommerceRecordsUs2021.count" + ], + "timeDimensions": [ + { + "dimension": "ECommerceRecordsUs2021.orderDate", + "granularity": "day", + "dateRange": [ + "2020-03-01T00:00:00.000", + "2020-03-31T23:59:59.999" + ] + } + ], + "limit": 2, + "rowLimit": 2, + "timezone": "UTC", + "order": [], + "filters": [], + "dimensions": [] + }, + "queryType": "compareDateRangeQuery" + }, + "queryResult": [ + { + "e_commerce_records_us2021__order_date_day": "2020-03-02T00:00:00.000", + "e_commerce_records_us2021__count": "11" + }, + { + "e_commerce_records_us2021__order_date_day": "2020-03-03T00:00:00.000", + "e_commerce_records_us2021__count": "7" + } + ], + "finalResultDefault": [ + { + "ECommerceRecordsUs2021.orderDate.day": "2020-03-02T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-03-02T00:00:00.000", + "ECommerceRecordsUs2021.count": "11", + "compareDateRange": "2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999" + }, + { + "ECommerceRecordsUs2021.orderDate.day": "2020-03-03T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-03-03T00:00:00.000", + "ECommerceRecordsUs2021.count": "7", + "compareDateRange": "2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999" + } + ], + "finalResultCompact": { + "members": [ + "ECommerceRecordsUs2021.orderDate.day", + "ECommerceRecordsUs2021.orderDate", + "ECommerceRecordsUs2021.count", + "compareDateRange" + ], + "dataset": [ + [ + "2020-03-02T00:00:00.000", + "2020-03-02T00:00:00.000", + "11", + "2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999" + ], + [ + "2020-03-03T00:00:00.000", + "2020-03-03T00:00:00.000", + "7", + "2020-03-01T00:00:00.000 - 2020-03-31T23:59:59.999" + ] + ] + } + }, + "blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode": { + "request": { + "aliasToMemberNameMap": { + "e_commerce_records_us2021__avg_discount": "ECommerceRecordsUs2021.avg_discount", + "e_commerce_records_us2021__order_date_month": "ECommerceRecordsUs2021.orderDate.month" + }, + "annotation": { + "ECommerceRecordsUs2021.avg_discount": { + "title": "E Commerce Records Us2021 Avg Discount", + "shortTitle": "Avg Discount", + "type": "number", + "drillMembers": [], + "drillMembersGrouped": { + "measures": [], + "dimensions": [] + } + }, + "ECommerceRecordsUs2021.orderDate.month": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + }, + "ECommerceRecordsUs2021.orderDate": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + } + }, + "query": { + "measures": [ + "ECommerceRecordsUs2021.avg_discount" + ], + "timeDimensions": [ + { + "dimension": "ECommerceRecordsUs2021.orderDate", + "granularity": "month", + "dateRange": [ + "2020-01-01T00:00:00.000", + "2020-12-30T23:59:59.999" + ] + } + ], + "filters": [ + { + "operator": "equals", + "values": [ + "Standard Class" + ], + "member": "ECommerceRecordsUs2021.shipMode" + } + ], + "limit": 2, + "rowLimit": 2, + "timezone": "UTC", + "order": [], + "dimensions": [] + }, + "queryType": "blendingQuery" + }, + "queryResult": [ + { + "e_commerce_records_us2021__order_date_month": "2020-01-01T00:00:00.000", + "e_commerce_records_us2021__avg_discount": "0.15638297872340425532" + }, + { + "e_commerce_records_us2021__order_date_month": "2020-02-01T00:00:00.000", + "e_commerce_records_us2021__avg_discount": "0.17573529411764705882" + } + ], + "finalResultDefault": [ + { + "ECommerceRecordsUs2021.orderDate.month": "2020-01-01T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-01-01T00:00:00.000", + "ECommerceRecordsUs2021.avg_discount": "0.15638297872340425532", + "time.month": "2020-01-01T00:00:00.000" + }, + { + "ECommerceRecordsUs2021.orderDate.month": "2020-02-01T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-02-01T00:00:00.000", + "ECommerceRecordsUs2021.avg_discount": "0.17573529411764705882", + "time.month": "2020-02-01T00:00:00.000" + } + ], + "finalResultCompact": { + "members": [ + "ECommerceRecordsUs2021.orderDate.month", + "ECommerceRecordsUs2021.orderDate", + "ECommerceRecordsUs2021.avg_discount", + "time.month" + ], + "dataset": [ + [ + "2020-01-01T00:00:00.000", + "2020-01-01T00:00:00.000", + "0.15638297872340425532", + "2020-01-01T00:00:00.000" + ], + [ + "2020-02-01T00:00:00.000", + "2020-02-01T00:00:00.000", + "0.17573529411764705882", + "2020-02-01T00:00:00.000" + ] + ] + } + }, + "blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode2": { + "request": { + "aliasToMemberNameMap": { + "e_commerce_records_us2021__avg_discount": "ECommerceRecordsUs2021.avg_discount", + "e_commerce_records_us2021__order_date_month": "ECommerceRecordsUs2021.orderDate.month" + }, + "annotation": { + "ECommerceRecordsUs2021.avg_discount": { + "title": "E Commerce Records Us2021 Avg Discount", + "shortTitle": "Avg Discount", + "type": "number", + "drillMembers": [], + "drillMembersGrouped": { + "measures": [], + "dimensions": [] + } + }, + "ECommerceRecordsUs2021.orderDate.month": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + }, + "ECommerceRecordsUs2021.orderDate": { + "title": "E Commerce Records Us2021 Order Date", + "shortTitle": "Order Date", + "type": "time" + } + }, + "query": { + "measures": [ + "ECommerceRecordsUs2021.avg_discount" + ], + "timeDimensions": [ + { + "dimension": "ECommerceRecordsUs2021.orderDate", + "granularity": "month", + "dateRange": [ + "2020-01-01T00:00:00.000", + "2020-12-30T23:59:59.999" + ] + } + ], + "filters": [ + { + "operator": "equals", + "values": [ + "First Class" + ], + "member": "ECommerceRecordsUs2021.shipMode" + } + ], + "limit": 2, + "rowLimit": 2, + "timezone": "UTC", + "order": [], + "dimensions": [] + }, + "queryType": "blendingQuery" + }, + "queryResult": [ + { + "e_commerce_records_us2021__order_date_month": "2020-01-01T00:00:00.000", + "e_commerce_records_us2021__avg_discount": "0.28571428571428571429" + }, + { + "e_commerce_records_us2021__order_date_month": "2020-02-01T00:00:00.000", + "e_commerce_records_us2021__avg_discount": "0.21777777777777777778" + } + ], + "finalResultDefault": [ + { + "ECommerceRecordsUs2021.orderDate.month": "2020-01-01T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-01-01T00:00:00.000", + "ECommerceRecordsUs2021.avg_discount": "0.28571428571428571429", + "time.month": "2020-01-01T00:00:00.000" + }, + { + "ECommerceRecordsUs2021.orderDate.month": "2020-02-01T00:00:00.000", + "ECommerceRecordsUs2021.orderDate": "2020-02-01T00:00:00.000", + "ECommerceRecordsUs2021.avg_discount": "0.21777777777777777778", + "time.month": "2020-02-01T00:00:00.000" + } + ], + "finalResultCompact": { + "members": [ + "ECommerceRecordsUs2021.orderDate.month", + "ECommerceRecordsUs2021.orderDate", + "ECommerceRecordsUs2021.avg_discount", + "time.month" + ], + "dataset": [ + [ + "2020-01-01T00:00:00.000", + "2020-01-01T00:00:00.000", + "0.28571428571428571429", + "2020-01-01T00:00:00.000" + ], + [ + "2020-02-01T00:00:00.000", + "2020-02-01T00:00:00.000", + "0.21777777777777777778", + "2020-02-01T00:00:00.000" + ] + ] + } + } +} + "#; + + static TEST_SUITE_DATA: LazyLock = + LazyLock::new(|| from_str(TEST_SUITE_JSON).unwrap()); + + #[derive(Debug)] + pub struct TestError(String); + + impl Display for TestError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Error: {}", self.0) + } + } + + impl std::error::Error for TestError {} + + /// Smart comparator of datasets. + /// Hashmaps don't guarantee the order of the elements while iterating, + /// so it's not possible to simply compare generated one and the one from the json. + fn compare_transformed_data( + left: &TransformedData, + right: &TransformedData, + ) -> Result<(), TestError> { + match (left, right) { + ( + TransformedData::Compact { + members: left_members, + dataset: left_dataset, + }, + TransformedData::Compact { + members: right_members, + dataset: right_dataset, + }, + ) => { + let mut left_sorted_members = left_members.clone(); + let mut right_sorted_members = right_members.clone(); + left_sorted_members.sort(); + right_sorted_members.sort(); + + if left_sorted_members != right_sorted_members { + return Err(TestError("Members do not match after sorting".to_string())); + } + + if left_dataset.len() != right_dataset.len() { + return Err(TestError("Datasets have different lengths".to_string())); + } + + let mut member_index_map = HashMap::new(); + for (i, member) in left_members.iter().enumerate() { + if let Some(right_index) = right_members.iter().position(|x| x == member) { + member_index_map.insert(i, right_index); + } else { + return Err(TestError("Member not found in right object".to_string())); + } + } + + for (i, left_row) in left_dataset.iter().enumerate() { + let right_row = &right_dataset[i]; + + for (j, left_value) in left_row.iter().enumerate() { + let mapped_index = *member_index_map.get(&j).unwrap(); + let right_value = &right_row[mapped_index]; + if left_value != right_value { + return Err(TestError(format!( + "Dataset values at row {} and column {} do not match: {} != {}", + i, j, left_value, right_value + ))); + } + } + } + + Ok(()) + } + (TransformedData::Vanilla(left_dataset), TransformedData::Vanilla(right_dataset)) => { + if left_dataset.len() != right_dataset.len() { + return Err(TestError( + "Vanilla datasets have different lengths".to_string(), + )); + } + + for (i, (left_record, right_record)) in + left_dataset.iter().zip(right_dataset.iter()).enumerate() + { + if left_record.len() != right_record.len() { + return Err(TestError(format!( + "Vanilla dataset records at index {} have different numbers of keys", + i + ))); + } + + for (key, left_value) in left_record { + if let Some(right_value) = right_record.get(key) { + if left_value != right_value { + return Err(TestError(format!( + "Values at index {} for key '{}' do not match: {:?} != {:?}", + i, key, left_value, right_value + ))); + } + } else { + return Err(TestError(format!( + "Key '{}' not found in right record at index {}", + key, i + ))); + } + } + } + + Ok(()) + } + _ => Err(TestError("Mismatched TransformedData types".to_string())), + } + } #[test] fn test_transform_value_datetime_to_time() { @@ -1001,4 +1732,769 @@ mod tests { ) ); } + + #[test] + fn test_regular_profit_by_postal_code_compact() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_profit_by_postal_code".to_string()) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_compact.unwrap())?; + Ok(()) + } + + #[test] + fn test_compare_date_range_count_by_order_date() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"compare_date_range_count_by_order_date".to_string()) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_compact.unwrap())?; + Ok(()) + } + + #[test] + fn test_compare_date_range_count_by_order_date2() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"compare_date_range_count_by_order_date2".to_string()) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_compact.unwrap())?; + Ok(()) + } + + #[test] + fn test_regular_discount_by_city() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_compact.unwrap())?; + Ok(()) + } + + #[test] + fn test_regular_discount_by_city_to_fail() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data + .request + .alias_to_member_name_map + .remove(&"e_commerce_records_us2021__avg_discount".to_string()); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + match TransformedData::transform(&test_data.request, &raw_data) { + Ok(_) => Err(TestError("regular_discount_by_city should fail ".to_string()).into()), + Err(_) => Ok(()), // Should throw an error + } + } + + #[test] + fn test_blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode( + ) -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode" + .to_string(), + ) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_compact.unwrap())?; + Ok(()) + } + + #[test] + fn test_blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode2( + ) -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode" + .to_string(), + ) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Compact); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_compact.unwrap())?; + Ok(()) + } + + #[test] + fn test_regular_discount_by_city_default_to_fail() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data + .request + .alias_to_member_name_map + .remove(&"e_commerce_records_us2021__avg_discount".to_string()); + test_data.request.res_type = Some(ResultType::Default); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + match TransformedData::transform(&test_data.request, &raw_data) { + Ok(_) => Err(TestError("regular_discount_by_city should fail ".to_string()).into()), + Err(_) => Ok(()), // Should throw an error + } + } + + #[test] + fn test_regular_discount_by_city_default() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Default); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_default.unwrap())?; + Ok(()) + } + + #[test] + fn test_regular_profit_by_postal_code_default() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Default); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_default.unwrap())?; + Ok(()) + } + + #[test] + fn test_blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode_default( + ) -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode" + .to_string(), + ) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Default); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_default.unwrap())?; + Ok(()) + } + + #[test] + fn test_blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode2_default( + ) -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode2" + .to_string(), + ) + .unwrap() + .clone(); + test_data.request.res_type = Some(ResultType::Default); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let transformed = TransformedData::transform(&test_data.request, &raw_data)?; + compare_transformed_data(&transformed, &test_data.final_result_default.unwrap())?; + Ok(()) + } + + #[test] + fn test_get_members_no_alias_to_member_name_map() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_profit_by_postal_code".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + test_data.request.alias_to_member_name_map = HashMap::new(); + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + match get_members( + query_type, + query, + &raw_data, + alias_to_member_name_map, + annotation, + ) { + Ok(_) => Err(TestError("get_members() should fail ".to_string()).into()), + Err(err) => { + assert!(err.to_string().contains("Member name not found for alias")); + Ok(()) + } + } + } + + #[test] + fn test_get_members_empty_dataset() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"regular_profit_by_postal_code".to_string()) + .unwrap() + .clone(); + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let (members_to_alias_map, members) = get_members( + query_type, + query, + &QueryResult { + columns: vec![], + rows: vec![], + columns_pos: HashMap::new(), + }, + alias_to_member_name_map, + annotation, + )?; + assert_eq!(members_to_alias_map.len(), 0); + assert_eq!(members.len(), 0); + Ok(()) + } + + #[test] + fn test_get_members_filled_dataset() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"regular_profit_by_postal_code".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let (members_to_alias_map, members) = get_members( + query_type, + query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let members_map_expected: MembersMap = HashMap::from([ + ( + "ECommerceRecordsUs2021.postalCode".to_string(), + "e_commerce_records_us2021__postal_code".to_string(), + ), + ( + "ECommerceRecordsUs2021.avg_profit".to_string(), + "e_commerce_records_us2021__avg_profit".to_string(), + ), + ]); + assert_eq!(members_to_alias_map, members_map_expected); + assert_eq!(members.len(), 2); + Ok(()) + } + + #[test] + fn test_get_members_compare_date_range_empty_dataset() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"compare_date_range_count_by_order_date".to_string()) + .unwrap() + .clone(); + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let (members_to_alias_map, members) = get_members( + query_type, + query, + &QueryResult { + columns: vec![], + rows: vec![], + columns_pos: HashMap::new(), + }, + alias_to_member_name_map, + annotation, + )?; + assert_eq!(members_to_alias_map.len(), 0); + assert_eq!(members.len(), 0); + Ok(()) + } + + #[test] + fn test_get_members_compare_date_range_filled_dataset() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"compare_date_range_count_by_order_date".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let (members_to_alias_map, members) = get_members( + query_type, + query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let members_map_expected: MembersMap = HashMap::from([ + ( + "ECommerceRecordsUs2021.orderDate.day".to_string(), + "e_commerce_records_us2021__order_date_day".to_string(), + ), + ( + "ECommerceRecordsUs2021.orderDate".to_string(), + "e_commerce_records_us2021__order_date_day".to_string(), + ), + ( + "ECommerceRecordsUs2021.count".to_string(), + "e_commerce_records_us2021__count".to_string(), + ), + ( + "compareDateRange".to_string(), + "compareDateRangeQuery".to_string(), + ), + ]); + assert_eq!(members_to_alias_map, members_map_expected); + assert_eq!(members.len(), 4); + Ok(()) + } + + #[test] + fn test_get_members_blending_query_empty_dataset() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode" + .to_string(), + ) + .unwrap() + .clone(); + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let (members_to_alias_map, members) = get_members( + query_type, + query, + &QueryResult { + columns: vec![], + rows: vec![], + columns_pos: HashMap::new(), + }, + alias_to_member_name_map, + annotation, + )?; + assert_eq!(members_to_alias_map.len(), 0); + assert_eq!(members.len(), 0); + Ok(()) + } + + #[test] + fn test_get_members_blending_query_filled_dataset() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode" + .to_string(), + ) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = &test_data.request.query; + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let (members_to_alias_map, members) = get_members( + query_type, + query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let members_map_expected: HashMap = HashMap::from([ + ( + "ECommerceRecordsUs2021.orderDate.month".to_string(), + "e_commerce_records_us2021__order_date_month".to_string(), + ), + ( + "ECommerceRecordsUs2021.orderDate".to_string(), + "e_commerce_records_us2021__order_date_month".to_string(), + ), + ( + "ECommerceRecordsUs2021.avg_discount".to_string(), + "e_commerce_records_us2021__avg_discount".to_string(), + ), + ( + "time.month".to_string(), + "e_commerce_records_us2021__order_date_month".to_string(), + ), + ]); + assert_eq!(members_to_alias_map, members_map_expected); + assert_eq!(members.len(), 4); + Ok(()) + } + + #[test] + fn test_get_compact_row_regular_profit_by_postal_code() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"regular_profit_by_postal_code".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + let time_dimensions = &test_data.request.query.time_dimensions.unwrap(); + + let (members_to_alias_map, members) = get_members( + query_type, + &query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let res = get_compact_row( + &members_to_alias_map, + &annotation, + &query_type, + &members, + Some(time_dimensions), + &raw_data.rows[0], + &raw_data.columns_pos, + )?; + + let members_map_expected = HashMap::from([ + ( + "ECommerceRecordsUs2021.postalCode".to_string(), + DBResponsePrimitive::String("95823".to_string()), + ), + ( + "ECommerceRecordsUs2021.avg_profit".to_string(), + DBResponsePrimitive::String("646.1258666666666667".to_string()), + ), + ]); + + assert_eq!(res.len(), members_map_expected.len()); + for (i, val) in members.iter().enumerate() { + assert_eq!(res[i], members_map_expected.get(val).unwrap().clone()); + } + + Ok(()) + } + + #[test] + fn test_get_compact_row_regular_discount_by_city() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + let time_dimensions = &test_data.request.query.time_dimensions.unwrap(); + + let (members_to_alias_map, members) = get_members( + query_type, + &query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let res = get_compact_row( + &members_to_alias_map, + &annotation, + &query_type, + &members, + Some(time_dimensions), + &raw_data.rows[0], + &raw_data.columns_pos, + )?; + + let members_map_expected = HashMap::from([ + ( + "ECommerceRecordsUs2021.city".to_string(), + DBResponsePrimitive::String("Missouri City".to_string()), + ), + ( + "ECommerceRecordsUs2021.avg_discount".to_string(), + DBResponsePrimitive::String("0.80000000000000000000".to_string()), + ), + ]); + + assert_eq!(res.len(), members_map_expected.len()); + for (i, val) in members.iter().enumerate() { + assert_eq!(res[i], members_map_expected.get(val).unwrap().clone()); + } + + Ok(()) + } + + #[test] + fn test_get_compact_row_compare_date_range_count_by_order_date() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"compare_date_range_count_by_order_date".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + let time_dimensions = &test_data.request.query.time_dimensions.unwrap(); + + let (members_to_alias_map, members) = get_members( + query_type, + &query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let res = get_compact_row( + &members_to_alias_map, + &annotation, + &query_type, + &members, + Some(time_dimensions), + &raw_data.rows[0], + &raw_data.columns_pos, + )?; + + let members_map_expected = HashMap::from([ + ( + "ECommerceRecordsUs2021.orderDate.day".to_string(), + DBResponsePrimitive::String("2020-01-01T00:00:00.000".to_string()), + ), + ( + "ECommerceRecordsUs2021.orderDate".to_string(), + DBResponsePrimitive::String("2020-01-01T00:00:00.000".to_string()), + ), + ( + "ECommerceRecordsUs2021.count".to_string(), + DBResponsePrimitive::String("10".to_string()), + ), + ( + "compareDateRange".to_string(), + DBResponsePrimitive::String( + "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999".to_string(), + ), + ), + ]); + + assert_eq!(res.len(), members_map_expected.len()); + for (i, val) in members.iter().enumerate() { + assert_eq!(res[i], members_map_expected.get(val).unwrap().clone()); + } + + let res = get_compact_row( + &members_to_alias_map, + &annotation, + &query_type, + &members, + Some(time_dimensions), + &raw_data.rows[1], + &raw_data.columns_pos, + )?; + + let members_map_expected = HashMap::from([ + ( + "ECommerceRecordsUs2021.orderDate.day".to_string(), + DBResponsePrimitive::String("2020-01-02T00:00:00.000".to_string()), + ), + ( + "ECommerceRecordsUs2021.orderDate".to_string(), + DBResponsePrimitive::String("2020-01-02T00:00:00.000".to_string()), + ), + ( + "ECommerceRecordsUs2021.count".to_string(), + DBResponsePrimitive::String("8".to_string()), + ), + ( + "compareDateRange".to_string(), + DBResponsePrimitive::String( + "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999".to_string(), + ), + ), + ]); + + assert_eq!(res.len(), members_map_expected.len()); + for (i, val) in members.iter().enumerate() { + assert_eq!(res[i], members_map_expected.get(val).unwrap().clone()); + } + + Ok(()) + } + + #[test] + fn test_get_compact_row_blending_query_avg_discount() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get( + &"blending_query_avg_discount_by_date_range_for_the_first_and_standard_ship_mode" + .to_string(), + ) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + let time_dimensions = &test_data.request.query.time_dimensions.unwrap(); + + let (members_to_alias_map, members) = get_members( + query_type, + &query, + &raw_data, + alias_to_member_name_map, + annotation, + )?; + let res = get_compact_row( + &members_to_alias_map, + &annotation, + &query_type, + &members, + Some(time_dimensions), + &raw_data.rows[0], + &raw_data.columns_pos, + )?; + + let members_map_expected = HashMap::from([ + ( + "ECommerceRecordsUs2021.orderDate.month".to_string(), + DBResponsePrimitive::String("2020-01-01T00:00:00.000".to_string()), + ), + ( + "ECommerceRecordsUs2021.orderDate".to_string(), + DBResponsePrimitive::String("2020-01-01T00:00:00.000".to_string()), + ), + ( + "ECommerceRecordsUs2021.avg_discount".to_string(), + DBResponsePrimitive::String("0.15638297872340425532".to_string()), + ), + ( + "time.month".to_string(), + DBResponsePrimitive::String("2020-01-01T00:00:00.000".to_string()), + ), + ]); + + assert_eq!(res.len(), members_map_expected.len()); + for (i, val) in members.iter().enumerate() { + assert_eq!(res[i], members_map_expected.get(val).unwrap().clone()); + } + Ok(()) + } + + #[test] + fn test_get_vanilla_row_regular_discount_by_city() -> Result<()> { + let test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + let res = get_vanilla_row( + &alias_to_member_name_map, + &annotation, + &query_type, + &query, + &raw_data.rows[0], + &raw_data.columns_pos, + )?; + let expected = HashMap::from([ + ( + "ECommerceRecordsUs2021.city".to_string(), + DBResponsePrimitive::String("Missouri City".to_string()), + ), + ( + "ECommerceRecordsUs2021.avg_discount".to_string(), + DBResponsePrimitive::String("0.80000000000000000000".to_string()), + ), + ]); + assert_eq!(res, expected); + Ok(()) + } + + #[test] + fn test_get_vanilla_row_regular_discount_by_city_to_fail_member() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data + .request + .alias_to_member_name_map + .remove(&"e_commerce_records_us2021__avg_discount".to_string()); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + match get_vanilla_row( + &alias_to_member_name_map, + &annotation, + &query_type, + &query, + &raw_data.rows[0], + &raw_data.columns_pos, + ) { + Ok(_) => Err(TestError("get_vanilla_row() should fail ".to_string()).into()), + Err(err) => { + assert!(err.to_string().contains("Missing member name for alias")); + Ok(()) + } + } + } + + #[test] + fn test_get_vanilla_row_regular_discount_by_city_to_fail_annotation() -> Result<()> { + let mut test_data = TEST_SUITE_DATA + .get(&"regular_discount_by_city".to_string()) + .unwrap() + .clone(); + test_data + .request + .annotation + .remove(&"ECommerceRecordsUs2021.avg_discount".to_string()); + let raw_data = QueryResult::from_js_raw_data(test_data.query_result.clone())?; + let alias_to_member_name_map = &test_data.request.alias_to_member_name_map; + let annotation = &test_data.request.annotation; + let query = test_data.request.query.clone(); + let query_type = &test_data.request.query_type.clone().unwrap_or_default(); + + match get_vanilla_row( + &alias_to_member_name_map, + &annotation, + &query_type, + &query, + &raw_data.rows[0], + &raw_data.columns_pos, + ) { + Ok(_) => Err(TestError("get_vanilla_row() should fail ".to_string()).into()), + Err(err) => { + assert!(err.to_string().contains("You requested hidden member")); + Ok(()) + } + } + } } From 23efa8084b35536ca1058f1ad423e3086eb40cbb Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 20 Dec 2024 13:47:01 +0200 Subject: [PATCH 092/128] =?UTF-8?q?run=20rust=20unit=20tests=20on=C2=A0pus?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 54 +++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9207790e43cb4..a26ce32017392 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -9,6 +9,10 @@ on: - 'packages/**' - 'rust/cubestore/**' - 'rust/cubesql/**' + - 'rust/cubenativeutils/**' + - 'rust/cubeorchestrator/**' + - 'rust/cubeshared/**' + - 'rust/cubesqlplanner/**' - '.eslintrc.js' - '.prettierrc' - 'package.json' @@ -24,6 +28,10 @@ on: - 'packages/**' - 'rust/cubestore/**' - 'rust/cubesql/**' + - 'rust/cubenativeutils/**' + - 'rust/cubeorchestrator/**' + - 'rust/cubeshared/**' + - 'rust/cubesqlplanner/**' - '.eslintrc.js' - '.prettierrc' - 'package.json' @@ -104,7 +112,6 @@ jobs: 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 @@ -113,6 +120,51 @@ jobs: # files: ./packages/*/coverage/clover.xml # flags: cube-backend # verbose: true # optional (default = false) + - name: Cargo fmt cubeorchestrator + run: | + cargo fmt --manifest-path rust/cubeorchestrator/Cargo.toml -- --check + - name: Cargo build cubeorchestrator + run: | + cargo build --manifest-path rust/cubeorchestrator/Cargo.toml -j 4 + - name: Cargo test cubeorchestrator + run: | + cargo test --manifest-path rust/cubeorchestrator/Cargo.toml -j 1 + - name: Cargo fmt cubenativeutils + run: | + cargo fmt --manifest-path rust/cubenativeutils/Cargo.toml -- --check + - name: Cargo build cubenativeutils + run: | + cargo build --manifest-path rust/cubenativeutils/Cargo.toml -j 4 + - name: Cargo test cubenativeutils + run: | + cargo test --manifest-path rust/cubenativeutils/Cargo.toml -j 1 + - name: Cargo fmt cubeshared + run: | + cargo fmt --manifest-path rust/cubeshared/Cargo.toml -- --check + - name: Cargo build cubeshared + run: | + cargo build --manifest-path rust/cubeshared/Cargo.toml -j 4 + - name: Cargo test cubeshared + run: | + cargo test --manifest-path rust/cubeshared/Cargo.toml -j 1 + - name: Cargo fmt cubesql + run: | + cargo fmt --manifest-path rust/cubesql/Cargo.toml -- --check + - name: Cargo build cubesql + run: | + cargo build --manifest-path rust/cubesql/Cargo.toml -j 4 + - name: Cargo test cubesql + run: | + cargo test --manifest-path rust/cubesql/Cargo.toml -j 1 + - name: Cargo fmt cubesqlplanner + run: | + cargo fmt --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -- --check + - name: Cargo build cubesqlplanner + run: | + cargo build --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 4 + - name: Cargo test cubesqlplanner + run: | + cargo test --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 1 lint: runs-on: ubuntu-20.04 From 52d284fa6ae8abca369746b2796e36f329fd0018 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 20 Dec 2024 13:55:51 +0200 Subject: [PATCH 093/128] =?UTF-8?q?commented=20out=C2=A0cargo=20fmt/build/?= =?UTF-8?q?test=20for=C2=A0cubesql,=20cubesqlplanner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a26ce32017392..0cf313e1b0d48 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -147,24 +147,24 @@ jobs: - name: Cargo test cubeshared run: | cargo test --manifest-path rust/cubeshared/Cargo.toml -j 1 - - name: Cargo fmt cubesql - run: | - cargo fmt --manifest-path rust/cubesql/Cargo.toml -- --check - - name: Cargo build cubesql - run: | - cargo build --manifest-path rust/cubesql/Cargo.toml -j 4 - - name: Cargo test cubesql - run: | - cargo test --manifest-path rust/cubesql/Cargo.toml -j 1 - - name: Cargo fmt cubesqlplanner - run: | - cargo fmt --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -- --check - - name: Cargo build cubesqlplanner - run: | - cargo build --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 4 - - name: Cargo test cubesqlplanner - run: | - cargo test --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 1 +# - name: Cargo fmt cubesql +# run: | +# cargo fmt --manifest-path rust/cubesql/Cargo.toml -- --check +# - name: Cargo build cubesql +# run: | +# cargo build --manifest-path rust/cubesql/Cargo.toml -j 4 +# - name: Cargo test cubesql +# run: | +# cargo test --manifest-path rust/cubesql/Cargo.toml -j 1 +# - name: Cargo fmt cubesqlplanner +# run: | +# cargo fmt --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -- --check +# - name: Cargo build cubesqlplanner +# run: | +# cargo build --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 4 +# - name: Cargo test cubesqlplanner +# run: | +# cargo test --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 1 lint: runs-on: ubuntu-20.04 From 8a117270b28bd28505397a299ed727b7707e2a8b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 20 Dec 2024 13:59:38 +0200 Subject: [PATCH 094/128] remove transformdata JS implementation --- .../src/helpers/transformData.ts | 361 ------------------ 1 file changed, 361 deletions(-) delete mode 100644 packages/cubejs-api-gateway/src/helpers/transformData.ts diff --git a/packages/cubejs-api-gateway/src/helpers/transformData.ts b/packages/cubejs-api-gateway/src/helpers/transformData.ts deleted file mode 100644 index 5e2a49752a462..0000000000000 --- a/packages/cubejs-api-gateway/src/helpers/transformData.ts +++ /dev/null @@ -1,361 +0,0 @@ -/** - * @license Apache-2.0 - * @copyright Cube Dev, Inc. - * @fileoverview - * transformData function and related types definition. - */ - -import R from 'ramda'; -import moment, { MomentInput } from 'moment'; -import { UserError } from '../UserError'; -import { ConfigItem } from './prepareAnnotation'; -import { NormalizedQuery, QueryTimeDimension } from '../types/query'; -import { QueryType, ResultType, } from '../types/strings'; -import { QueryType as QueryTypeEnum, ResultType as ResultTypeEnum, } from '../types/enums'; -import { AliasToMemberMap, DBResponsePrimitive, DBResponseValue, TransformDataResponse } from '../types/responses'; - -const COMPARE_DATE_RANGE_FIELD = 'compareDateRange'; -const COMPARE_DATE_RANGE_SEPARATOR = ' - '; -const BLENDING_QUERY_KEY_PREFIX = 'time.'; -const BLENDING_QUERY_RES_SEPARATOR = '.'; -const MEMBER_SEPARATOR = '.'; - -/** - * Parse date range value from time dimension. - * @internal - */ -function getDateRangeValue( - timeDimensions?: QueryTimeDimension[] -): string { - if (!timeDimensions) { - throw new UserError( - 'QueryTimeDimension should be specified ' + - 'for the compare date range query.' - ); - } else { - const [dim] = timeDimensions; - if (!dim.dateRange) { - throw new UserError( - `${'Inconsistent QueryTimeDimension configuration ' + - 'for the compare date range query, dateRange required: '}${ - dim}` - ); - } else if (typeof dim.dateRange === 'string') { - throw new UserError( - 'Inconsistent dateRange configuration for the ' + - `compare date range query: ${dim.dateRange}` - ); - } else { - return dim.dateRange.join(COMPARE_DATE_RANGE_SEPARATOR); - } - } -} - -/** - * Parse blending query key from time dimension granularity. - * @internal - */ -function getBlendingQueryKey( - timeDimensions?: QueryTimeDimension[] -): string { - if (!timeDimensions) { - throw new UserError( - 'QueryTimeDimension should be specified ' + - 'for the blending query.' - ); - } else { - const [dim] = timeDimensions; - if (!dim.granularity) { - throw new UserError( - 'Inconsistent QueryTimeDimension configuration ' + - `for the blending query, granularity required: ${dim}` - ); - } else { - return BLENDING_QUERY_KEY_PREFIX + dim.granularity; - } - } -} - -/** - * Parse blending response key from time dimension and granularity. - * @internal - */ -function getBlendingResponseKey( - timeDimensions?: QueryTimeDimension[] -): string { - if (!timeDimensions) { - throw new UserError( - 'QueryTimeDimension should be specified ' + - 'for the blending query.' - ); - } else { - const [dim] = timeDimensions; - if (!dim.granularity) { - throw new UserError( - 'Inconsistent QueryTimeDimension configuration ' + - `for the blending query, granularity required: ${dim}` - ); - } else if (!dim.dimension) { - throw new UserError( - 'Inconsistent QueryTimeDimension configuration ' + - `for the blending query, dimension required: ${dim}` - ); - } else { - return dim.dimension + - BLENDING_QUERY_RES_SEPARATOR + - dim.granularity; - } - } -} - -/** - * Parse members names from request/response. - * @internal - */ -function getMembers( - queryType: QueryType, - query: NormalizedQuery, - dbData: { [sqlAlias: string]: DBResponseValue }[], - aliasToMemberNameMap: AliasToMemberMap, - annotation: { [member: string]: ConfigItem }, -): { [member: string]: string } { - const members: { [member: string]: string } = {}; - if (!dbData.length) { - return members; - } - const columns = Object.keys(dbData[0]); - columns.forEach((column) => { - if (!aliasToMemberNameMap[column] || !annotation[aliasToMemberNameMap[column]]) { - throw new UserError( - `You requested hidden member: '${ - column - }'. Please make it visible using \`shown: true\`. ` + - 'Please note primaryKey fields are `shown: false` by ' + - 'default: https://cube.dev/docs/schema/reference/joins#' + - 'setting-a-primary-key.' - ); - } - members[aliasToMemberNameMap[column]] = column; - const path = aliasToMemberNameMap[column] - .split(MEMBER_SEPARATOR); - const calcMember = - [path[0], path[1]].join(MEMBER_SEPARATOR); - if ( - path.length === 3 && - query.dimensions?.indexOf(calcMember) === -1 - ) { - members[calcMember] = column; - } - }); - if (queryType === QueryTypeEnum.COMPARE_DATE_RANGE_QUERY) { - members[COMPARE_DATE_RANGE_FIELD] = - QueryTypeEnum.COMPARE_DATE_RANGE_QUERY; - } else if (queryType === QueryTypeEnum.BLENDING_QUERY) { - members[getBlendingQueryKey(query.timeDimensions)] = - // @ts-ignore - members[query.timeDimensions[0].dimension]; - } - return members; -} - -/** - * Transform specified `value` with specified `type` to the network - * protocol type. - */ -function transformValue( - value: DBResponseValue, - type: string -): DBResponsePrimitive { - // TODO: support for max time - if (value && (type === 'time' || value instanceof Date)) { - return ( - value instanceof Date - ? moment(value) - : moment.utc(value as MomentInput) - ).format(moment.HTML5_FMT.DATETIME_LOCAL_MS); - } - return value as DBResponsePrimitive; -} - -/** - * Convert DB response object to the compact output format. - * @internal - * @todo should we use transformValue for blending query? - */ -function getCompactRow( - membersToAliasMap: { [member: string]: string }, - annotation: { [member: string]: ConfigItem }, - queryType: QueryType, - members: string[], - timeDimensions: QueryTimeDimension[] | undefined, - dbRow: { [sqlAlias: string]: DBResponseValue }, -): DBResponsePrimitive[] { - const row: DBResponsePrimitive[] = []; - members.forEach((m: string) => { - if (annotation[m]) { - row.push( - transformValue( - dbRow[membersToAliasMap[m]], - annotation[m].type - ), - ); - } - }); - if (queryType === QueryTypeEnum.COMPARE_DATE_RANGE_QUERY) { - row.push( - getDateRangeValue(timeDimensions) - ); - } else if (queryType === QueryTypeEnum.BLENDING_QUERY) { - row.push( - dbRow[ - membersToAliasMap[ - getBlendingResponseKey(timeDimensions) - ] - ] as DBResponsePrimitive - ); - } - return row; -} - -/** - * Convert DB response object to the vanilla output format. - * @internal - */ -function getVanillaRow( - aliasToMemberNameMap: AliasToMemberMap, - annotation: { [member: string]: ConfigItem }, - queryType: QueryType, - query: NormalizedQuery, - dbRow: { [sqlAlias: string]: DBResponseValue }, -): { [member: string]: DBResponsePrimitive } { - const row = Object - .entries(dbRow) - .reduce((acc, [sqlAlias, value]) => { - const memberName = aliasToMemberNameMap[sqlAlias]; - const annotationForMember = annotation[memberName]; - - if (!annotationForMember) { - throw new UserError( - `You requested hidden member: '${sqlAlias}'. ` + - 'Please make it visible using `shown: true`. ' + - 'Please note primaryKey fields are `shown: false` by default: ' + - 'https://cube.dev/docs/schema/reference/joins#setting-a-primary-key.' - ); - } - - const transformedValue = transformValue(value as DBResponseValue, annotationForMember.type); - const path = memberName.split(MEMBER_SEPARATOR); - - acc[memberName] = transformedValue; - - /** - * Handle time dimensions without granularity - * @deprecated - * @todo backward compatibility for referencing - */ - const memberNameWithoutGranularity = [path[0], path[1]].join(MEMBER_SEPARATOR); - if (path.length === 3 && - (query.dimensions || []).indexOf(memberNameWithoutGranularity) === -1) { - acc[memberNameWithoutGranularity] = transformedValue; - } - - return acc; - }, {} as { [member: string]: DBResponsePrimitive }); - - if (queryType === QueryTypeEnum.COMPARE_DATE_RANGE_QUERY) { - return { - ...row, - compareDateRange: getDateRangeValue(query.timeDimensions) - }; - } - - if (queryType === QueryTypeEnum.BLENDING_QUERY) { - return { - ...row, - [getBlendingQueryKey(query.timeDimensions)]: - row[getBlendingResponseKey(query.timeDimensions)] - }; - } - - return row as { [member: string]: DBResponsePrimitive; }; -} - -/** - * Transforms queried data array to the output format. - */ -function transformData({ - aliasToMemberNameMap, - annotation, - data, - query, - queryType, - resType, -}: { - aliasToMemberNameMap: AliasToMemberMap; - annotation: { [member: string]: ConfigItem }; - data: { [sqlAlias: string]: unknown }[]; - query: NormalizedQuery; - queryType: QueryType; - resType?: ResultType; -}): TransformDataResponse { - const d = data as { [sqlAlias: string]: DBResponseValue }[]; - const membersToAliasMap = getMembers( - queryType, - query, - d, - aliasToMemberNameMap, - annotation, - ); - const members: string[] = Object.keys(membersToAliasMap); - const dataset: DBResponsePrimitive[][] | { - [member: string]: DBResponsePrimitive - }[] = d.map((r) => { - const row: DBResponsePrimitive[] | { - [member: string]: DBResponsePrimitive - } = resType === ResultTypeEnum.COMPACT - ? getCompactRow( - membersToAliasMap, - annotation, - queryType, - members, - query.timeDimensions, - r, - ) - : getVanillaRow( - aliasToMemberNameMap, - annotation, - queryType, - query, - r, - ); - return row; - }) as DBResponsePrimitive[][] | { - [member: string]: DBResponsePrimitive - }[]; - return (resType === ResultTypeEnum.COMPACT - ? { members, dataset } - : dataset - ) as { - members: string[], - dataset: DBResponsePrimitive[][] - } | { - [member: string]: DBResponsePrimitive - }[]; -} - -export default transformData; -export { - COMPARE_DATE_RANGE_FIELD, - COMPARE_DATE_RANGE_SEPARATOR, - BLENDING_QUERY_KEY_PREFIX, - BLENDING_QUERY_RES_SEPARATOR, - MEMBER_SEPARATOR, - getDateRangeValue, - getBlendingQueryKey, - getBlendingResponseKey, - getMembers, - getCompactRow, - getVanillaRow, - transformData, - transformValue, -}; From 2198a6389f42b6d8842064274337fcb92bbfab6f Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 20 Dec 2024 16:38:27 +0200 Subject: [PATCH 095/128] refactor push CI jobs --- .github/workflows/push.yml | 60 +++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 0cf313e1b0d48..5976c1f29b84d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -120,48 +120,18 @@ jobs: # files: ./packages/*/coverage/clover.xml # flags: cube-backend # verbose: true # optional (default = false) - - name: Cargo fmt cubeorchestrator - run: | - cargo fmt --manifest-path rust/cubeorchestrator/Cargo.toml -- --check - - name: Cargo build cubeorchestrator - run: | - cargo build --manifest-path rust/cubeorchestrator/Cargo.toml -j 4 - name: Cargo test cubeorchestrator run: | cargo test --manifest-path rust/cubeorchestrator/Cargo.toml -j 1 - - name: Cargo fmt cubenativeutils - run: | - cargo fmt --manifest-path rust/cubenativeutils/Cargo.toml -- --check - - name: Cargo build cubenativeutils - run: | - cargo build --manifest-path rust/cubenativeutils/Cargo.toml -j 4 - name: Cargo test cubenativeutils run: | cargo test --manifest-path rust/cubenativeutils/Cargo.toml -j 1 - - name: Cargo fmt cubeshared - run: | - cargo fmt --manifest-path rust/cubeshared/Cargo.toml -- --check - - name: Cargo build cubeshared - run: | - cargo build --manifest-path rust/cubeshared/Cargo.toml -j 4 - name: Cargo test cubeshared run: | cargo test --manifest-path rust/cubeshared/Cargo.toml -j 1 -# - name: Cargo fmt cubesql -# run: | -# cargo fmt --manifest-path rust/cubesql/Cargo.toml -- --check -# - name: Cargo build cubesql -# run: | -# cargo build --manifest-path rust/cubesql/Cargo.toml -j 4 # - name: Cargo test cubesql # run: | # cargo test --manifest-path rust/cubesql/Cargo.toml -j 1 -# - name: Cargo fmt cubesqlplanner -# run: | -# cargo fmt --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -- --check -# - name: Cargo build cubesqlplanner -# run: | -# cargo build --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 4 # - name: Cargo test cubesqlplanner # run: | # cargo test --manifest-path rust/cubesqlplanner/cubesqlplanner/Cargo.toml -j 1 @@ -213,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 @@ -265,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] From fef607c04925893191f2e49aa4f121f493a384ed Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 13:50:03 +0200 Subject: [PATCH 096/128] =?UTF-8?q?rename=20CubestoreResultWrapper=20?= =?UTF-8?q?=E2=86=92=20ResultWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/{CubeStoreResultWrapper.ts => ResultWrapper.ts} | 2 +- packages/cubejs-backend-native/js/index.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename packages/cubejs-backend-native/js/{CubeStoreResultWrapper.ts => ResultWrapper.ts} (98%) diff --git a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts similarity index 98% rename from packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts rename to packages/cubejs-backend-native/js/ResultWrapper.ts index a85215fb57ac6..9153559ac0f73 100644 --- a/packages/cubejs-backend-native/js/CubeStoreResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -1,6 +1,6 @@ import { getCubestoreResult, ResultRow } from './index'; -export class CubeStoreResultWrapper { +export class ResultWrapper { private readonly proxy: any; private cache: any; diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 2f2e3327f9e7f..fe707175afa36 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -3,9 +3,9 @@ import fs from 'fs'; import path from 'path'; import { Writable } from 'stream'; import type { Request as ExpressRequest } from 'express'; -import { CubeStoreResultWrapper } from './CubeStoreResultWrapper'; +import { ResultWrapper } from './ResultWrapper'; -export * from './CubeStoreResultWrapper'; +export * from './ResultWrapper'; export interface BaseMeta { // postgres or mysql @@ -363,14 +363,14 @@ export const buildSqlAndParams = (cubeEvaluator: any): String => { export type ResultRow = Record; -export const parseCubestoreResultMessage = async (message: ArrayBuffer): Promise => { +export const parseCubestoreResultMessage = async (message: ArrayBuffer): Promise => { const native = loadNative(); const msg = await native.parseCubestoreResultMessage(message); - return new CubeStoreResultWrapper(msg); + return new ResultWrapper(msg); }; -export const getCubestoreResult = (ref: CubeStoreResultWrapper): ResultRow[] => { +export const getCubestoreResult = (ref: ResultWrapper): ResultRow[] => { const native = loadNative(); return native.getCubestoreResult(ref); From 5c926c039fb9510651ff9a064ac0c13c0aeef0ae Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 13:50:35 +0200 Subject: [PATCH 097/128] =?UTF-8?q?add=20isNative=20flag=20to=C2=A0ResultW?= =?UTF-8?q?rapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/js/ResultWrapper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 9153559ac0f73..05170b76f879a 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -7,7 +7,13 @@ export class ResultWrapper { public cached: Boolean = false; + private readonly isNative: Boolean = false; + public constructor(private readonly nativeReference: any) { + if (nativeReference) { + this.isNative = true; + } + this.proxy = new Proxy(this, { get: (target, prop: string | symbol) => { // intercept indexes @@ -18,7 +24,7 @@ export class ResultWrapper { // intercept isNative if (prop === 'isNative') { - return true; + return this.isNative; } // intercept array props and methods From d17df336b9ead70626ba25f17fdf89f08439a5ad Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 13:52:31 +0200 Subject: [PATCH 098/128] =?UTF-8?q?rename=20getResultInternal=20=E2=86=92?= =?UTF-8?q?=20prepareResultTransformData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 428485f528ddc..3c9e6850fc708 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1602,11 +1602,11 @@ class ApiGateway { } /** - * Convert adapter's result and other request parameters to a final + * Prepare adapter's result and other transform parameters for a final * result object. * @internal */ - private async getResultInternal( + private async prepareResultTransformData( context: RequestContext, queryType: QueryType, normalizedQuery: NormalizedQuery, @@ -1785,7 +1785,7 @@ class ApiGateway { metaConfigResult, normalizedQuery ); - return this.getResultInternal( + return this.prepareResultTransformData( context, queryType, normalizedQuery, @@ -1963,7 +1963,7 @@ class ApiGateway { sqlQueries[index], ); - return this.getResultInternal( + return this.prepareResultTransformData( context, queryType, normalizedQuery, From 0db0d067220eef97bedf608c1b41b2125fdba54d Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 15:04:46 +0200 Subject: [PATCH 099/128] =?UTF-8?q?use=20ResultWrapper=20for=C2=A0all=20re?= =?UTF-8?q?sults?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 40 +++++++++++++------ .../cubejs-backend-native/js/ResultWrapper.ts | 20 ++++++++-- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 3c9e6850fc708..7cd1cb3798248 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -14,6 +14,7 @@ import { getFinalQueryResult, getFinalQueryResultArray, getFinalQueryResultMulti, + ResultWrapper, } from '@cubejs-backend/native'; import type { Application as ExpressApplication, @@ -120,7 +121,6 @@ function cleanupResult(result) { return { ...result, rawData: undefined, - transformDataParams: undefined, }; } @@ -1553,7 +1553,7 @@ class ApiGateway { context: RequestContext, normalizedQuery: NormalizedQuery, sqlQuery: any, - ) { + ): Promise { const queries = [{ ...sqlQuery, query: sqlQuery.sql[0], @@ -1598,7 +1598,22 @@ class ApiGateway { response.total = normalizedQuery.total ? Number(total.data[0][QueryAlias.TOTAL_COUNT]) : undefined; - return response; + + return this.wrapAdapterQueryResultIfNeeded(response); + } + + /** + * Wraps the adapter's response in unified ResultWrapper if it comes from + * a common driver (not a Cubestore's one, cause Cubestore Driver internally creates ResultWrapper) + * @param res Adapter's response + * @private + */ + private wrapAdapterQueryResultIfNeeded(res: any): ResultWrapper { + if (!(res.data instanceof ResultWrapper)) { + res.data = new ResultWrapper(null, res.data); + } + + return res; } /** @@ -1640,11 +1655,12 @@ class ApiGateway { resType: responseType, }; + response.data.setTransformData(transformDataParams); + // We postpone data transformation until the last minute return { query: normalizedQuery, rawData: response.data, - transformDataParams, lastRefreshTime: response.lastRefreshTime?.toISOString(), ...( getEnv('devMode') || @@ -1826,8 +1842,8 @@ class ApiGateway { // We prepare the final json result on native side const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(r.transformDataParams); - rawList.push(r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData); + transformList.push(r.rawData.getTransformData()); + rawList.push(r.rawData.getRawData()); resultList.push(cleanupResult(r)); return [transformList, rawList, resultList]; }, @@ -1844,8 +1860,9 @@ class ApiGateway { } else { // We prepare the full final json result on native side const r = results[0]; - const rawData = r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData; - res(await getFinalQueryResult(r.transformDataParams, rawData, cleanupResult(r))); + res(await getFinalQueryResult( + r.rawData.getTransformData(), r.rawData.getRawData(), cleanupResult(r) + )); } } catch (e: any) { this.handleError({ @@ -1980,12 +1997,11 @@ class ApiGateway { } else { // We prepare the final json result on native side const [transformDataJson, rawData, resultDataJson] = (results as { - transformDataParams: any; - rawData: { isNative: boolean, getNativeRef: () => any }; + rawData: { getTransformData: () => any, getRawData: () => any }; }[]).reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(r.transformDataParams); - rawList.push(r.rawData.isNative ? r.rawData.getNativeRef() : r.rawData); + transformList.push(r.rawData.getTransformData()); + rawList.push(r.rawData.getRawData()); resultList.push(cleanupResult(r)); return [transformList, rawList, resultList]; }, diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 05170b76f879a..de62be9cf9961 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -9,7 +9,9 @@ export class ResultWrapper { private readonly isNative: Boolean = false; - public constructor(private readonly nativeReference: any) { + private transformData: any; + + public constructor(private readonly nativeReference: any, private readonly jsResult: any = null) { if (nativeReference) { this.isNative = true; } @@ -81,7 +83,19 @@ export class ResultWrapper { return (array as any)[method](...args); } - public getNativeRef() { - return this.nativeReference; + public getRawData() { + if (this.isNative) { + return this.nativeReference; + } + + return this.jsResult; + } + + public setTransformData(td: any) { + this.transformData = td; + } + + public getTransformData(): any { + return this.transformData; } } From 4224f58a6079879bd81eb36eaad127d1fdc6a659 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 15:09:15 +0200 Subject: [PATCH 100/128] =?UTF-8?q?fix=20getArray=20in=C2=A0ResultWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/js/ResultWrapper.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index de62be9cf9961..9d324c3b12c04 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -72,7 +72,11 @@ export class ResultWrapper { private getArray(): ResultRow[] { if (!this.cache) { - this.cache = getCubestoreResult(this.nativeReference); + if (this.isNative) { + this.cache = getCubestoreResult(this.nativeReference); + } else { + this.cache = this.jsResult; + } this.cached = true; } return this.cache; From fadc3e9b5185e8fc6a8954359d40920d5b26b77c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 18:19:05 +0200 Subject: [PATCH 101/128] lint fix --- packages/cubejs-server/src/websocket-server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-server/src/websocket-server.ts b/packages/cubejs-server/src/websocket-server.ts index 971c04db1d19f..68820df1d7b19 100644 --- a/packages/cubejs-server/src/websocket-server.ts +++ b/packages/cubejs-server/src/websocket-server.ts @@ -45,7 +45,7 @@ export class WebSocketServer { const resMsg = new TextDecoder().decode(message.message); message.message = "~XXXXX~"; messageStr = JSON.stringify(message); - messageStr = messageStr.replace(`"~XXXXX~"`, resMsg); + messageStr = messageStr.replace('"~XXXXX~"', resMsg); } else { messageStr = JSON.stringify(message); } From 4e9a5403e7fa3582640ab7199971419b71d10786 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 18:49:56 +0200 Subject: [PATCH 102/128] =?UTF-8?q?encapsulate=20rootResultObject=20into?= =?UTF-8?q?=C2=A0ResultWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 48 ++++++++----------- .../cubejs-backend-native/js/ResultWrapper.ts | 10 ++++ 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 7cd1cb3798248..57d078290ac1c 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -117,13 +117,6 @@ function systemAsyncHandler(handler: (req: Request & { context: ExtendedRequestC }; } -function cleanupResult(result) { - return { - ...result, - rawData: undefined, - }; -} - // Prepared CheckAuthFn, default or from config: always async, returns nothing type PreparedCheckAuthFn = (ctx: any, authorization?: string) => Promise; @@ -1621,7 +1614,7 @@ class ApiGateway { * result object. * @internal */ - private async prepareResultTransformData( + private prepareResultTransformData( context: RequestContext, queryType: QueryType, normalizedQuery: NormalizedQuery, @@ -1642,7 +1635,9 @@ class ApiGateway { }, response: any, responseType?: ResultType, - ) { + ): ResultWrapper { + const resultWrapper = response.data; + const transformDataParams = { aliasToMemberNameMap: sqlQuery.aliasNameToMember, annotation: { @@ -1655,12 +1650,8 @@ class ApiGateway { resType: responseType, }; - response.data.setTransformData(transformDataParams); - - // We postpone data transformation until the last minute - return { + const resObj = { query: normalizedQuery, - rawData: response.data, lastRefreshTime: response.lastRefreshTime?.toISOString(), ...( getEnv('devMode') || @@ -1681,6 +1672,11 @@ class ApiGateway { slowQuery: Boolean(response.slowQuery), total: normalizedQuery.total ? response.total : null, }; + + resultWrapper.setTransformData(transformDataParams); + resultWrapper.setRootResultObject(resObj); + + return resultWrapper; } /** @@ -1825,15 +1821,13 @@ class ApiGateway { queries: results.length, queriesWithPreAggregations: results.filter( - (r: any) => Object.keys( - r.usedPreAggregations || {} - ).length + (r: any) => Object.keys(r.getRootResultObject().usedPreAggregations || {}).length ).length, // Have to omit because data could be processed natively // so it is not known at this point // queriesWithData: // results.filter((r: any) => r.data?.length).length, - dbType: results.map(r => r.dbType), + dbType: results.map(r => r.getRootResultObject().dbType), }, context, ); @@ -1842,9 +1836,9 @@ class ApiGateway { // We prepare the final json result on native side const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(r.rawData.getTransformData()); - rawList.push(r.rawData.getRawData()); - resultList.push(cleanupResult(r)); + transformList.push(r.getTransformData()); + rawList.push(r.getRawData()); + resultList.push(r.getRootResultObject()); return [transformList, rawList, resultList]; }, [[], [], []] @@ -1861,7 +1855,7 @@ class ApiGateway { // We prepare the full final json result on native side const r = results[0]; res(await getFinalQueryResult( - r.rawData.getTransformData(), r.rawData.getRawData(), cleanupResult(r) + r.getTransformData(), r.getRawData(), r.getRootResultObject() )); } } catch (e: any) { @@ -1996,13 +1990,11 @@ class ApiGateway { res(results[0]); } else { // We prepare the final json result on native side - const [transformDataJson, rawData, resultDataJson] = (results as { - rawData: { getTransformData: () => any, getRawData: () => any }; - }[]).reduce<[Object[], any[], Object[]]>( + const [transformDataJson, rawData, resultDataJson] = (results as ResultWrapper[]).reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(r.rawData.getTransformData()); - rawList.push(r.rawData.getRawData()); - resultList.push(cleanupResult(r)); + transformList.push(r.getTransformData()); + rawList.push(r.getRawData()); + resultList.push(r.getRootResultObject()); return [transformList, rawList, resultList]; }, [[], [], []] diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 9d324c3b12c04..82b3944084676 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -11,6 +11,8 @@ export class ResultWrapper { private transformData: any; + private rootResultObject: any = {}; + public constructor(private readonly nativeReference: any, private readonly jsResult: any = null) { if (nativeReference) { this.isNative = true; @@ -102,4 +104,12 @@ export class ResultWrapper { public getTransformData(): any { return this.transformData; } + + public setRootResultObject(obj: any) { + this.rootResultObject = obj; + } + + public getRootResultObject(): any { + return this.rootResultObject; + } } From 8b1cbf53031e0cedccab1c0c54839c828e090525 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 20:11:54 +0200 Subject: [PATCH 103/128] =?UTF-8?q?add=20DataResult=20interface=20+=20impl?= =?UTF-8?q?ement=20it=20in=C2=A0result=20wrappers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-api-gateway/src/gateway.ts | 41 +++--------- .../cubejs-backend-native/js/ResultWrapper.ts | 62 ++++++++++++++++++- 2 files changed, 67 insertions(+), 36 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 57d078290ac1c..6db003b4997a4 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -11,9 +11,8 @@ import { QueryAlias, } from '@cubejs-backend/shared'; import { - getFinalQueryResult, - getFinalQueryResultArray, - getFinalQueryResultMulti, + ResultArrayWrapper, + ResultMultiWrapper, ResultWrapper, } from '@cubejs-backend/native'; import type { @@ -1834,29 +1833,12 @@ class ApiGateway { if (props.queryType === 'multi') { // We prepare the final json result on native side - const [transformDataJson, rawDataRef, cleanResultList] = results.reduce<[Object[], any[], Object[]]>( - ([transformList, rawList, resultList], r) => { - transformList.push(r.getTransformData()); - rawList.push(r.getRawData()); - resultList.push(r.getRootResultObject()); - return [transformList, rawList, resultList]; - }, - [[], [], []] - ); - - const responseDataObj = { - queryType, - results: cleanResultList, - slowQuery - }; - - res(await getFinalQueryResultMulti(transformDataJson, rawDataRef, responseDataObj)); + const resultMulti = new ResultMultiWrapper(results, { queryType, slowQuery }); + res(await resultMulti.getFinalResult()); } else { // We prepare the full final json result on native side const r = results[0]; - res(await getFinalQueryResult( - r.getTransformData(), r.getRawData(), r.getRootResultObject() - )); + res(await r.getFinalResult()); } } catch (e: any) { this.handleError({ @@ -1990,17 +1972,8 @@ class ApiGateway { res(results[0]); } else { // We prepare the final json result on native side - const [transformDataJson, rawData, resultDataJson] = (results as ResultWrapper[]).reduce<[Object[], any[], Object[]]>( - ([transformList, rawList, resultList], r) => { - transformList.push(r.getTransformData()); - rawList.push(r.getRawData()); - resultList.push(r.getRootResultObject()); - return [transformList, rawList, resultList]; - }, - [[], [], []] - ); - - res(await getFinalQueryResultArray(transformDataJson, rawData, resultDataJson)); + const resultArray = new ResultArrayWrapper(results); + res(await resultArray.getFinalResult()); } } } catch (e: any) { diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 82b3944084676..34af111cfa74e 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -1,6 +1,16 @@ -import { getCubestoreResult, ResultRow } from './index'; +import { + getCubestoreResult, + getFinalQueryResult, + getFinalQueryResultArray, + getFinalQueryResultMulti, + ResultRow +} from './index'; + +export interface DataResult { + getFinalResult(): Promise; +} -export class ResultWrapper { +export class ResultWrapper implements DataResult { private readonly proxy: any; private cache: any; @@ -112,4 +122,52 @@ export class ResultWrapper { public getRootResultObject(): any { return this.rootResultObject; } + + public async getFinalResult(): Promise { + return getFinalQueryResult(this.transformData, this.getRawData(), this.rootResultObject); + } +} + +export class ResultMultiWrapper implements DataResult { + public constructor(private readonly results: ResultWrapper[], private rootResultObject: any) { + } + + public async getFinalResult(): Promise { + const [transformDataJson, rawDataRef, cleanResultList] = this.results.reduce<[Object[], any[], Object[]]>( + ([transformList, rawList, resultList], r) => { + transformList.push(r.getTransformData()); + rawList.push(r.getRawData()); + resultList.push(r.getRootResultObject()); + return [transformList, rawList, resultList]; + }, + [[], [], []] + ); + + const responseDataObj = { + queryType: this.rootResultObject.queryType, + results: cleanResultList, + slowQuery: this.rootResultObject.slowQuery, + }; + + return getFinalQueryResultMulti(transformDataJson, rawDataRef, responseDataObj); + } +} + +export class ResultArrayWrapper implements DataResult { + public constructor(private readonly results: ResultWrapper[]) { + } + + public async getFinalResult(): Promise { + const [transformDataJson, rawData, resultDataJson] = this.results.reduce<[Object[], any[], Object[]]>( + ([transformList, rawList, resultList], r) => { + transformList.push(r.getTransformData()); + rawList.push(r.getRawData()); + resultList.push(r.getRootResultObject()); + return [transformList, rawList, resultList]; + }, + [[], [], []] + ); + + return getFinalQueryResultArray(transformDataJson, rawData, resultDataJson); + } } From 8e52d69e96bf250c7435813791926f7a11c10844 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 21:15:11 +0200 Subject: [PATCH 104/128] =?UTF-8?q?add=20isWrapper=20property=20to=C2=A0wr?= =?UTF-8?q?appers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/js/ResultWrapper.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 34af111cfa74e..b8f1d95066a54 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -10,7 +10,11 @@ export interface DataResult { getFinalResult(): Promise; } -export class ResultWrapper implements DataResult { +class BaseWrapper { + public readonly isWrapper: boolean = true; +} + +export class ResultWrapper extends BaseWrapper implements DataResult { private readonly proxy: any; private cache: any; @@ -24,6 +28,8 @@ export class ResultWrapper implements DataResult { private rootResultObject: any = {}; public constructor(private readonly nativeReference: any, private readonly jsResult: any = null) { + super(); + if (nativeReference) { this.isNative = true; } @@ -128,8 +134,9 @@ export class ResultWrapper implements DataResult { } } -export class ResultMultiWrapper implements DataResult { +export class ResultMultiWrapper extends BaseWrapper implements DataResult { public constructor(private readonly results: ResultWrapper[], private rootResultObject: any) { + super(); } public async getFinalResult(): Promise { @@ -153,8 +160,9 @@ export class ResultMultiWrapper implements DataResult { } } -export class ResultArrayWrapper implements DataResult { +export class ResultArrayWrapper extends BaseWrapper implements DataResult { public constructor(private readonly results: ResultWrapper[]) { + super(); } public async getFinalResult(): Promise { From 86121a510ab059e4eb3d1f6fc2e3cb60d92a17a5 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 7 Jan 2025 21:56:18 +0200 Subject: [PATCH 105/128] transform wrapped result later before returning the response --- packages/cubejs-api-gateway/src/gateway.ts | 15 +++++++-------- packages/cubejs-api-gateway/src/sql-server.ts | 7 +------ packages/cubejs-api-gateway/src/types/request.ts | 3 ++- .../cubejs-backend-native/js/ResultWrapper.ts | 1 + packages/cubejs-backend-native/js/index.ts | 5 ++++- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 6db003b4997a4..5e9eb942850ce 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1834,11 +1834,10 @@ class ApiGateway { if (props.queryType === 'multi') { // We prepare the final json result on native side const resultMulti = new ResultMultiWrapper(results, { queryType, slowQuery }); - res(await resultMulti.getFinalResult()); + res(resultMulti); } else { // We prepare the full final json result on native side - const r = results[0]; - res(await r.getFinalResult()); + res(results[0]); } } catch (e: any) { this.handleError({ @@ -1973,7 +1972,7 @@ class ApiGateway { } else { // We prepare the final json result on native side const resultArray = new ResultArrayWrapper(results); - res(await resultArray.getFinalResult()); + res(resultArray); } } } catch (e: any) { @@ -2021,7 +2020,7 @@ class ApiGateway { query, context, res: (message, opts) => { - if (!Array.isArray(message) && message.error) { + if (!Array.isArray(message) && 'error' in message && message.error) { error = { message, opts }; } else { result = { message, opts }; @@ -2045,14 +2044,14 @@ class ApiGateway { } protected resToResultFn(res: ExpressResponse) { - return (message, { status }: { status?: number } = {}) => { + return async (message, { status }: { status?: number } = {}) => { if (status) { res.status(status); } - if (message instanceof ArrayBuffer) { + if (message.isWrapper) { res.set('Content-Type', 'application/json'); - res.send(Buffer.from(message)); + res.send(Buffer.from(await message.getFinalResult())); } else { res.json(message); } diff --git a/packages/cubejs-api-gateway/src/sql-server.ts b/packages/cubejs-api-gateway/src/sql-server.ts index 49a404706fe43..32e7d37e1e19c 100644 --- a/packages/cubejs-api-gateway/src/sql-server.ts +++ b/packages/cubejs-api-gateway/src/sql-server.ts @@ -193,12 +193,7 @@ export class SQLServer { return; } - if (response instanceof ArrayBuffer) { - const json = JSON.parse(new TextDecoder().decode(response)); - resolve(json); - } else { - resolve(response); - } + resolve(response); }, apiType: 'sql', }); diff --git a/packages/cubejs-api-gateway/src/types/request.ts b/packages/cubejs-api-gateway/src/types/request.ts index ed6c5bbd80174..3393554fd8d65 100644 --- a/packages/cubejs-api-gateway/src/types/request.ts +++ b/packages/cubejs-api-gateway/src/types/request.ts @@ -6,6 +6,7 @@ */ import type { Request as ExpressRequest } from 'express'; +import type { DataResult } from '@cubejs-backend/native'; import { RequestType, ApiType, ResultType } from './strings'; import { Query } from './query'; @@ -105,7 +106,7 @@ type MetaResponseResultFn = (message: MetaResponse | ErrorResponse) => void; */ type ResponseResultFn = ( - message: (Record | Record[]) | ErrorResponse, + message: (Record | Record[]) | DataResult | ErrorResponse, extra?: { status: number } ) => void; diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index b8f1d95066a54..c68b335b2a2a4 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -7,6 +7,7 @@ import { } from './index'; export interface DataResult { + isWrapper: boolean; getFinalResult(): Promise; } diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index fe707175afa36..252571aefddf7 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -266,8 +266,11 @@ function wrapNativeFunctionWithStream( }); } else if (response.error) { writerOrChannel.reject(errorString(response)); + } else if (response.isWrapper) { // Native wrapped result + const resArBuf = await response.getFinalResult(); + const resStr = new TextDecoder().decode(resArBuf); + writerOrChannel.resolve(resStr); } else { - // TODO remove JSON.stringify() writerOrChannel.resolve(JSON.stringify(response)); } } catch (e: any) { From 3ecc87f0f1ad1277359c9d9447914dc2012511aa Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 8 Jan 2025 21:07:01 +0200 Subject: [PATCH 106/128] fix lint warn --- packages/cubejs-api-gateway/src/gateway.ts | 4 ++++ packages/cubejs-backend-native/js/ResultWrapper.ts | 2 +- packages/cubejs-server/src/websocket-server.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 5e9eb942850ce..a4869555d3237 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1843,6 +1843,8 @@ class ApiGateway { this.handleError({ e, context, query, res, requestStarted }); + + return null; } } @@ -1979,6 +1981,8 @@ class ApiGateway { this.handleError({ e, context, query, res, requestStarted }); + + return null; } } diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index c68b335b2a2a4..c0bf150a35e08 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -12,7 +12,7 @@ export interface DataResult { } class BaseWrapper { - public readonly isWrapper: boolean = true; + public readonly isWrapper: boolean = true; } export class ResultWrapper extends BaseWrapper implements DataResult { diff --git a/packages/cubejs-server/src/websocket-server.ts b/packages/cubejs-server/src/websocket-server.ts index 68820df1d7b19..00ee1c61e8dbd 100644 --- a/packages/cubejs-server/src/websocket-server.ts +++ b/packages/cubejs-server/src/websocket-server.ts @@ -43,7 +43,7 @@ export class WebSocketServer { // it again - it's too expensive, instead we serialize the rest of the message and then // inject query result json into message. const resMsg = new TextDecoder().decode(message.message); - message.message = "~XXXXX~"; + message.message = '~XXXXX~'; messageStr = JSON.stringify(message); messageStr = messageStr.replace('"~XXXXX~"', resMsg); } else { From 587725656fea6c765b4171db838f0a4999aed88a Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 8 Jan 2025 23:20:06 +0200 Subject: [PATCH 107/128] fix async request porcessing --- packages/cubejs-api-gateway/src/gateway.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index a4869555d3237..eb921325e2a24 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1834,10 +1834,10 @@ class ApiGateway { if (props.queryType === 'multi') { // We prepare the final json result on native side const resultMulti = new ResultMultiWrapper(results, { queryType, slowQuery }); - res(resultMulti); + return res(resultMulti); } else { // We prepare the full final json result on native side - res(results[0]); + return res(results[0]); } } catch (e: any) { this.handleError({ @@ -1936,7 +1936,7 @@ class ApiGateway { }]; } - res(request.streaming ? results[0] : { results }); + return res(request.streaming ? results[0] : { results }); } else { results = await Promise.all( normalizedQueries.map(async (normalizedQuery, index) => { @@ -1970,11 +1970,11 @@ class ApiGateway { ); if (request.streaming) { - res(results[0]); + return res(results[0]); } else { // We prepare the final json result on native side const resultArray = new ResultArrayWrapper(results); - res(resultArray); + return res(resultArray); } } } catch (e: any) { From 5145660d531a0005a9a4f9f638016cbf9dc4415b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 00:21:33 +0200 Subject: [PATCH 108/128] some node version fix --- packages/cubejs-backend-shared/package.json | 2 +- packages/cubejs-mssql-driver/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cubejs-backend-shared/package.json b/packages/cubejs-backend-shared/package.json index d0a59c6b98f42..f701cc0e68c71 100644 --- a/packages/cubejs-backend-shared/package.json +++ b/packages/cubejs-backend-shared/package.json @@ -27,7 +27,7 @@ "@types/cli-progress": "^3.9.1", "@types/decompress": "^4.2.3", "@types/jest": "^27", - "@types/node": "^12", + "@types/node": "^18", "@types/node-fetch": "^2.5.8", "@types/shelljs": "^0.8.5", "@types/throttle-debounce": "^2.1.0", diff --git a/packages/cubejs-mssql-driver/package.json b/packages/cubejs-mssql-driver/package.json index 7da816a863e4d..ca078718e4a2b 100644 --- a/packages/cubejs-mssql-driver/package.json +++ b/packages/cubejs-mssql-driver/package.json @@ -18,7 +18,7 @@ }, "devDependencies": { "@types/mssql": "^9.1.5", - "@types/node": "^16" + "@types/node": "^18" }, "jest": { "testEnvironment": "node" From a346d9af2795ca7bd83ac86d95937000fc838115 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 00:26:04 +0200 Subject: [PATCH 109/128] weird yarn.lock change. Wtf? --- yarn.lock | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index e81a341037e3c..e1e0c15cc95f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5303,6 +5303,11 @@ tiny-invariant "^1.3.3" valid-url "^1.0.9" +"@cubejs-backend/cubesql@1.1.12": + version "1.1.12" + resolved "https://registry.yarnpkg.com/@cubejs-backend/cubesql/-/cubesql-1.1.12.tgz#d3be0c09b41864424e2c41341c6d286b1343f1f7" + integrity sha512-JTuxZHdz+8+Jyj8mFCkXsNcaw3n4J3BLCNuijwF+7dw6AD3ZO+LOExtB65lyMrE05VGD5YeYSXuRg9RY9wXVXA== + "@cubejs-backend/dotenv@^9.0.2": version "9.0.2" resolved "https://registry.yarnpkg.com/@cubejs-backend/dotenv/-/dotenv-9.0.2.tgz#c3679091b702f0fd38de120c5a63943fcdc0dcbf" @@ -5319,6 +5324,15 @@ uuid "9.0.0" winston "3.8.2" +"@cubejs-backend/native@1.1.12": + version "1.1.12" + resolved "https://registry.yarnpkg.com/@cubejs-backend/native/-/native-1.1.12.tgz#150974208f7c7af2924ab7b1e834e00786e236b7" + integrity sha512-uKdUHjSEl4U2Maaq7Q/y14mDE0+pLvGrL43KbsTdS84ZaTt3nabOmoWfaZ8kUdJCu9ZvdTwbEKrdm1UcOC5WAQ== + dependencies: + "@cubejs-backend/cubesql" "1.1.12" + "@cubejs-backend/shared" "1.1.12" + "@cubejs-infra/post-installer" "^0.0.7" + "@cubejs-backend/shared@0.33.20": version "0.33.20" resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-0.33.20.tgz#3d9fa60041599cca9fe4c04df05daa4b8ab8675f" @@ -10123,7 +10137,7 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@12.12.50", "@types/node@^12", "@types/node@^16", "@types/node@^18": +"@types/node@*", "@types/node@12.12.50", "@types/node@^12", "@types/node@^18": version "18.19.46" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.46.tgz#51801396c01153e0626e36f43386e83bc768b072" integrity sha512-vnRgMS7W6cKa1/0G3/DTtQYpVrZ8c0Xm6UkLaVFrb9jtcVC3okokW09Ki1Qdrj9ISokszD69nY4WDLRlvHlhAA== From 4f595d5a72905989eaeb56615d34bbcefe86446e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Thu, 9 Jan 2025 21:18:27 +0200 Subject: [PATCH 110/128] =?UTF-8?q?full=20transition=20of=C2=A0result=20na?= =?UTF-8?q?tive-js-native?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/Cargo.lock | 1 + packages/cubejs-backend-native/Cargo.toml | 2 +- .../cubejs-backend-native/js/ResultWrapper.ts | 6 +- packages/cubejs-backend-native/js/index.ts | 4 +- packages/cubejs-backend-native/src/channel.rs | 10 +- .../cubejs-backend-native/src/orchestrator.rs | 81 ++++++--- .../cubejs-backend-native/src/transport.rs | 135 +++++++++++---- rust/cubenativeutils/Cargo.lock | 111 +++++++++---- .../src/query_result_transform.rs | 2 +- rust/cubesql/Cargo.lock | 157 +++++++++++++++--- rust/cubesql/cubeclient/Cargo.toml | 1 + .../cubeclient/src/models/v1_load_result.rs | 54 ++++++ rust/cubesqlplanner/Cargo.lock | 115 +++++++++---- 13 files changed, 523 insertions(+), 156 deletions(-) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index 65113ac0e7061..0a3b208a6d86b 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -718,6 +718,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "cubeorchestrator", "log", "reqwest", "reqwest-middleware", diff --git a/packages/cubejs-backend-native/Cargo.toml b/packages/cubejs-backend-native/Cargo.toml index 80e12da1f88ae..37ddb4094c1c1 100644 --- a/packages/cubejs-backend-native/Cargo.toml +++ b/packages/cubejs-backend-native/Cargo.toml @@ -19,12 +19,12 @@ crate-type = ["cdylib", "lib"] cubesqlplanner = { path = "../../rust/cubesqlplanner/cubesqlplanner" } cubeorchestrator = { path = "../../rust/cubeorchestrator" } cubenativeutils = { path = "../../rust/cubenativeutils" } +cubesql = { path = "../../rust/cubesql/cubesql" } anyhow = "1.0" async-channel = { version = "2" } async-trait = "0.1.36" convert_case = "0.6.0" pin-project = "1.1.5" -cubesql = { path = "../../rust/cubesql/cubesql" } findshlibs = "0.10.2" futures = "0.3.30" http-body-util = "0.1" diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index c0bf150a35e08..54bfdca4205a0 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -161,6 +161,7 @@ export class ResultMultiWrapper extends BaseWrapper implements DataResult { } } +// This is consumed by native side via Transport Bridge export class ResultArrayWrapper extends BaseWrapper implements DataResult { public constructor(private readonly results: ResultWrapper[]) { super(); @@ -177,6 +178,9 @@ export class ResultArrayWrapper extends BaseWrapper implements DataResult { [[], [], []] ); - return getFinalQueryResultArray(transformDataJson, rawData, resultDataJson); + // It seems this is not needed anymore + // return getFinalQueryResultArray(transformDataJson, rawData, resultDataJson); + + return [transformDataJson, rawData, resultDataJson]; } } diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index 252571aefddf7..c528823156a2c 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -267,9 +267,7 @@ function wrapNativeFunctionWithStream( } else if (response.error) { writerOrChannel.reject(errorString(response)); } else if (response.isWrapper) { // Native wrapped result - const resArBuf = await response.getFinalResult(); - const resStr = new TextDecoder().decode(resArBuf); - writerOrChannel.resolve(resStr); + writerOrChannel.resolve(await response.getFinalResult()); } else { writerOrChannel.resolve(JSON.stringify(response)); } diff --git a/packages/cubejs-backend-native/src/channel.rs b/packages/cubejs-backend-native/src/channel.rs index 9394d8e9b27e3..0a073bc894323 100644 --- a/packages/cubejs-backend-native/src/channel.rs +++ b/packages/cubejs-backend-native/src/channel.rs @@ -5,7 +5,9 @@ use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::Arc; use crate::transport::MapCubeErrExt; +use crate::utils::bind_method; use async_trait::async_trait; +use cubeorchestrator::query_result_transform::RequestResultArray; use cubesql::transport::{SqlGenerator, SqlTemplates}; use cubesql::CubeError; #[cfg(debug_assertions)] @@ -13,8 +15,6 @@ use log::trace; use neon::prelude::*; use tokio::sync::oneshot; -use crate::utils::bind_method; - type JsAsyncStringChannelCallback = Box) -> Result<(), CubeError> + Send>; type JsAsyncChannelCallback = Box< @@ -194,6 +194,12 @@ where rx.await? } +#[derive(Debug)] +pub enum ValueFromJs { + String(String), + RequestResultArray(RequestResultArray), +} + #[allow(clippy::type_complexity)] pub async fn call_raw_js_with_channel_as_callback( channel: Arc, diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index 2395a93ff4955..46527a1de2d45 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -144,51 +144,78 @@ pub fn final_query_result(mut cx: FunctionContext) -> JsResult { Ok(promise) } -pub fn final_query_result_array(mut cx: FunctionContext) -> JsResult { - let transform_data_array = cx.argument::(0)?; - let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); +pub type JsResultDataVectors = ( + Vec, + Vec>, + Vec, +); + +pub fn convert_final_query_result_array_from_js( + cx: &mut FunctionContext<'_>, + transform_data_array: Handle, + data_array: Handle, + results_data_array: Handle, +) -> NeonResult { + let deserializer = JsValueDeserializer::new(cx, transform_data_array); let transform_requests: Vec = match Deserialize::deserialize(deserializer) { Ok(data) => data, Err(err) => return cx.throw_error(err.to_string()), }; - let data_array = cx.argument::(1)?; let mut cube_store_results: Vec> = vec![]; - for data_arg in data_array.to_vec(&mut cx)? { - match extract_query_result(&mut cx, data_arg) { + for data_arg in data_array.to_vec(cx)? { + match extract_query_result(cx, data_arg) { Ok(query_result) => cube_store_results.push(query_result), Err(err) => return cx.throw_error(err.to_string()), }; } - let results_data_array = cx.argument::(2)?; - let deserializer = JsValueDeserializer::new(&mut cx, results_data_array); - let mut request_results: Vec = match Deserialize::deserialize(deserializer) { + let deserializer = JsValueDeserializer::new(cx, results_data_array); + let request_results: Vec = match Deserialize::deserialize(deserializer) { Ok(data) => data, Err(err) => return cx.throw_error(err.to_string()), }; - let promise = cx - .task(move || { - get_final_cubestore_result_array( - &transform_requests, - &cube_store_results, - &mut request_results, - )?; - - let final_obj = RequestResultArray { - results: request_results, - }; + Ok((transform_requests, cube_store_results, request_results)) +} - match serde_json::to_string(&final_obj) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); +pub fn final_query_result_array(mut cx: FunctionContext) -> JsResult { + let transform_data_array = cx.argument::(0)?; + let data_array = cx.argument::(1)?; + let results_data_array = cx.argument::(2)?; - Ok(promise) + let convert_res = convert_final_query_result_array_from_js( + &mut cx, + transform_data_array, + data_array, + results_data_array, + ); + match convert_res { + Ok((transform_requests, cube_store_results, mut request_results)) => { + let promise = cx + .task(move || { + get_final_cubestore_result_array( + &transform_requests, + &cube_store_results, + &mut request_results, + )?; + + let final_obj = RequestResultArray { + results: request_results, + }; + + match serde_json::to_string(&final_obj) { + Ok(json) => Ok(json), + Err(err) => Err(anyhow::Error::from(err)), + } + }) + .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); + + Ok(promise) + } + Err(err) => cx.throw_error(err.to_string()), + } } pub fn final_query_result_multi(mut cx: FunctionContext) -> JsResult { diff --git a/packages/cubejs-backend-native/src/transport.rs b/packages/cubejs-backend-native/src/transport.rs index 30c5fbc1b84e5..2d1cebc7f46b3 100644 --- a/packages/cubejs-backend-native/src/transport.rs +++ b/packages/cubejs-backend-native/src/transport.rs @@ -3,7 +3,18 @@ use neon::prelude::*; use std::collections::HashMap; use std::fmt::Display; +use crate::auth::NativeAuthContext; +use crate::channel::{call_raw_js_with_channel_as_callback, NodeSqlGenerator, ValueFromJs}; +use crate::node_obj_serializer::NodeObjSerializer; +use crate::orchestrator::convert_final_query_result_array_from_js; +use crate::{ + auth::TransportRequest, channel::call_js_with_channel_as_callback, + stream::call_js_with_stream_as_callback, +}; use async_trait::async_trait; +use cubeorchestrator::query_result_transform::{ + get_final_cubestore_result_array, RequestResultArray, +}; use cubesql::compile::engine::df::scan::{MemberField, SchemaRef}; use cubesql::compile::engine::df::wrapper::SqlQuery; use cubesql::transport::{ @@ -20,14 +31,6 @@ use serde::Serialize; use std::sync::Arc; use uuid::Uuid; -use crate::auth::NativeAuthContext; -use crate::channel::{call_raw_js_with_channel_as_callback, NodeSqlGenerator}; -use crate::node_obj_serializer::NodeObjSerializer; -use crate::{ - auth::TransportRequest, channel::call_js_with_channel_as_callback, - stream::call_js_with_stream_as_callback, -}; - #[derive(Debug)] pub struct NodeBridgeTransport { channel: Arc, @@ -369,54 +372,116 @@ impl TransportService for NodeBridgeTransport { streaming: false, })?; - let result = call_js_with_channel_as_callback( + let result = call_raw_js_with_channel_as_callback( self.channel.clone(), self.on_sql_api_load.clone(), - Some(extra), + extra, + Box::new(|cx, v| Ok(cx.string(v).as_value(cx))), + Box::new(move |cx, v| { + // It's too heavy/slow to get instance of ResultArrayWrapper from JS + // and then call/await the .getFinalResult() method which needs be + // executed again on JS side to get the actual needed date, + // instead we pass it directly from JS side. + // In case of wrapped result it's actually a tuple of + // (transformDataJson[], rawData[], resultDataJson[]) + if let Ok(result_wrapped) = v.downcast::(cx) { + let res_wrapped_vec = result_wrapped.to_vec(cx).map_cube_err("Can't convert JS result to array")?; + + if res_wrapped_vec.len() != 3 { + return Err(CubeError::internal("Expected a tuple with 3 elements: transformDataJson[], rawData[], resultDataJson[]".to_string())); + } + + let transform_data_array = res_wrapped_vec.first().unwrap(); + let data_array = res_wrapped_vec.get(1).unwrap() + .downcast_or_throw::(cx).map_cube_err("Can't downcast js data to array")?; + let results_data_array = res_wrapped_vec.get(2).unwrap(); + + match convert_final_query_result_array_from_js( + cx, + *transform_data_array, + data_array, + *results_data_array, + ) { + Ok((transform_requests, cube_store_results, mut request_results)) => { + get_final_cubestore_result_array( + &transform_requests, + &cube_store_results, + &mut request_results, + ).map_cube_err("Can't build result array")?; + + Ok(ValueFromJs::RequestResultArray(RequestResultArray { + results: request_results, + })) + } + Err(err) => { + Err(CubeError::internal(format!("Error converting result data: {:?}", err.to_string()))) + } + } + + } else if let Ok(str) = v.downcast::(cx) { + Ok(ValueFromJs::String(str.value(cx))) + } else { + Err(CubeError::internal("Can't downcast callback argument to string or resultWrapper object".to_string())) + } + }) ) .await; + if let Err(e) = &result { if e.message.to_lowercase().contains("continue wait") { continue; } } - let response: serde_json::Value = result?; + match result? { + ValueFromJs::String(result) => { + let response: serde_json::Value = serde_json::Value::String(result); - #[cfg(debug_assertions)] - trace!("[transport] Request <- {:?}", response); - #[cfg(not(debug_assertions))] - trace!("[transport] Request <- "); + #[cfg(debug_assertions)] + trace!("[transport] Request <- {:?}", response); + #[cfg(not(debug_assertions))] + trace!("[transport] Request <- "); - if let Some(error_value) = response.get("error") { - match error_value { - serde_json::Value::String(error) => { - if error.to_lowercase() == *"continue wait" { - debug!( + if let Some(error_value) = response.get("error") { + match error_value { + serde_json::Value::String(error) => { + if error.to_lowercase() == *"continue wait" { + debug!( "[transport] load - retrying request (continue wait) requestId: {}", request_id ); - continue; - } else { - return Err(CubeError::user(error.clone())); - } - } - other => { - error!( + continue; + } else { + return Err(CubeError::user(error.clone())); + } + } + other => { + error!( "[transport] load - strange response, success which contains error: {:?}", other ); - return Err(CubeError::internal( - "Error response with broken data inside".to_string(), - )); - } - } - }; + return Err(CubeError::internal( + "Error response with broken data inside".to_string(), + )); + } + } + }; - break serde_json::from_value::(response) - .map_err(|err| CubeError::user(err.to_string())); + break serde_json::from_value::(response) + .map_err(|err| CubeError::user(err.to_string())); + } + ValueFromJs::RequestResultArray(result) => { + let response = TransportLoadResponse { + pivot_query: None, + slow_query: None, + query_type: None, + results: result.results.into_iter().map(|v| v.into()).collect(), + }; + break Ok(response); + } + } } } diff --git a/rust/cubenativeutils/Cargo.lock b/rust/cubenativeutils/Cargo.lock index 0959a0f2888e6..3375af83939d8 100644 --- a/rust/cubenativeutils/Cargo.lock +++ b/rust/cubenativeutils/Cargo.lock @@ -118,7 +118,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers", + "flatbuffers 2.1.2", "half", "hex", "indexmap 1.9.3", @@ -165,7 +165,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -176,7 +176,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -326,7 +326,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", "syn_derive", ] @@ -440,6 +440,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.6", ] @@ -643,6 +644,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "cubeorchestrator", "log", "reqwest", "reqwest-middleware", @@ -673,6 +675,26 @@ dependencies = [ "uuid 0.8.2", ] +[[package]] +name = "cubeorchestrator" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "cubeshared", + "itertools 0.13.0", + "neon", + "serde", + "serde_json", +] + +[[package]] +name = "cubeshared" +version = "0.1.0" +dependencies = [ + "flatbuffers 23.5.26", +] + [[package]] name = "cubesql" version = "0.28.0" @@ -699,7 +721,7 @@ dependencies = [ "futures-util", "hashbrown 0.14.5", "indexmap 1.9.3", - "itertools", + "itertools 0.10.5", "log", "lru", "minijinja", @@ -740,7 +762,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.3", - "itertools", + "itertools 0.10.5", "lazy_static", "log", "num_cpus", @@ -937,6 +959,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "flatbuffers" +version = "23.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" +dependencies = [ + "bitflags 1.3.2", + "rustc_version", +] + [[package]] name = "flate2" version = "1.0.30" @@ -1048,7 +1080,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -1420,6 +1452,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1726,7 +1767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" dependencies = [ "quote", - "syn 2.0.68", + "syn 2.0.95", "syn-mid", ] @@ -1963,7 +2004,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -2046,7 +2087,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -2165,9 +2206,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2467,6 +2508,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.34" @@ -2580,32 +2630,33 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "indexmap 2.2.6", "itoa", + "memchr", "ryu", "serde", ] @@ -2770,7 +2821,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -2809,9 +2860,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" dependencies = [ "proc-macro2", "quote", @@ -2826,7 +2877,7 @@ checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -2838,7 +2889,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -2904,7 +2955,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -2972,7 +3023,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -3074,7 +3125,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] @@ -3308,7 +3359,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", "wasm-bindgen-shared", ] @@ -3342,7 +3393,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3596,7 +3647,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.68", + "syn 2.0.95", ] [[package]] diff --git a/rust/cubeorchestrator/src/query_result_transform.rs b/rust/cubeorchestrator/src/query_result_transform.rs index e6dd5cfc74487..22e18a889327b 100644 --- a/rust/cubeorchestrator/src/query_result_transform.rs +++ b/rust/cubeorchestrator/src/query_result_transform.rs @@ -572,7 +572,7 @@ pub struct RequestResultData { #[serde(skip_serializing_if = "Option::is_none")] pub last_refresh_time: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub refresh_key_values: Option, + pub refresh_key_values: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub used_pre_aggregations: Option, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/rust/cubesql/Cargo.lock b/rust/cubesql/Cargo.lock index 1cb06b84594cd..793a6b6345c92 100644 --- a/rust/cubesql/Cargo.lock +++ b/rust/cubesql/Cargo.lock @@ -133,7 +133,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers", + "flatbuffers 2.1.2", "half", "hex", "indexmap 1.9.3", @@ -188,7 +188,7 @@ checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -412,6 +412,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.48.1", ] @@ -585,7 +586,7 @@ dependencies = [ "ciborium", "clap", "criterion-plot", - "itertools", + "itertools 0.10.3", "lazy_static", "num-traits", "oorandom", @@ -606,7 +607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", + "itertools 0.10.3", ] [[package]] @@ -735,6 +736,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "cubeorchestrator", "log", "reqwest", "reqwest-middleware", @@ -747,6 +749,26 @@ dependencies = [ "wiremock", ] +[[package]] +name = "cubeorchestrator" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "cubeshared", + "itertools 0.13.0", + "neon", + "serde", + "serde_json", +] + +[[package]] +name = "cubeshared" +version = "0.1.0" +dependencies = [ + "flatbuffers 23.5.26", +] + [[package]] name = "cubesql" version = "0.28.0" @@ -775,7 +797,7 @@ dependencies = [ "hashbrown 0.14.3", "indexmap 1.9.3", "insta", - "itertools", + "itertools 0.10.3", "log", "lru", "minijinja", @@ -829,7 +851,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -846,7 +868,7 @@ checksum = "a26acccf6f445af85ea056362561a24ef56cdc15fcc685f03aec50b9c702cb6d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -864,7 +886,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.1", - "itertools", + "itertools 0.10.3", "lazy_static", "log", "num_cpus", @@ -1063,6 +1085,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "flatbuffers" +version = "23.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" +dependencies = [ + "bitflags 1.3.2", + "rustc_version", +] + [[package]] name = "flate2" version = "1.0.22" @@ -1161,7 +1193,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -1560,6 +1592,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -1666,6 +1707,16 @@ version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if 1.0.0", + "windows-targets 0.52.6", +] + [[package]] name = "libm" version = "0.2.8" @@ -1858,6 +1909,32 @@ dependencies = [ "syn 1.0.90", ] +[[package]] +name = "neon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d75440242411c87dc39847b0e33e961ec1f10326a9d8ecf9c1ea64a3b3c13dc" +dependencies = [ + "libloading", + "neon-macros", + "once_cell", + "semver", + "send_wrapper", + "smallvec", + "tokio", +] + +[[package]] +name = "neon-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" +dependencies = [ + "quote", + "syn 2.0.87", + "syn-mid", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -2221,7 +2298,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -2624,6 +2701,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustls" version = "0.23.11" @@ -2710,31 +2796,43 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" +[[package]] +name = "semver" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" -version = "1.0.209" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "indexmap 2.4.0", "itoa 1.0.10", @@ -2932,7 +3030,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -2971,15 +3069,26 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.76" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn-mid" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "sync_wrapper" version = "1.0.1" @@ -3064,7 +3173,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -3151,7 +3260,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -3260,7 +3369,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] @@ -3842,7 +3951,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.76", + "syn 2.0.87", ] [[package]] diff --git a/rust/cubesql/cubeclient/Cargo.toml b/rust/cubesql/cubeclient/Cargo.toml index 1e7797cd9bf98..6f57b1a5050e6 100644 --- a/rust/cubesql/cubeclient/Cargo.toml +++ b/rust/cubesql/cubeclient/Cargo.toml @@ -19,6 +19,7 @@ async-trait = "0.1.51" tokio = { version = "1.6", features = ["time"] } uuid = { version = "1", features = ["v4"] } log = "0.4" +cubeorchestrator = { path = "../../cubeorchestrator" } [dependencies.reqwest] version = "0.12.5" diff --git a/rust/cubesql/cubeclient/src/models/v1_load_result.rs b/rust/cubesql/cubeclient/src/models/v1_load_result.rs index be2a78fbee94b..2731518d9eaef 100644 --- a/rust/cubesql/cubeclient/src/models/v1_load_result.rs +++ b/rust/cubesql/cubeclient/src/models/v1_load_result.rs @@ -7,6 +7,7 @@ * * Generated by: https://openapi-generator.tech */ +use cubeorchestrator::query_result_transform::{RequestResultData, TransformedData}; #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct V1LoadResult { @@ -33,3 +34,56 @@ impl V1LoadResult { } } } + +impl From for V1LoadResult { + fn from(rrd: RequestResultData) -> Self { + let data = match rrd.data { + None => { + vec![] + } + Some(d) => { + match d { + TransformedData::Compact { + members: _members, + dataset: _dataset, + } => { + // TODO V1LoadResult expects only Vanilla results? + vec![] + } + TransformedData::Vanilla(v) => v + .iter() + .map(|item| serde_json::to_value(item).unwrap_or(serde_json::Value::Null)) + .collect(), + } + } + }; + let annotation = crate::models::V1LoadResultAnnotation { + measures: rrd + .annotation + .get("measures") + .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) + .unwrap_or(serde_json::Value::Null), + dimensions: rrd + .annotation + .get("dimensions") + .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) + .unwrap_or(serde_json::Value::Null), + segments: rrd + .annotation + .get("segments") + .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) + .unwrap_or(serde_json::Value::Null), + time_dimensions: rrd + .annotation + .get("timeDimensions") + .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) + .unwrap_or(serde_json::Value::Null), + }; + V1LoadResult { + data_source: rrd.data_source, + annotation: Box::new(annotation), + data, + refresh_key_values: rrd.refresh_key_values, + } + } +} diff --git a/rust/cubesqlplanner/Cargo.lock b/rust/cubesqlplanner/Cargo.lock index 55b1401878539..1712cc95c7815 100644 --- a/rust/cubesqlplanner/Cargo.lock +++ b/rust/cubesqlplanner/Cargo.lock @@ -128,7 +128,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers", + "flatbuffers 2.1.2", "half", "hex", "indexmap 1.9.3", @@ -175,7 +175,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -186,7 +186,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -336,7 +336,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", "syn_derive", ] @@ -450,6 +450,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.6", ] @@ -675,6 +676,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", + "cubeorchestrator", "log", "reqwest", "reqwest-middleware", @@ -705,6 +707,26 @@ dependencies = [ "uuid 0.8.2", ] +[[package]] +name = "cubeorchestrator" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "cubeshared", + "itertools 0.13.0", + "neon", + "serde", + "serde_json", +] + +[[package]] +name = "cubeshared" +version = "0.1.0" +dependencies = [ + "flatbuffers 23.5.26", +] + [[package]] name = "cubesql" version = "0.28.0" @@ -731,7 +753,7 @@ dependencies = [ "futures-util", "hashbrown 0.14.5", "indexmap 1.9.3", - "itertools", + "itertools 0.10.5", "log", "lru", "minijinja", @@ -768,7 +790,7 @@ dependencies = [ "cubeclient", "cubenativeutils", "datafusion", - "itertools", + "itertools 0.10.5", "lazy_static", "minijinja", "nativebridge", @@ -794,7 +816,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.3", - "itertools", + "itertools 0.10.5", "lazy_static", "log", "num_cpus", @@ -991,6 +1013,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "flatbuffers" +version = "23.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" +dependencies = [ + "bitflags 1.3.2", + "rustc_version", +] + [[package]] name = "flate2" version = "1.0.30" @@ -1102,7 +1134,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -1474,6 +1506,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1765,7 +1806,7 @@ dependencies = [ "Inflector", "async-trait", "byteorder", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -1793,7 +1834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" dependencies = [ "quote", - "syn 2.0.69", + "syn 2.0.95", "syn-mid", ] @@ -2030,7 +2071,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -2113,7 +2154,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -2232,9 +2273,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2534,6 +2575,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.34" @@ -2647,32 +2697,33 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "indexmap 2.2.6", "itoa", + "memchr", "ryu", "serde", ] @@ -2837,7 +2888,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -2876,9 +2927,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.69" +version = "2.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201fcda3845c23e8212cd466bfebf0bd20694490fc0356ae8e428e0824a915a6" +checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" dependencies = [ "proc-macro2", "quote", @@ -2893,7 +2944,7 @@ checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -2905,7 +2956,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -2971,7 +3022,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -3039,7 +3090,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -3141,7 +3192,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] @@ -3375,7 +3426,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", "wasm-bindgen-shared", ] @@ -3409,7 +3460,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3663,7 +3714,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.69", + "syn 2.0.95", ] [[package]] From ef3e833769d232a0960f734f6f03ba27a91eb1f3 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 11:52:05 +0200 Subject: [PATCH 111/128] fix @cubejs-backend/native version ref --- packages/cubejs-cubestore-driver/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-cubestore-driver/package.json b/packages/cubejs-cubestore-driver/package.json index 8722abaca23c8..b4c12f857b4e3 100644 --- a/packages/cubejs-cubestore-driver/package.json +++ b/packages/cubejs-cubestore-driver/package.json @@ -29,7 +29,7 @@ "@cubejs-backend/base-driver": "1.1.12", "@cubejs-backend/cubestore": "1.1.12", "@cubejs-backend/shared": "1.1.12", - "@cubejs-backend/native": "1.1.12", + "@cubejs-backend/native": "1.1.14", "csv-write-stream": "^2.0.0", "flatbuffers": "23.3.3", "fs-extra": "^9.1.0", From 5d2b95c61f7f093423a1522bb7856d4e42c374ea Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 11:52:49 +0200 Subject: [PATCH 112/128] refactor ResultWrapper constructor --- packages/cubejs-api-gateway/src/gateway.ts | 4 +--- .../cubejs-backend-native/js/ResultWrapper.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index eb921325e2a24..e845c72a466d8 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1601,9 +1601,7 @@ class ApiGateway { * @private */ private wrapAdapterQueryResultIfNeeded(res: any): ResultWrapper { - if (!(res.data instanceof ResultWrapper)) { - res.data = new ResultWrapper(null, res.data); - } + res.data = new ResultWrapper(res.data); return res; } diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 54bfdca4205a0..59aa186815b25 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -24,15 +24,26 @@ export class ResultWrapper extends BaseWrapper implements DataResult { private readonly isNative: Boolean = false; + private readonly nativeReference: any; + + private readonly jsResult: any = null; + private transformData: any; private rootResultObject: any = {}; - public constructor(private readonly nativeReference: any, private readonly jsResult: any = null) { + public constructor(input: any) { super(); - if (nativeReference) { + if (input.isWrapper) { + return input; + } + + if (Array.isArray(input)) { + this.jsResult = input; + } else { this.isNative = true; + this.nativeReference = input; } this.proxy = new Proxy(this, { From 52687b328229fc96617470cafd42586a5929edf1 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 13:05:42 +0200 Subject: [PATCH 113/128] =?UTF-8?q?fix=20string=20deserialize=20in=C2=A0tr?= =?UTF-8?q?ansport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/src/transport.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/src/transport.rs b/packages/cubejs-backend-native/src/transport.rs index 2d1cebc7f46b3..cbfeef037806a 100644 --- a/packages/cubejs-backend-native/src/transport.rs +++ b/packages/cubejs-backend-native/src/transport.rs @@ -435,7 +435,10 @@ impl TransportService for NodeBridgeTransport { match result? { ValueFromJs::String(result) => { - let response: serde_json::Value = serde_json::Value::String(result); + let response: serde_json::Value = match serde_json::from_str(&result) { + Ok(json) => json, + Err(err) => return Err(CubeError::internal(err.to_string())), + }; #[cfg(debug_assertions)] trace!("[transport] Request <- {:?}", response); From 744c03e6d0c477d170f248a356d1bf67b49989db Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 13:46:22 +0200 Subject: [PATCH 114/128] extend DataResult interface --- packages/cubejs-api-gateway/src/gateway.ts | 4 +- .../cubejs-backend-native/js/ResultWrapper.ts | 55 ++++++++++++++----- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index e845c72a466d8..0c37d59561173 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1818,13 +1818,13 @@ class ApiGateway { queries: results.length, queriesWithPreAggregations: results.filter( - (r: any) => Object.keys(r.getRootResultObject().usedPreAggregations || {}).length + (r: any) => Object.keys(r.getRootResultObject()[0].usedPreAggregations || {}).length ).length, // Have to omit because data could be processed natively // so it is not known at this point // queriesWithData: // results.filter((r: any) => r.data?.length).length, - dbType: results.map(r => r.getRootResultObject().dbType), + dbType: results.map(r => r.getRootResultObject()[0].dbType), }, context, ); diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 59aa186815b25..1bf5ce30d3e4d 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -9,6 +9,9 @@ import { export interface DataResult { isWrapper: boolean; getFinalResult(): Promise; + getRawData(): any[]; + getTransformData(): any[]; + getRootResultObject(): any[]; } class BaseWrapper { @@ -117,32 +120,32 @@ export class ResultWrapper extends BaseWrapper implements DataResult { return (array as any)[method](...args); } - public getRawData() { + public getRawData(): any[] { if (this.isNative) { - return this.nativeReference; + return [this.nativeReference]; } - return this.jsResult; + return [this.jsResult]; } public setTransformData(td: any) { this.transformData = td; } - public getTransformData(): any { - return this.transformData; + public getTransformData(): any[] { + return [this.transformData]; } public setRootResultObject(obj: any) { this.rootResultObject = obj; } - public getRootResultObject(): any { - return this.rootResultObject; + public getRootResultObject(): any[] { + return [this.rootResultObject]; } public async getFinalResult(): Promise { - return getFinalQueryResult(this.transformData, this.getRawData(), this.rootResultObject); + return getFinalQueryResult(this.transformData, this.getRawData()[0], this.rootResultObject); } } @@ -154,9 +157,9 @@ export class ResultMultiWrapper extends BaseWrapper implements DataResult { public async getFinalResult(): Promise { const [transformDataJson, rawDataRef, cleanResultList] = this.results.reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(r.getTransformData()); - rawList.push(r.getRawData()); - resultList.push(r.getRootResultObject()); + transformList.push(r.getTransformData()[0]); + rawList.push(r.getRawData()[0]); + resultList.push(r.getRootResultObject()[0]); return [transformList, rawList, resultList]; }, [[], [], []] @@ -170,6 +173,18 @@ export class ResultMultiWrapper extends BaseWrapper implements DataResult { return getFinalQueryResultMulti(transformDataJson, rawDataRef, responseDataObj); } + + public getTransformData(): any[] { + return this.results.map(r => r.getTransformData()[0]); + } + + public getRawData(): any[] { + return this.results.map(r => r.getRawData()[0]); + } + + public getRootResultObject(): any[] { + return this.results.map(r => r.getRootResultObject()[0]); + } } // This is consumed by native side via Transport Bridge @@ -181,9 +196,9 @@ export class ResultArrayWrapper extends BaseWrapper implements DataResult { public async getFinalResult(): Promise { const [transformDataJson, rawData, resultDataJson] = this.results.reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { - transformList.push(r.getTransformData()); - rawList.push(r.getRawData()); - resultList.push(r.getRootResultObject()); + transformList.push(r.getTransformData()[0]); + rawList.push(r.getRawData()[0]); + resultList.push(r.getRootResultObject()[0]); return [transformList, rawList, resultList]; }, [[], [], []] @@ -194,4 +209,16 @@ export class ResultArrayWrapper extends BaseWrapper implements DataResult { return [transformDataJson, rawData, resultDataJson]; } + + public getTransformData(): any[] { + return this.results.map(r => r.getTransformData()[0]); + } + + public getRawData(): any[] { + return this.results.map(r => r.getRawData()[0]); + } + + public getRootResultObject(): any[] { + return this.results.map(r => r.getRootResultObject()[0]); + } } From f5e78e22b0cfa22cf2831aa6a70c24325f57347c Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 14:15:51 +0200 Subject: [PATCH 115/128] =?UTF-8?q?support=20iterative=20access=20in=C2=A0?= =?UTF-8?q?ResultWrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/js/ResultWrapper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 1bf5ce30d3e4d..eeb354a54e378 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -51,6 +51,18 @@ export class ResultWrapper extends BaseWrapper implements DataResult { this.proxy = new Proxy(this, { get: (target, prop: string | symbol) => { + // To support iterative access + if (prop === Symbol.iterator) { + const array = this.getArray(); + const l = array.length; + + return function* () { + for (let i = 0; i < l; i++) { + yield array[i]; + } + }; + } + // intercept indexes if (typeof prop === 'string' && !Number.isNaN(Number(prop))) { const array = this.getArray(); From ff1a03db757c821c5808610030ecc592855140f9 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 15:01:26 +0200 Subject: [PATCH 116/128] refactor ResultWrapper classes --- .../cubejs-backend-native/js/ResultWrapper.ts | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index eeb354a54e378..1e592ee688913 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -12,6 +12,8 @@ export interface DataResult { getRawData(): any[]; getTransformData(): any[]; getRootResultObject(): any[]; + // eslint-disable-next-line no-use-before-define + getResults(): ResultWrapper[]; } class BaseWrapper { @@ -159,15 +161,19 @@ export class ResultWrapper extends BaseWrapper implements DataResult { public async getFinalResult(): Promise { return getFinalQueryResult(this.transformData, this.getRawData()[0], this.rootResultObject); } + + public getResults(): ResultWrapper[] { + return [this]; + } } -export class ResultMultiWrapper extends BaseWrapper implements DataResult { - public constructor(private readonly results: ResultWrapper[], private rootResultObject: any) { +class BaseWrapperArray extends BaseWrapper { + public constructor(protected readonly results: ResultWrapper[]) { super(); } - public async getFinalResult(): Promise { - const [transformDataJson, rawDataRef, cleanResultList] = this.results.reduce<[Object[], any[], Object[]]>( + protected getInternalDataArrays(): any[] { + const [transformDataJson, rawData, resultDataJson] = this.results.reduce<[Object[], any[], Object[]]>( ([transformList, rawList, resultList], r) => { transformList.push(r.getTransformData()[0]); rawList.push(r.getRawData()[0]); @@ -177,13 +183,11 @@ export class ResultMultiWrapper extends BaseWrapper implements DataResult { [[], [], []] ); - const responseDataObj = { - queryType: this.rootResultObject.queryType, - results: cleanResultList, - slowQuery: this.rootResultObject.slowQuery, - }; + return [transformDataJson, rawData, resultDataJson]; + } - return getFinalQueryResultMulti(transformDataJson, rawDataRef, responseDataObj); + public getResults(): ResultWrapper[] { + return this.results; } public getTransformData(): any[] { @@ -199,38 +203,33 @@ export class ResultMultiWrapper extends BaseWrapper implements DataResult { } } -// This is consumed by native side via Transport Bridge -export class ResultArrayWrapper extends BaseWrapper implements DataResult { - public constructor(private readonly results: ResultWrapper[]) { - super(); +export class ResultMultiWrapper extends BaseWrapperArray implements DataResult { + public constructor(results: ResultWrapper[], private rootResultObject: any) { + super(results); } public async getFinalResult(): Promise { - const [transformDataJson, rawData, resultDataJson] = this.results.reduce<[Object[], any[], Object[]]>( - ([transformList, rawList, resultList], r) => { - transformList.push(r.getTransformData()[0]); - rawList.push(r.getRawData()[0]); - resultList.push(r.getRootResultObject()[0]); - return [transformList, rawList, resultList]; - }, - [[], [], []] - ); + const [transformDataJson, rawDataRef, cleanResultList] = this.getInternalDataArrays(); - // It seems this is not needed anymore - // return getFinalQueryResultArray(transformDataJson, rawData, resultDataJson); + const responseDataObj = { + queryType: this.rootResultObject.queryType, + results: cleanResultList, + slowQuery: this.rootResultObject.slowQuery, + }; - return [transformDataJson, rawData, resultDataJson]; + return getFinalQueryResultMulti(transformDataJson, rawDataRef, responseDataObj); } +} - public getTransformData(): any[] { - return this.results.map(r => r.getTransformData()[0]); +// This is consumed by native side via Transport Bridge +export class ResultArrayWrapper extends BaseWrapperArray implements DataResult { + public constructor(results: ResultWrapper[]) { + super(results); } - public getRawData(): any[] { - return this.results.map(r => r.getRawData()[0]); - } + public async getFinalResult(): Promise { + const [transformDataJson, rawDataRef, cleanResultList] = this.getInternalDataArrays(); - public getRootResultObject(): any[] { - return this.results.map(r => r.getRootResultObject()[0]); + return [transformDataJson, rawDataRef, cleanResultList]; } } From 8d29729f0251037166980a0071783a8400ee7e92 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 18:02:33 +0200 Subject: [PATCH 117/128] =?UTF-8?q?pass=20ResultWrapper=20to=C2=A0native?= =?UTF-8?q?=20and=C2=A0offload=20transformData=20from=20the=C2=A0eventloop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cubejs-backend-native/js/ResultWrapper.ts | 2 + packages/cubejs-backend-native/js/index.ts | 2 +- packages/cubejs-backend-native/src/channel.rs | 4 +- .../cubejs-backend-native/src/orchestrator.rs | 116 ++++++++++++++++-- .../cubejs-backend-native/src/transport.rs | 84 ++++++------- .../cubeclient/src/models/v1_load_result.rs | 61 +++------ 6 files changed, 170 insertions(+), 99 deletions(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 1e592ee688913..3b1fecfa9aef7 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -186,6 +186,8 @@ class BaseWrapperArray extends BaseWrapper { return [transformDataJson, rawData, resultDataJson]; } + // Is invoked from the native side to get + // an array of all raw wrapped results public getResults(): ResultWrapper[] { return this.results; } diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index c528823156a2c..a2aefda61f2ea 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -267,7 +267,7 @@ function wrapNativeFunctionWithStream( } else if (response.error) { writerOrChannel.reject(errorString(response)); } else if (response.isWrapper) { // Native wrapped result - writerOrChannel.resolve(await response.getFinalResult()); + writerOrChannel.resolve(response); } else { writerOrChannel.resolve(JSON.stringify(response)); } diff --git a/packages/cubejs-backend-native/src/channel.rs b/packages/cubejs-backend-native/src/channel.rs index 0a073bc894323..607631c68c661 100644 --- a/packages/cubejs-backend-native/src/channel.rs +++ b/packages/cubejs-backend-native/src/channel.rs @@ -4,10 +4,10 @@ use std::collections::HashMap; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::Arc; +use crate::orchestrator::ResultWrapper; use crate::transport::MapCubeErrExt; use crate::utils::bind_method; use async_trait::async_trait; -use cubeorchestrator::query_result_transform::RequestResultArray; use cubesql::transport::{SqlGenerator, SqlTemplates}; use cubesql::CubeError; #[cfg(debug_assertions)] @@ -197,7 +197,7 @@ where #[derive(Debug)] pub enum ValueFromJs { String(String), - RequestResultArray(RequestResultArray), + ResultWrapper(Vec), } #[allow(clippy::type_complexity)] diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index 46527a1de2d45..3b3742223ed76 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -1,14 +1,18 @@ use crate::node_obj_deserializer::JsValueDeserializer; +use crate::transport::MapCubeErrExt; use cubeorchestrator::query_message_parser::QueryResult; use cubeorchestrator::query_result_transform::{ - get_final_cubestore_result_array, RequestResultArray, RequestResultData, RequestResultDataMulti, + get_final_cubestore_result_array, RequestResultArray, RequestResultData, + RequestResultDataMulti, TransformedData, }; use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; +use cubesql::CubeError; use neon::context::{Context, FunctionContext, ModuleContext}; use neon::handle::Handle; use neon::object::Object; use neon::prelude::{ - JsArray, JsArrayBuffer, JsBox, JsBuffer, JsObject, JsPromise, JsResult, JsValue, NeonResult, + JsArray, JsArrayBuffer, JsBox, JsBuffer, JsFunction, JsObject, JsPromise, JsResult, JsValue, + NeonResult, }; use neon::types::buffer::TypedArray; use serde::Deserialize; @@ -27,6 +31,108 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { Ok(()) } +// #[derive(Debug, Clone)] +// pub enum ResultWrapperData { +// JsObj(RecordBatch), +// Native() +// } + +#[derive(Debug, Clone)] +pub struct ResultWrapper { + transform_data: TransformDataRequest, + data: Arc, +} + +impl ResultWrapper { + pub fn from_js_result_wrapper( + cx: &mut FunctionContext<'_>, + js_result_wrapper_val: Handle, + ) -> Result { + let js_result_wrapper = js_result_wrapper_val + .downcast::(cx) + .map_cube_err("Can't downcast JS ResultWrapper to object")?; + + let get_transform_data_js_method: Handle = js_result_wrapper + .get(cx, "getTransformData") + .map_cube_err("Can't get getTransformData() method from JS ResultWrapper object")?; + + let transform_data_js_arr = get_transform_data_js_method + .call(cx, js_result_wrapper.upcast::(), []) + .map_cube_err("Error calling getTransformData() method of ResultWrapper object")? + .downcast::(cx) + .map_cube_err("Can't downcast JS transformData to array")? + .to_vec(cx) + .map_cube_err("Can't convert JS transformData to array")?; + + let transform_data_js = transform_data_js_arr.first().unwrap(); + + let deserializer = JsValueDeserializer::new(cx, *transform_data_js); + let transform_request: TransformDataRequest = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(_) => { + return Err(CubeError::internal( + "Can't deserialize transformData from JS ResultWrapper object".to_string(), + )) + } + }; + + let get_raw_data_js_method: Handle = js_result_wrapper + .get(cx, "getRawData") + .map_cube_err("Can't get getRawData() method from JS ResultWrapper object")?; + + let raw_data_js_arr = get_raw_data_js_method + .call(cx, js_result_wrapper.upcast::(), []) + .map_cube_err("Error calling getRawData() method of ResultWrapper object")? + .downcast::(cx) + .map_cube_err("Can't downcast JS rawData to array")? + .to_vec(cx) + .map_cube_err("Can't convert JS rawData to array")?; + + let raw_data_js = raw_data_js_arr.first().unwrap(); + + let query_result = + if let Ok(js_box) = raw_data_js.downcast::>, _>(cx) { + Arc::clone(&js_box) + } else if let Ok(js_array) = raw_data_js.downcast::(cx) { + let deserializer = JsValueDeserializer::new(cx, js_array.upcast()); + let js_raw_data: JsRawData = match Deserialize::deserialize(deserializer) { + Ok(data) => data, + Err(_) => { + return Err(CubeError::internal( + "Can't deserialize results raw data from JS ResultWrapper object".to_string(), + )); + } + }; + + QueryResult::from_js_raw_data(js_raw_data) + .map(Arc::new) + .map_cube_err("Can't build results data from JS rawData")? + } else { + return Err(CubeError::internal( + "Can't deserialize results raw data from JS ResultWrapper object".to_string(), + )); + }; + + Ok(Self { + transform_data: transform_request, + data: query_result, + }) + } + + pub fn transform_result(&self) -> Result { + let transformed = TransformedData::transform(&self.transform_data, &self.data) + .map_cube_err("Can't prepare transformed data")?; + + Ok(transformed) + } +} + +pub type JsResultDataVectors = ( + Vec, + Vec>, + Vec, +); + fn json_to_array_buffer<'a, C>( mut cx: C, json_data: Result, @@ -144,12 +250,6 @@ pub fn final_query_result(mut cx: FunctionContext) -> JsResult { Ok(promise) } -pub type JsResultDataVectors = ( - Vec, - Vec>, - Vec, -); - pub fn convert_final_query_result_array_from_js( cx: &mut FunctionContext<'_>, transform_data_array: Handle, diff --git a/packages/cubejs-backend-native/src/transport.rs b/packages/cubejs-backend-native/src/transport.rs index cbfeef037806a..c14612e9bf438 100644 --- a/packages/cubejs-backend-native/src/transport.rs +++ b/packages/cubejs-backend-native/src/transport.rs @@ -6,15 +6,12 @@ use std::fmt::Display; use crate::auth::NativeAuthContext; use crate::channel::{call_raw_js_with_channel_as_callback, NodeSqlGenerator, ValueFromJs}; use crate::node_obj_serializer::NodeObjSerializer; -use crate::orchestrator::convert_final_query_result_array_from_js; +use crate::orchestrator::ResultWrapper; use crate::{ auth::TransportRequest, channel::call_js_with_channel_as_callback, stream::call_js_with_stream_as_callback, }; use async_trait::async_trait; -use cubeorchestrator::query_result_transform::{ - get_final_cubestore_result_array, RequestResultArray, -}; use cubesql::compile::engine::df::scan::{MemberField, SchemaRef}; use cubesql::compile::engine::df::wrapper::SqlQuery; use cubesql::transport::{ @@ -337,6 +334,7 @@ impl TransportService for NodeBridgeTransport { sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, + // ) -> Result, CubeError> { ) -> Result { trace!("[transport] Request ->"); @@ -378,52 +376,43 @@ impl TransportService for NodeBridgeTransport { extra, Box::new(|cx, v| Ok(cx.string(v).as_value(cx))), Box::new(move |cx, v| { - // It's too heavy/slow to get instance of ResultArrayWrapper from JS - // and then call/await the .getFinalResult() method which needs be - // executed again on JS side to get the actual needed date, - // instead we pass it directly from JS side. - // In case of wrapped result it's actually a tuple of - // (transformDataJson[], rawData[], resultDataJson[]) - if let Ok(result_wrapped) = v.downcast::(cx) { - let res_wrapped_vec = result_wrapped.to_vec(cx).map_cube_err("Can't convert JS result to array")?; - - if res_wrapped_vec.len() != 3 { - return Err(CubeError::internal("Expected a tuple with 3 elements: transformDataJson[], rawData[], resultDataJson[]".to_string())); - } + if let Ok(js_result_wrapped) = v.downcast::(cx) { + let get_results_js_method: Handle = js_result_wrapped + .get(cx, "getResults") + .map_cube_err( + "Can't get getResults() method from JS ResultWrapper object", + )?; - let transform_data_array = res_wrapped_vec.first().unwrap(); - let data_array = res_wrapped_vec.get(1).unwrap() - .downcast_or_throw::(cx).map_cube_err("Can't downcast js data to array")?; - let results_data_array = res_wrapped_vec.get(2).unwrap(); - - match convert_final_query_result_array_from_js( - cx, - *transform_data_array, - data_array, - *results_data_array, - ) { - Ok((transform_requests, cube_store_results, mut request_results)) => { - get_final_cubestore_result_array( - &transform_requests, - &cube_store_results, - &mut request_results, - ).map_cube_err("Can't build result array")?; - - Ok(ValueFromJs::RequestResultArray(RequestResultArray { - results: request_results, - })) - } - Err(err) => { - Err(CubeError::internal(format!("Error converting result data: {:?}", err.to_string()))) - } - } + let results = get_results_js_method + .call(cx, js_result_wrapped.upcast::(), []) + .map_cube_err( + "Error calling getResults() method of ResultWrapper object", + )?; + let js_res_wrapped_vec = results + .downcast::(cx) + .map_cube_err("Can't downcast JS result to array")? + .to_vec(cx) + .map_cube_err("Can't convert JS result to array")?; + + let native_wrapped_results = js_res_wrapped_vec + .iter() + .map(|r| ResultWrapper::from_js_result_wrapper(cx, *r)) + .collect::, _>>() + .map_cube_err( + "Can't construct result wrapper from JS ResultWrapper object", + )?; + + Ok(ValueFromJs::ResultWrapper(native_wrapped_results)) } else if let Ok(str) = v.downcast::(cx) { Ok(ValueFromJs::String(str.value(cx))) } else { - Err(CubeError::internal("Can't downcast callback argument to string or resultWrapper object".to_string())) + Err(CubeError::internal( + "Can't downcast callback argument to string or resultWrapper object" + .to_string(), + )) } - }) + }), ) .await; @@ -475,12 +464,15 @@ impl TransportService for NodeBridgeTransport { break serde_json::from_value::(response) .map_err(|err| CubeError::user(err.to_string())); } - ValueFromJs::RequestResultArray(result) => { + ValueFromJs::ResultWrapper(result_wrappers) => { let response = TransportLoadResponse { pivot_query: None, slow_query: None, query_type: None, - results: result.results.into_iter().map(|v| v.into()).collect(), + results: result_wrappers + .into_iter() + .map(|v| v.transform_result().unwrap().into()) + .collect(), }; break Ok(response); } diff --git a/rust/cubesql/cubeclient/src/models/v1_load_result.rs b/rust/cubesql/cubeclient/src/models/v1_load_result.rs index 2731518d9eaef..67867689800d9 100644 --- a/rust/cubesql/cubeclient/src/models/v1_load_result.rs +++ b/rust/cubesql/cubeclient/src/models/v1_load_result.rs @@ -7,7 +7,7 @@ * * Generated by: https://openapi-generator.tech */ -use cubeorchestrator::query_result_transform::{RequestResultData, TransformedData}; +use cubeorchestrator::query_result_transform::TransformedData; #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct V1LoadResult { @@ -35,55 +35,32 @@ impl V1LoadResult { } } -impl From for V1LoadResult { - fn from(rrd: RequestResultData) -> Self { - let data = match rrd.data { - None => { +impl From for V1LoadResult { + fn from(d: TransformedData) -> Self { + let data = match d { + TransformedData::Compact { + members: _members, + dataset: _dataset, + } => { + // TODO V1LoadResult expects only Vanilla results? vec![] } - Some(d) => { - match d { - TransformedData::Compact { - members: _members, - dataset: _dataset, - } => { - // TODO V1LoadResult expects only Vanilla results? - vec![] - } - TransformedData::Vanilla(v) => v - .iter() - .map(|item| serde_json::to_value(item).unwrap_or(serde_json::Value::Null)) - .collect(), - } - } + TransformedData::Vanilla(v) => v + .iter() + .map(|item| serde_json::to_value(item).unwrap_or(serde_json::Value::Null)) + .collect(), }; let annotation = crate::models::V1LoadResultAnnotation { - measures: rrd - .annotation - .get("measures") - .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) - .unwrap_or(serde_json::Value::Null), - dimensions: rrd - .annotation - .get("dimensions") - .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) - .unwrap_or(serde_json::Value::Null), - segments: rrd - .annotation - .get("segments") - .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) - .unwrap_or(serde_json::Value::Null), - time_dimensions: rrd - .annotation - .get("timeDimensions") - .map(|v| serde_json::to_value(v).unwrap_or(serde_json::Value::Null)) - .unwrap_or(serde_json::Value::Null), + measures: serde_json::Value::Null, + dimensions: serde_json::Value::Null, + segments: serde_json::Value::Null, + time_dimensions: serde_json::Value::Null, }; V1LoadResult { - data_source: rrd.data_source, + data_source: None, annotation: Box::new(annotation), data, - refresh_key_values: rrd.refresh_key_values, + refresh_key_values: None, } } } From 60716476947639a2bd27b6860b7e2aff33ef61a8 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 18:10:02 +0200 Subject: [PATCH 118/128] remove obsolete getFinalQueryResultArray --- .../cubejs-backend-native/js/ResultWrapper.ts | 1 - packages/cubejs-backend-native/js/index.ts | 14 ---- .../cubejs-backend-native/src/orchestrator.rs | 81 +------------------ .../cubejs-backend-native/src/transport.rs | 7 +- 4 files changed, 6 insertions(+), 97 deletions(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 3b1fecfa9aef7..7adfb7f7f5163 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -1,7 +1,6 @@ import { getCubestoreResult, getFinalQueryResult, - getFinalQueryResultArray, getFinalQueryResultMulti, ResultRow } from './index'; diff --git a/packages/cubejs-backend-native/js/index.ts b/packages/cubejs-backend-native/js/index.ts index a2aefda61f2ea..f6c54477f463f 100644 --- a/packages/cubejs-backend-native/js/index.ts +++ b/packages/cubejs-backend-native/js/index.ts @@ -391,20 +391,6 @@ export const getFinalQueryResult = (transformDataObj: Object, rows: any, resultD return native.getFinalQueryResult(transformDataObj, rows, resultData); }; -/** - * Transform and prepare multiple query final results data that is sent to the client (used in sqlApiLoad). - * - * @param transformDataArr Array of data needed to transform raw query results - * @param rows Array of raw data received from the source DB via driver or reference to native CubeStore response results - * @param resultDataArr Array of final query result structures without actual data - * @return {Promise} ArrayBuffer with json-serialized data which should be directly sent to the client - */ -export const getFinalQueryResultArray = (transformDataArr: Object[], rows: any[], resultDataArr: Object[]): Promise => { - const native = loadNative(); - - return native.getFinalQueryResultArray(transformDataArr, rows, resultDataArr); -}; - /** * Transform and prepare multiple query final results data into a single response structure. * diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index 3b3742223ed76..cc5e06b2f48d4 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -2,8 +2,7 @@ use crate::node_obj_deserializer::JsValueDeserializer; use crate::transport::MapCubeErrExt; use cubeorchestrator::query_message_parser::QueryResult; use cubeorchestrator::query_result_transform::{ - get_final_cubestore_result_array, RequestResultArray, RequestResultData, - RequestResultDataMulti, TransformedData, + RequestResultData, RequestResultDataMulti, TransformedData, }; use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; use cubesql::CubeError; @@ -26,7 +25,6 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { cx.export_function("getCubestoreResult", get_cubestore_result)?; cx.export_function("getFinalQueryResult", final_query_result)?; cx.export_function("getFinalQueryResultMulti", final_query_result_multi)?; - cx.export_function("getFinalQueryResultArray", final_query_result_array)?; Ok(()) } @@ -99,7 +97,8 @@ impl ResultWrapper { Ok(data) => data, Err(_) => { return Err(CubeError::internal( - "Can't deserialize results raw data from JS ResultWrapper object".to_string(), + "Can't deserialize results raw data from JS ResultWrapper object" + .to_string(), )); } }; @@ -127,12 +126,6 @@ impl ResultWrapper { } } -pub type JsResultDataVectors = ( - Vec, - Vec>, - Vec, -); - fn json_to_array_buffer<'a, C>( mut cx: C, json_data: Result, @@ -250,74 +243,6 @@ pub fn final_query_result(mut cx: FunctionContext) -> JsResult { Ok(promise) } -pub fn convert_final_query_result_array_from_js( - cx: &mut FunctionContext<'_>, - transform_data_array: Handle, - data_array: Handle, - results_data_array: Handle, -) -> NeonResult { - let deserializer = JsValueDeserializer::new(cx, transform_data_array); - let transform_requests: Vec = match Deserialize::deserialize(deserializer) - { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - let mut cube_store_results: Vec> = vec![]; - for data_arg in data_array.to_vec(cx)? { - match extract_query_result(cx, data_arg) { - Ok(query_result) => cube_store_results.push(query_result), - Err(err) => return cx.throw_error(err.to_string()), - }; - } - - let deserializer = JsValueDeserializer::new(cx, results_data_array); - let request_results: Vec = match Deserialize::deserialize(deserializer) { - Ok(data) => data, - Err(err) => return cx.throw_error(err.to_string()), - }; - - Ok((transform_requests, cube_store_results, request_results)) -} - -pub fn final_query_result_array(mut cx: FunctionContext) -> JsResult { - let transform_data_array = cx.argument::(0)?; - let data_array = cx.argument::(1)?; - let results_data_array = cx.argument::(2)?; - - let convert_res = convert_final_query_result_array_from_js( - &mut cx, - transform_data_array, - data_array, - results_data_array, - ); - match convert_res { - Ok((transform_requests, cube_store_results, mut request_results)) => { - let promise = cx - .task(move || { - get_final_cubestore_result_array( - &transform_requests, - &cube_store_results, - &mut request_results, - )?; - - let final_obj = RequestResultArray { - results: request_results, - }; - - match serde_json::to_string(&final_obj) { - Ok(json) => Ok(json), - Err(err) => Err(anyhow::Error::from(err)), - } - }) - .promise(move |cx, json_data| json_to_array_buffer(cx, json_data)); - - Ok(promise) - } - Err(err) => cx.throw_error(err.to_string()), - } -} - pub fn final_query_result_multi(mut cx: FunctionContext) -> JsResult { let transform_data_array = cx.argument::(0)?; let deserializer = JsValueDeserializer::new(&mut cx, transform_data_array); diff --git a/packages/cubejs-backend-native/src/transport.rs b/packages/cubejs-backend-native/src/transport.rs index c14612e9bf438..72e512e1abf42 100644 --- a/packages/cubejs-backend-native/src/transport.rs +++ b/packages/cubejs-backend-native/src/transport.rs @@ -334,7 +334,7 @@ impl TransportService for NodeBridgeTransport { sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, - // ) -> Result, CubeError> { + // ) -> Result, CubeError> { ) -> Result { trace!("[transport] Request ->"); @@ -377,9 +377,8 @@ impl TransportService for NodeBridgeTransport { Box::new(|cx, v| Ok(cx.string(v).as_value(cx))), Box::new(move |cx, v| { if let Ok(js_result_wrapped) = v.downcast::(cx) { - let get_results_js_method: Handle = js_result_wrapped - .get(cx, "getResults") - .map_cube_err( + let get_results_js_method: Handle = + js_result_wrapped.get(cx, "getResults").map_cube_err( "Can't get getResults() method from JS ResultWrapper object", )?; From b7a398e301ed5a3dfc141cda4240dde14bc8f521 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 19:05:29 +0200 Subject: [PATCH 119/128] fix ws api subscriptionServer results processing --- packages/cubejs-server/src/websocket-server.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cubejs-server/src/websocket-server.ts b/packages/cubejs-server/src/websocket-server.ts index 00ee1c61e8dbd..cca6c9b44c4c7 100644 --- a/packages/cubejs-server/src/websocket-server.ts +++ b/packages/cubejs-server/src/websocket-server.ts @@ -31,18 +31,18 @@ export class WebSocketServer { const connectionIdToSocket: Record = {}; - this.subscriptionServer = this.serverCore.initSubscriptionServer((connectionId: string, message: any) => { + this.subscriptionServer = this.serverCore.initSubscriptionServer(async (connectionId: string, message: any) => { if (!connectionIdToSocket[connectionId]) { throw new Error(`Socket for ${connectionId} is not found found`); } let messageStr: string; - if (message.message instanceof ArrayBuffer) { - // In case we already have a JSON-serialized query result, we don't want to parse/stringify + if (message.message && message.message.isWrapper) { + // In case we have a wrapped query result, we don't want to parse/stringify // it again - it's too expensive, instead we serialize the rest of the message and then // inject query result json into message. - const resMsg = new TextDecoder().decode(message.message); + const resMsg = new TextDecoder().decode(await message.message.getFinalResult()); message.message = '~XXXXX~'; messageStr = JSON.stringify(message); messageStr = messageStr.replace('"~XXXXX~"', resMsg); From 9f6ee1b8f994210b5d8ff1c796a60f1b81e7bf41 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Fri, 10 Jan 2025 19:36:38 +0200 Subject: [PATCH 120/128] =?UTF-8?q?pass=20SchemaRef=20to=C2=A0load=20metho?= =?UTF-8?q?ds.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cubejs-backend-native/src/transport.rs | 1 + rust/cubesql/cubesql/src/compile/engine/df/scan.rs | 7 ++++++- rust/cubesql/cubesql/src/compile/test/mod.rs | 1 + rust/cubesql/cubesql/src/transport/service.rs | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/src/transport.rs b/packages/cubejs-backend-native/src/transport.rs index 72e512e1abf42..3dd4d46e61a35 100644 --- a/packages/cubejs-backend-native/src/transport.rs +++ b/packages/cubejs-backend-native/src/transport.rs @@ -334,6 +334,7 @@ impl TransportService for NodeBridgeTransport { sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, + _schema: SchemaRef, // ) -> Result, CubeError> { ) -> Result { trace!("[transport] Request ->"); diff --git a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs index 92095825369e5..2f798b2574068 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs @@ -662,6 +662,7 @@ impl ExecutionPlan for CubeScanExecutionPlan { self.auth_context.clone(), self.transport.clone(), meta.clone(), + self.schema.clone(), self.options.clone(), self.wrapped_sql.clone(), ) @@ -844,6 +845,7 @@ async fn load_data( auth_context: AuthContextRef, transport: Arc, meta: LoadRequestMeta, + schema: SchemaRef, options: CubeScanOptions, sql_query: Option, ) -> ArrowResult { @@ -875,7 +877,7 @@ async fn load_data( ) } else { let result = transport - .load(span_id, request, sql_query, auth_context, meta) + .load(span_id, request, sql_query, auth_context, meta, schema) .await; let mut response = result.map_err(|err| ArrowError::ComputeError(err.to_string()))?; if let Some(data) = response.results.pop() { @@ -903,6 +905,7 @@ fn load_to_stream_sync(one_shot_stream: &mut CubeScanOneShotStream) -> Result<() let auth = one_shot_stream.auth_context.clone(); let transport = one_shot_stream.transport.clone(); let meta = one_shot_stream.meta.clone(); + let schema = one_shot_stream.schema.clone(); let options = one_shot_stream.options.clone(); let wrapped_sql = one_shot_stream.wrapped_sql.clone(); @@ -914,6 +917,7 @@ fn load_to_stream_sync(one_shot_stream: &mut CubeScanOneShotStream) -> Result<() auth, transport, meta, + schema, options, wrapped_sql, )) @@ -1398,6 +1402,7 @@ mod tests { _sql_query: Option, _ctx: AuthContextRef, _meta_fields: LoadRequestMeta, + _schema: SchemaRef, ) -> Result { let response = r#" { diff --git a/rust/cubesql/cubesql/src/compile/test/mod.rs b/rust/cubesql/cubesql/src/compile/test/mod.rs index 11da31a9e5f81..ea86552e15e3c 100644 --- a/rust/cubesql/cubesql/src/compile/test/mod.rs +++ b/rust/cubesql/cubesql/src/compile/test/mod.rs @@ -801,6 +801,7 @@ impl TransportService for TestConnectionTransport { sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, + _schema: SchemaRef, ) -> Result { { let mut calls = self.load_calls.lock().await; diff --git a/rust/cubesql/cubesql/src/transport/service.rs b/rust/cubesql/cubesql/src/transport/service.rs index 7812eefebe839..91ac24f50d32d 100644 --- a/rust/cubesql/cubesql/src/transport/service.rs +++ b/rust/cubesql/cubesql/src/transport/service.rs @@ -142,6 +142,7 @@ pub trait TransportService: Send + Sync + Debug { sql_query: Option, ctx: AuthContextRef, meta_fields: LoadRequestMeta, + schema: SchemaRef, ) -> Result; async fn load_stream( @@ -280,6 +281,7 @@ impl TransportService for HttpTransport { _sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, + _schema: SchemaRef, ) -> Result { if meta.change_user().is_some() { return Err(CubeError::internal( From 98e4418c49a74ad4e8b7fd1e54a05b579997fda0 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Sat, 11 Jan 2025 01:24:25 +0200 Subject: [PATCH 121/128] =?UTF-8?q?trying=20to=C2=A0fix=20flaky=20ws=20fai?= =?UTF-8?q?ling=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cubejs-api-gateway/src/SubscriptionServer.ts | 4 ++-- packages/cubejs-api-gateway/src/gateway.ts | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/cubejs-api-gateway/src/SubscriptionServer.ts b/packages/cubejs-api-gateway/src/SubscriptionServer.ts index 9cf7a17b32886..c45c302915d96 100644 --- a/packages/cubejs-api-gateway/src/SubscriptionServer.ts +++ b/packages/cubejs-api-gateway/src/SubscriptionServer.ts @@ -19,7 +19,7 @@ const calcMessageLength = (message: unknown) => Buffer.byteLength( typeof message === 'string' ? message : JSON.stringify(message) ); -export type WebSocketSendMessageFn = (connectionId: string, message: any) => void; +export type WebSocketSendMessageFn = (connectionId: string, message: any) => Promise; export class SubscriptionServer { public constructor( @@ -31,7 +31,7 @@ export class SubscriptionServer { } public resultFn(connectionId: string, messageId: string, requestId: string | undefined) { - return (message, { status } = { status: 200 }) => { + return async (message, { status } = { status: 200 }) => { this.apiGateway.log({ type: 'Outgoing network usage', service: 'api-ws', diff --git a/packages/cubejs-api-gateway/src/gateway.ts b/packages/cubejs-api-gateway/src/gateway.ts index 0c37d59561173..af90986b4117b 100644 --- a/packages/cubejs-api-gateway/src/gateway.ts +++ b/packages/cubejs-api-gateway/src/gateway.ts @@ -1832,17 +1832,15 @@ class ApiGateway { if (props.queryType === 'multi') { // We prepare the final json result on native side const resultMulti = new ResultMultiWrapper(results, { queryType, slowQuery }); - return res(resultMulti); + await res(resultMulti); } else { // We prepare the full final json result on native side - return res(results[0]); + await res(results[0]); } } catch (e: any) { this.handleError({ e, context, query, res, requestStarted }); - - return null; } } @@ -1934,7 +1932,7 @@ class ApiGateway { }]; } - return res(request.streaming ? results[0] : { results }); + await res(request.streaming ? results[0] : { results }); } else { results = await Promise.all( normalizedQueries.map(async (normalizedQuery, index) => { @@ -1968,19 +1966,17 @@ class ApiGateway { ); if (request.streaming) { - return res(results[0]); + await res(results[0]); } else { // We prepare the final json result on native side const resultArray = new ResultArrayWrapper(results); - return res(resultArray); + await res(resultArray); } } } catch (e: any) { this.handleError({ e, context, query, res, requestStarted }); - - return null; } } From d330d7f16499e26889152d088bbfa6f682a23778 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 13 Jan 2025 15:02:35 +0200 Subject: [PATCH 122/128] remove cubeorchestrator dependency from cubesql --- packages/cubejs-backend-native/Cargo.lock | 1 - rust/cubenativeutils/Cargo.lock | 56 +-------- rust/cubesql/Cargo.lock | 119 +----------------- rust/cubesql/cubeclient/Cargo.toml | 1 - .../cubeclient/src/models/v1_load_result.rs | 32 ----- rust/cubesqlplanner/Cargo.lock | 60 +-------- 6 files changed, 13 insertions(+), 256 deletions(-) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index 0a3b208a6d86b..65113ac0e7061 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -718,7 +718,6 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "cubeorchestrator", "log", "reqwest", "reqwest-middleware", diff --git a/rust/cubenativeutils/Cargo.lock b/rust/cubenativeutils/Cargo.lock index 3375af83939d8..59b5872a1fd3c 100644 --- a/rust/cubenativeutils/Cargo.lock +++ b/rust/cubenativeutils/Cargo.lock @@ -118,7 +118,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers 2.1.2", + "flatbuffers", "half", "hex", "indexmap 1.9.3", @@ -440,7 +440,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets 0.52.6", ] @@ -644,7 +643,6 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "cubeorchestrator", "log", "reqwest", "reqwest-middleware", @@ -675,26 +673,6 @@ dependencies = [ "uuid 0.8.2", ] -[[package]] -name = "cubeorchestrator" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "cubeshared", - "itertools 0.13.0", - "neon", - "serde", - "serde_json", -] - -[[package]] -name = "cubeshared" -version = "0.1.0" -dependencies = [ - "flatbuffers 23.5.26", -] - [[package]] name = "cubesql" version = "0.28.0" @@ -721,7 +699,7 @@ dependencies = [ "futures-util", "hashbrown 0.14.5", "indexmap 1.9.3", - "itertools 0.10.5", + "itertools", "log", "lru", "minijinja", @@ -762,7 +740,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.3", - "itertools 0.10.5", + "itertools", "lazy_static", "log", "num_cpus", @@ -959,16 +937,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "flatbuffers" -version = "23.5.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" -dependencies = [ - "bitflags 1.3.2", - "rustc_version", -] - [[package]] name = "flate2" version = "1.0.30" @@ -1452,15 +1420,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -2508,15 +2467,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.34" diff --git a/rust/cubesql/Cargo.lock b/rust/cubesql/Cargo.lock index 793a6b6345c92..51c26fde43a59 100644 --- a/rust/cubesql/Cargo.lock +++ b/rust/cubesql/Cargo.lock @@ -133,7 +133,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers 2.1.2", + "flatbuffers", "half", "hex", "indexmap 1.9.3", @@ -412,7 +412,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets 0.48.1", ] @@ -586,7 +585,7 @@ dependencies = [ "ciborium", "clap", "criterion-plot", - "itertools 0.10.3", + "itertools", "lazy_static", "num-traits", "oorandom", @@ -607,7 +606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools 0.10.3", + "itertools", ] [[package]] @@ -736,7 +735,6 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "cubeorchestrator", "log", "reqwest", "reqwest-middleware", @@ -749,26 +747,6 @@ dependencies = [ "wiremock", ] -[[package]] -name = "cubeorchestrator" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "cubeshared", - "itertools 0.13.0", - "neon", - "serde", - "serde_json", -] - -[[package]] -name = "cubeshared" -version = "0.1.0" -dependencies = [ - "flatbuffers 23.5.26", -] - [[package]] name = "cubesql" version = "0.28.0" @@ -797,7 +775,7 @@ dependencies = [ "hashbrown 0.14.3", "indexmap 1.9.3", "insta", - "itertools 0.10.3", + "itertools", "log", "lru", "minijinja", @@ -886,7 +864,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.1", - "itertools 0.10.3", + "itertools", "lazy_static", "log", "num_cpus", @@ -1085,16 +1063,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "flatbuffers" -version = "23.5.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" -dependencies = [ - "bitflags 1.3.2", - "rustc_version", -] - [[package]] name = "flate2" version = "1.0.22" @@ -1592,15 +1560,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.4.8" @@ -1707,16 +1666,6 @@ version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" -[[package]] -name = "libloading" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" -dependencies = [ - "cfg-if 1.0.0", - "windows-targets 0.52.6", -] - [[package]] name = "libm" version = "0.2.8" @@ -1909,32 +1858,6 @@ dependencies = [ "syn 1.0.90", ] -[[package]] -name = "neon" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d75440242411c87dc39847b0e33e961ec1f10326a9d8ecf9c1ea64a3b3c13dc" -dependencies = [ - "libloading", - "neon-macros", - "once_cell", - "semver", - "send_wrapper", - "smallvec", - "tokio", -] - -[[package]] -name = "neon-macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6813fde79b646e47e7ad75f480aa80ef76a5d9599e2717407961531169ee38b" -dependencies = [ - "quote", - "syn 2.0.87", - "syn-mid", -] - [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -2701,15 +2624,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustls" version = "0.23.11" @@ -2796,18 +2710,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58bf37232d3bb9a2c4e641ca2a11d83b5062066f88df7fed36c28772046d65ba" -[[package]] -name = "semver" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" - -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" - [[package]] name = "serde" version = "1.0.217" @@ -3078,17 +2980,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "syn-mid" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5dc35bb08dd1ca3dfb09dce91fd2d13294d6711c88897d9a9d60acf39bce049" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "sync_wrapper" version = "1.0.1" diff --git a/rust/cubesql/cubeclient/Cargo.toml b/rust/cubesql/cubeclient/Cargo.toml index 6f57b1a5050e6..1e7797cd9bf98 100644 --- a/rust/cubesql/cubeclient/Cargo.toml +++ b/rust/cubesql/cubeclient/Cargo.toml @@ -19,7 +19,6 @@ async-trait = "0.1.51" tokio = { version = "1.6", features = ["time"] } uuid = { version = "1", features = ["v4"] } log = "0.4" -cubeorchestrator = { path = "../../cubeorchestrator" } [dependencies.reqwest] version = "0.12.5" diff --git a/rust/cubesql/cubeclient/src/models/v1_load_result.rs b/rust/cubesql/cubeclient/src/models/v1_load_result.rs index 67867689800d9..7b50ab1633e59 100644 --- a/rust/cubesql/cubeclient/src/models/v1_load_result.rs +++ b/rust/cubesql/cubeclient/src/models/v1_load_result.rs @@ -7,8 +7,6 @@ * * Generated by: https://openapi-generator.tech */ -use cubeorchestrator::query_result_transform::TransformedData; - #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] pub struct V1LoadResult { #[serde(rename = "dataSource", skip_serializing_if = "Option::is_none")] @@ -34,33 +32,3 @@ impl V1LoadResult { } } } - -impl From for V1LoadResult { - fn from(d: TransformedData) -> Self { - let data = match d { - TransformedData::Compact { - members: _members, - dataset: _dataset, - } => { - // TODO V1LoadResult expects only Vanilla results? - vec![] - } - TransformedData::Vanilla(v) => v - .iter() - .map(|item| serde_json::to_value(item).unwrap_or(serde_json::Value::Null)) - .collect(), - }; - let annotation = crate::models::V1LoadResultAnnotation { - measures: serde_json::Value::Null, - dimensions: serde_json::Value::Null, - segments: serde_json::Value::Null, - time_dimensions: serde_json::Value::Null, - }; - V1LoadResult { - data_source: None, - annotation: Box::new(annotation), - data, - refresh_key_values: None, - } - } -} diff --git a/rust/cubesqlplanner/Cargo.lock b/rust/cubesqlplanner/Cargo.lock index 1712cc95c7815..c2732a97cef95 100644 --- a/rust/cubesqlplanner/Cargo.lock +++ b/rust/cubesqlplanner/Cargo.lock @@ -128,7 +128,7 @@ dependencies = [ "chrono", "comfy-table 5.0.1", "csv", - "flatbuffers 2.1.2", + "flatbuffers", "half", "hex", "indexmap 1.9.3", @@ -450,7 +450,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets 0.52.6", ] @@ -676,7 +675,6 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "cubeorchestrator", "log", "reqwest", "reqwest-middleware", @@ -707,26 +705,6 @@ dependencies = [ "uuid 0.8.2", ] -[[package]] -name = "cubeorchestrator" -version = "0.1.0" -dependencies = [ - "anyhow", - "chrono", - "cubeshared", - "itertools 0.13.0", - "neon", - "serde", - "serde_json", -] - -[[package]] -name = "cubeshared" -version = "0.1.0" -dependencies = [ - "flatbuffers 23.5.26", -] - [[package]] name = "cubesql" version = "0.28.0" @@ -753,7 +731,7 @@ dependencies = [ "futures-util", "hashbrown 0.14.5", "indexmap 1.9.3", - "itertools 0.10.5", + "itertools", "log", "lru", "minijinja", @@ -790,7 +768,7 @@ dependencies = [ "cubeclient", "cubenativeutils", "datafusion", - "itertools 0.10.5", + "itertools", "lazy_static", "minijinja", "nativebridge", @@ -816,7 +794,7 @@ dependencies = [ "datafusion-physical-expr", "futures", "hashbrown 0.12.3", - "itertools 0.10.5", + "itertools", "lazy_static", "log", "num_cpus", @@ -1013,16 +991,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "flatbuffers" -version = "23.5.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac53e22462d78c16d64a1cd22371b54cc3fe94aa15e7886a2fa6e5d1ab8640" -dependencies = [ - "bitflags 1.3.2", - "rustc_version", -] - [[package]] name = "flate2" version = "1.0.30" @@ -1506,15 +1474,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -1806,7 +1765,7 @@ dependencies = [ "Inflector", "async-trait", "byteorder", - "itertools 0.10.5", + "itertools", "proc-macro2", "quote", "syn 1.0.109", @@ -2575,15 +2534,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.34" From 5f40798413a077cd783b42336ad6fea46c69120b Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Mon, 13 Jan 2025 22:40:16 +0200 Subject: [PATCH 123/128] =?UTF-8?q?rewrite=20all=20load=20api=20calls=20to?= =?UTF-8?q?=C2=A0return=20RecordBatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cubejs-backend-native/src/orchestrator.rs | 79 ++++++++++- .../cubejs-backend-native/src/transport.rs | 35 +++-- .../cubesql/src/compile/engine/df/scan.rs | 134 ++++++++++-------- rust/cubesql/cubesql/src/compile/test/mod.rs | 19 ++- rust/cubesql/cubesql/src/transport/service.rs | 16 +-- 5 files changed, 188 insertions(+), 95 deletions(-) diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index cc5e06b2f48d4..f7c569219f89d 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -2,9 +2,10 @@ use crate::node_obj_deserializer::JsValueDeserializer; use crate::transport::MapCubeErrExt; use cubeorchestrator::query_message_parser::QueryResult; use cubeorchestrator::query_result_transform::{ - RequestResultData, RequestResultDataMulti, TransformedData, + DBResponsePrimitive, RequestResultData, RequestResultDataMulti, TransformedData, }; use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; +use cubesql::compile::engine::df::scan::{FieldValue, ValueObject}; use cubesql::CubeError; use neon::context::{Context, FunctionContext, ModuleContext}; use neon::handle::Handle; @@ -15,6 +16,7 @@ use neon::prelude::{ }; use neon::types::buffer::TypedArray; use serde::Deserialize; +use std::borrow::Cow; use std::sync::Arc; pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { @@ -39,6 +41,7 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { pub struct ResultWrapper { transform_data: TransformDataRequest, data: Arc, + transformed_data: Option, } impl ResultWrapper { @@ -115,14 +118,80 @@ impl ResultWrapper { Ok(Self { transform_data: transform_request, data: query_result, + transformed_data: None, }) } - pub fn transform_result(&self) -> Result { - let transformed = TransformedData::transform(&self.transform_data, &self.data) - .map_cube_err("Can't prepare transformed data")?; + pub fn transform_result(&mut self) -> Result<(), CubeError> { + self.transformed_data = Some( + TransformedData::transform(&self.transform_data, &self.data) + .map_cube_err("Can't prepare transformed data")?, + ); - Ok(transformed) + Ok(()) + } +} + +impl ValueObject for ResultWrapper { + fn len(&mut self) -> Result { + if self.transformed_data.is_none() { + self.transform_result()?; + } + + let data = self.transformed_data.as_ref().unwrap(); + + match data { + TransformedData::Compact { + members: _members, + dataset, + } => Ok(dataset.len()), + TransformedData::Vanilla(dataset) => Ok(dataset.len()), + } + } + + fn get(&mut self, index: usize, field_name: &str) -> Result { + if self.transformed_data.is_none() { + self.transform_result()?; + } + + let data = self.transformed_data.as_ref().unwrap(); + + let value = match data { + TransformedData::Compact { members, dataset } => { + let Some(row) = dataset.get(index) else { + return Err(CubeError::user(format!( + "Unexpected response from Cube, can't get {} row", + index + ))); + }; + + let Some(member_index) = members.iter().position(|m| m == field_name) else { + return Err(CubeError::user(format!( + "Field name '{}' not found in members", + field_name + ))); + }; + + row.get(member_index).unwrap_or(&DBResponsePrimitive::Null) + } + TransformedData::Vanilla(dataset) => { + let Some(row) = dataset.get(index) else { + return Err(CubeError::user(format!( + "Unexpected response from Cube, can't get {} row", + index + ))); + }; + + row.get(field_name).unwrap_or(&DBResponsePrimitive::Null) + } + }; + + Ok(match value { + DBResponsePrimitive::String(s) => FieldValue::String(Cow::Borrowed(s)), + DBResponsePrimitive::Number(n) => FieldValue::Number(*n), + DBResponsePrimitive::Boolean(b) => FieldValue::Bool(*b), + DBResponsePrimitive::Null => FieldValue::Null, + }) } } diff --git a/packages/cubejs-backend-native/src/transport.rs b/packages/cubejs-backend-native/src/transport.rs index 3dd4d46e61a35..a54aa3f46bda3 100644 --- a/packages/cubejs-backend-native/src/transport.rs +++ b/packages/cubejs-backend-native/src/transport.rs @@ -12,7 +12,9 @@ use crate::{ stream::call_js_with_stream_as_callback, }; use async_trait::async_trait; -use cubesql::compile::engine::df::scan::{MemberField, SchemaRef}; +use cubesql::compile::engine::df::scan::{ + convert_transport_response, transform_response, MemberField, RecordBatch, SchemaRef, +}; use cubesql::compile::engine::df::wrapper::SqlQuery; use cubesql::transport::{ SpanId, SqlGenerator, SqlResponse, TransportLoadRequestQuery, TransportLoadResponse, @@ -334,9 +336,9 @@ impl TransportService for NodeBridgeTransport { sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, - _schema: SchemaRef, - // ) -> Result, CubeError> { - ) -> Result { + schema: SchemaRef, + member_fields: Vec, + ) -> Result, CubeError> { trace!("[transport] Request ->"); let native_auth = ctx @@ -461,20 +463,23 @@ impl TransportService for NodeBridgeTransport { } }; - break serde_json::from_value::(response) + let response = match serde_json::from_value::(response) { + Ok(v) => v, + Err(err) => { + return Err(CubeError::user(err.to_string())); + } + }; + + break convert_transport_response(response, schema.clone(), member_fields) .map_err(|err| CubeError::user(err.to_string())); } ValueFromJs::ResultWrapper(result_wrappers) => { - let response = TransportLoadResponse { - pivot_query: None, - slow_query: None, - query_type: None, - results: result_wrappers - .into_iter() - .map(|v| v.transform_result().unwrap().into()) - .collect(), - }; - break Ok(response); + break result_wrappers + .into_iter() + .map(|mut wrapper| { + transform_response(&mut wrapper, schema.clone(), &member_fields) + }) + .collect::, _>>(); } } } diff --git a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs index 2f798b2574068..8ba818e7ea0bc 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs @@ -1,5 +1,5 @@ use async_trait::async_trait; -use cubeclient::models::{V1LoadRequestQuery, V1LoadResult, V1LoadResultAnnotation}; +use cubeclient::models::{V1LoadRequestQuery, V1LoadResponse}; pub use datafusion::{ arrow::{ array::{ @@ -52,7 +52,7 @@ use datafusion::{ logical_plan::JoinType, scalar::ScalarValue, }; -use serde_json::{json, Value}; +use serde_json::Value; #[derive(Debug, Clone, Eq, PartialEq)] pub enum MemberField { @@ -655,28 +655,22 @@ impl ExecutionPlan for CubeScanExecutionPlan { ))); } - let mut response = JsonValueObject::new( - load_data( - self.span_id.clone(), - request, - self.auth_context.clone(), - self.transport.clone(), - meta.clone(), - self.schema.clone(), - self.options.clone(), - self.wrapped_sql.clone(), - ) - .await? - .data, - ); - one_shot_stream.data = Some( - transform_response( - &mut response, - one_shot_stream.schema.clone(), - &one_shot_stream.member_fields, - ) - .map_err(|e| DataFusionError::Execution(e.message.to_string()))?, - ); + let response = load_data( + self.span_id.clone(), + request, + self.auth_context.clone(), + self.transport.clone(), + meta.clone(), + self.schema.clone(), + self.member_fields.clone(), + self.options.clone(), + self.wrapped_sql.clone(), + ) + .await?; + + // For now execute method executes only one query at a time, so we + // take the first result + one_shot_stream.data = Some(response.first().unwrap().clone()); Ok(Box::pin(CubeScanStreamRouter::new( None, @@ -846,9 +840,10 @@ async fn load_data( transport: Arc, meta: LoadRequestMeta, schema: SchemaRef, + member_fields: Vec, options: CubeScanOptions, sql_query: Option, -) -> ArrowResult { +) -> ArrowResult> { let no_members_query = request.measures.as_ref().map(|v| v.len()).unwrap_or(0) == 0 && request.dimensions.as_ref().map(|v| v.len()).unwrap_or(0) == 0 && request @@ -866,22 +861,27 @@ async fn load_data( data.push(serde_json::Value::Null) } - V1LoadResult::new( - V1LoadResultAnnotation { - measures: json!(Vec::::new()), - dimensions: json!(Vec::::new()), - segments: json!(Vec::::new()), - time_dimensions: json!(Vec::::new()), - }, - data, - ) + let mut response = JsonValueObject::new(data); + let rec = transform_response(&mut response, schema.clone(), &member_fields) + .map_err(|e| DataFusionError::Execution(e.message.to_string()))?; + + rec } else { let result = transport - .load(span_id, request, sql_query, auth_context, meta, schema) - .await; - let mut response = result.map_err(|err| ArrowError::ComputeError(err.to_string()))?; - if let Some(data) = response.results.pop() { - match (options.max_records, data.data.len()) { + .load( + span_id, + request, + sql_query, + auth_context, + meta, + schema, + member_fields, + ) + .await + .map_err(|err| ArrowError::ComputeError(err.to_string()))?; + let response = result.first(); + if let Some(data) = response.cloned() { + match (options.max_records, data.num_rows()) { (Some(max_records), len) if len >= max_records => { return Err(ArrowError::ComputeError(format!("One of the Cube queries exceeded the maximum row limit ({}). JOIN/UNION is not possible as it will produce incorrect results. Try filtering the results more precisely or moving post-processing functions to an outer query.", max_records))); } @@ -896,7 +896,7 @@ async fn load_data( } }; - Ok(result) + Ok(vec![result]) } fn load_to_stream_sync(one_shot_stream: &mut CubeScanOneShotStream) -> Result<()> { @@ -906,6 +906,7 @@ fn load_to_stream_sync(one_shot_stream: &mut CubeScanOneShotStream) -> Result<() let transport = one_shot_stream.transport.clone(); let meta = one_shot_stream.meta.clone(); let schema = one_shot_stream.schema.clone(); + let member_fields = one_shot_stream.member_fields.clone(); let options = one_shot_stream.options.clone(); let wrapped_sql = one_shot_stream.wrapped_sql.clone(); @@ -918,22 +919,16 @@ fn load_to_stream_sync(one_shot_stream: &mut CubeScanOneShotStream) -> Result<() transport, meta, schema, + member_fields, options, wrapped_sql, )) }) .join() - .map_err(|_| DataFusionError::Execution(format!("Can't load to stream")))?; - - let mut response = JsonValueObject::new(res.unwrap().data); - one_shot_stream.data = Some( - transform_response( - &mut response, - one_shot_stream.schema.clone(), - &one_shot_stream.member_fields, - ) - .map_err(|e| DataFusionError::Execution(e.message.to_string()))?, - ); + .map_err(|_| DataFusionError::Execution(format!("Can't load to stream")))??; + + let response = res.first(); + one_shot_stream.data = Some(response.cloned().unwrap()); Ok(()) } @@ -1339,6 +1334,21 @@ pub fn transform_response( Ok(RecordBatch::try_new(schema.clone(), columns)?) } +pub fn convert_transport_response( + response: V1LoadResponse, + schema: SchemaRef, + member_fields: Vec, +) -> std::result::Result, CubeError> { + response + .results + .into_iter() + .map(|r| { + let mut response = JsonValueObject::new(r.data.clone()); + transform_response(&mut response, schema.clone(), &member_fields) + }) + .collect::, CubeError>>() +} + #[cfg(test)] mod tests { use super::*; @@ -1402,10 +1412,12 @@ mod tests { _sql_query: Option, _ctx: AuthContextRef, _meta_fields: LoadRequestMeta, - _schema: SchemaRef, - ) -> Result { + schema: SchemaRef, + member_fields: Vec, + ) -> Result, CubeError> { let response = r#" - { + { + "results": [{ "annotation": { "measures": [], "dimensions": [], @@ -1419,17 +1431,13 @@ mod tests { {"KibanaSampleDataEcommerce.count": null, "KibanaSampleDataEcommerce.maxPrice": null, "KibanaSampleDataEcommerce.isBool": "true", "KibanaSampleDataEcommerce.orderDate": "9999-12-31 00:00:00.000", "KibanaSampleDataEcommerce.city": "City 4"}, {"KibanaSampleDataEcommerce.count": null, "KibanaSampleDataEcommerce.maxPrice": null, "KibanaSampleDataEcommerce.isBool": "false", "KibanaSampleDataEcommerce.orderDate": null, "KibanaSampleDataEcommerce.city": null} ] - } + }] + } "#; - let result: V1LoadResult = serde_json::from_str(response).unwrap(); - - Ok(V1LoadResponse { - pivot_query: None, - slow_query: None, - query_type: None, - results: vec![result], - }) + let result: V1LoadResponse = serde_json::from_str(response).unwrap(); + convert_transport_response(result, schema.clone(), member_fields) + .map_err(|err| CubeError::user(err.to_string())) } async fn load_stream( diff --git a/rust/cubesql/cubesql/src/compile/test/mod.rs b/rust/cubesql/cubesql/src/compile/test/mod.rs index ea86552e15e3c..d264b36e46426 100644 --- a/rust/cubesql/cubesql/src/compile/test/mod.rs +++ b/rust/cubesql/cubesql/src/compile/test/mod.rs @@ -42,6 +42,9 @@ pub mod test_user_change; #[cfg(test)] pub mod test_wrapper; pub mod utils; +use crate::compile::{ + arrow::record_batch::RecordBatch, engine::df::scan::convert_transport_response, +}; pub use utils::*; pub fn get_test_meta() -> Vec { @@ -801,8 +804,9 @@ impl TransportService for TestConnectionTransport { sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, - _schema: SchemaRef, - ) -> Result { + schema: SchemaRef, + member_fields: Vec, + ) -> Result, CubeError> { { let mut calls = self.load_calls.lock().await; calls.push(TestTransportLoadCall { @@ -820,12 +824,19 @@ impl TransportService for TestConnectionTransport { } let mocks = self.load_mocks.lock().await; - let Some((_req, res)) = mocks.iter().find(|(req, _res)| req == &query) else { + let Some(res) = mocks + .iter() + .find(|(req, _res)| req == &query) + .map(|(_req, res)| { + convert_transport_response(res.clone(), schema.clone(), member_fields) + }) + else { return Err(CubeError::internal(format!( "Unexpected query in test transport: {query:?}" ))); }; - Ok(res.clone()) + + res } async fn load_stream( diff --git a/rust/cubesql/cubesql/src/transport/service.rs b/rust/cubesql/cubesql/src/transport/service.rs index 91ac24f50d32d..85d9d270910f9 100644 --- a/rust/cubesql/cubesql/src/transport/service.rs +++ b/rust/cubesql/cubesql/src/transport/service.rs @@ -28,15 +28,13 @@ use uuid::Uuid; use crate::{ compile::{ engine::df::{ - scan::MemberField, + scan::{convert_transport_response, MemberField}, wrapper::{GroupingSetDesc, GroupingSetType, SqlQuery}, }, rewrite::LikeType, }, sql::{AuthContextRef, HttpAuthContext}, - transport::{ - MetaContext, TransportLoadRequest, TransportLoadRequestQuery, TransportLoadResponse, - }, + transport::{MetaContext, TransportLoadRequest, TransportLoadRequestQuery}, CubeError, RWLockAsync, }; @@ -143,7 +141,8 @@ pub trait TransportService: Send + Sync + Debug { ctx: AuthContextRef, meta_fields: LoadRequestMeta, schema: SchemaRef, - ) -> Result; + member_fields: Vec, + ) -> Result, CubeError>; async fn load_stream( &self, @@ -281,8 +280,9 @@ impl TransportService for HttpTransport { _sql_query: Option, ctx: AuthContextRef, meta: LoadRequestMeta, - _schema: SchemaRef, - ) -> Result { + schema: SchemaRef, + member_fields: Vec, + ) -> Result, CubeError> { if meta.change_user().is_some() { return Err(CubeError::internal( "Changing security context (__user) is not supported in the standalone mode" @@ -298,7 +298,7 @@ impl TransportService for HttpTransport { let response = cube_api::load_v1(&self.get_client_config_for_ctx(ctx), Some(request)).await?; - Ok(response) + convert_transport_response(response, schema, member_fields) } async fn load_stream( From 1a3680c5a4aa4ef377f57ad8245a469c1a87e043 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 14 Jan 2025 00:29:22 +0200 Subject: [PATCH 124/128] fix @cubejs-backend/native version ref after rebase --- packages/cubejs-cubestore-driver/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-cubestore-driver/package.json b/packages/cubejs-cubestore-driver/package.json index b4c12f857b4e3..a9aed9c8e15f5 100644 --- a/packages/cubejs-cubestore-driver/package.json +++ b/packages/cubejs-cubestore-driver/package.json @@ -29,7 +29,7 @@ "@cubejs-backend/base-driver": "1.1.12", "@cubejs-backend/cubestore": "1.1.12", "@cubejs-backend/shared": "1.1.12", - "@cubejs-backend/native": "1.1.14", + "@cubejs-backend/native": "1.1.15", "csv-write-stream": "^2.0.0", "flatbuffers": "23.3.3", "fs-extra": "^9.1.0", From 26f0889d4e58762e2453a63d37013889a2b04826 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 14 Jan 2025 11:37:48 +0200 Subject: [PATCH 125/128] set prototype of ResultWrapper proxy to class prototype --- packages/cubejs-backend-native/js/ResultWrapper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index 7adfb7f7f5163..cbf7b026dd462 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -112,6 +112,7 @@ export class ResultWrapper extends BaseWrapper implements DataResult { return [...Object.keys(target), ...Object.keys(array), 'length', 'isNative']; } }); + Object.setPrototypeOf(this.proxy, ResultWrapper.prototype); return this.proxy; } From 96e19ba36426451414bb6fc1dc9de1f548042c5e Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 14 Jan 2025 13:11:36 +0200 Subject: [PATCH 126/128] fix linter warnings --- packages/cubejs-backend-native/js/ResultWrapper.ts | 2 +- packages/cubejs-backend-native/src/orchestrator.rs | 6 ------ packages/cubejs-backend-native/test/sql.test.ts | 2 +- rust/cubesql/cubesql/src/compile/engine/df/scan.rs | 6 +++--- rust/cubesql/cubesql/src/compile/engine/udf/common.rs | 7 +++++-- rust/cubesql/cubesql/src/compile/rewrite/rules/filters.rs | 4 ++-- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index cbf7b026dd462..c34b760174520 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -57,7 +57,7 @@ export class ResultWrapper extends BaseWrapper implements DataResult { const array = this.getArray(); const l = array.length; - return function* () { + return function* yieldArrayItem () { for (let i = 0; i < l; i++) { yield array[i]; } diff --git a/packages/cubejs-backend-native/src/orchestrator.rs b/packages/cubejs-backend-native/src/orchestrator.rs index f7c569219f89d..227e8b9970d76 100644 --- a/packages/cubejs-backend-native/src/orchestrator.rs +++ b/packages/cubejs-backend-native/src/orchestrator.rs @@ -31,12 +31,6 @@ pub fn register_module(cx: &mut ModuleContext) -> NeonResult<()> { Ok(()) } -// #[derive(Debug, Clone)] -// pub enum ResultWrapperData { -// JsObj(RecordBatch), -// Native() -// } - #[derive(Debug, Clone)] pub struct ResultWrapper { transform_data: TransformDataRequest, diff --git a/packages/cubejs-backend-native/test/sql.test.ts b/packages/cubejs-backend-native/test/sql.test.ts index 1d55187483dd7..e417b577bc842 100644 --- a/packages/cubejs-backend-native/test/sql.test.ts +++ b/packages/cubejs-backend-native/test/sql.test.ts @@ -6,7 +6,7 @@ import * as native from '../js'; import metaFixture from './meta'; import { FakeRowStream } from './response-fake'; -const logger = jest.fn(({ event }) => { +const _logger = jest.fn(({ event }) => { if ( !event.error.includes( 'load - strange response, success which contains error' diff --git a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs index 8ba818e7ea0bc..43031a54c33ea 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs @@ -1131,7 +1131,7 @@ pub fn transform_response( )) })?; // TODO switch parsing to microseconds - if timestamp.timestamp_millis() > (((1i64) << 62) / 1_000_000) { + if timestamp.and_utc().timestamp_millis() > (((1i64) << 62) / 1_000_000) { builder.append_null()?; } else if let Some(nanos) = timestamp.timestamp_nanos_opt() { builder.append_value(nanos)?; @@ -1173,10 +1173,10 @@ pub fn transform_response( )) })?; // TODO switch parsing to microseconds - if timestamp.timestamp_millis() > (((1 as i64) << 62) / 1_000_000) { + if timestamp.and_utc().timestamp_millis() > (((1 as i64) << 62) / 1_000_000) { builder.append_null()?; } else { - builder.append_value(timestamp.timestamp_millis())?; + builder.append_value(timestamp.and_utc().timestamp_millis())?; } }, }, diff --git a/rust/cubesql/cubesql/src/compile/engine/udf/common.rs b/rust/cubesql/cubesql/src/compile/engine/udf/common.rs index 494641bbcac35..c85095e776eb8 100644 --- a/rust/cubesql/cubesql/src/compile/engine/udf/common.rs +++ b/rust/cubesql/cubesql/src/compile/engine/udf/common.rs @@ -1029,6 +1029,7 @@ pub fn create_date_udf() -> ScalarUDF { builder.append_value( NaiveDateTime::parse_from_str(strings.value(i), "%Y-%m-%d %H:%M:%S%.f") .map_err(|e| DataFusionError::Execution(e.to_string()))? + .and_utc() .timestamp_nanos_opt() .unwrap(), )?; @@ -1233,6 +1234,7 @@ macro_rules! date_math_udf { let interval = intervals.value(i).into(); builder.append_value( $FUN(timestamp, interval, $IS_ADD)? + .and_utc() .timestamp_nanos_opt() .unwrap(), )?; @@ -1572,7 +1574,7 @@ pub fn create_str_to_date_udf() -> ScalarUDF { })?; Ok(ColumnarValue::Scalar(ScalarValue::TimestampNanosecond( - Some(res.timestamp_nanos_opt().unwrap()), + Some(res.and_utc().timestamp_nanos_opt().unwrap()), None, ))) }); @@ -2345,7 +2347,7 @@ macro_rules! generate_series_helper_timestamp { )) })?; let res = date_addsub_month_day_nano(current_dt, $STEP, true)?; - $CURRENT = res.timestamp_nanos_opt().unwrap() as $PRIMITIVE_TYPE; + $CURRENT = res.and_utc().timestamp_nanos_opt().unwrap() as $PRIMITIVE_TYPE; }; } @@ -3230,6 +3232,7 @@ pub fn create_date_to_timestamp_udf() -> ScalarUDF { )?; Ok(Some( NaiveDateTime::new(date, time) + .and_utc() .timestamp_nanos_opt() .unwrap(), )) diff --git a/rust/cubesql/cubesql/src/compile/rewrite/rules/filters.rs b/rust/cubesql/cubesql/src/compile/rewrite/rules/filters.rs index 0246487be65ed..a5c3167d409a0 100644 --- a/rust/cubesql/cubesql/src/compile/rewrite/rules/filters.rs +++ b/rust/cubesql/cubesql/src/compile/rewrite/rules/filters.rs @@ -4117,8 +4117,8 @@ impl FilterRules { }; let (Some(start_date), Some(end_date)) = ( - start_date.timestamp_nanos_opt(), - end_date.timestamp_nanos_opt(), + start_date.and_utc().timestamp_nanos_opt(), + end_date.and_utc().timestamp_nanos_opt(), ) else { return false; }; From 4f7b9f981f3f22c12bc21ddeac76ec504e0a4012 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 14 Jan 2025 13:13:09 +0200 Subject: [PATCH 127/128] fix yarn.lock --- yarn.lock | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index e1e0c15cc95f7..351133b668c2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5303,11 +5303,6 @@ tiny-invariant "^1.3.3" valid-url "^1.0.9" -"@cubejs-backend/cubesql@1.1.12": - version "1.1.12" - resolved "https://registry.yarnpkg.com/@cubejs-backend/cubesql/-/cubesql-1.1.12.tgz#d3be0c09b41864424e2c41341c6d286b1343f1f7" - integrity sha512-JTuxZHdz+8+Jyj8mFCkXsNcaw3n4J3BLCNuijwF+7dw6AD3ZO+LOExtB65lyMrE05VGD5YeYSXuRg9RY9wXVXA== - "@cubejs-backend/dotenv@^9.0.2": version "9.0.2" resolved "https://registry.yarnpkg.com/@cubejs-backend/dotenv/-/dotenv-9.0.2.tgz#c3679091b702f0fd38de120c5a63943fcdc0dcbf" @@ -5324,15 +5319,6 @@ uuid "9.0.0" winston "3.8.2" -"@cubejs-backend/native@1.1.12": - version "1.1.12" - resolved "https://registry.yarnpkg.com/@cubejs-backend/native/-/native-1.1.12.tgz#150974208f7c7af2924ab7b1e834e00786e236b7" - integrity sha512-uKdUHjSEl4U2Maaq7Q/y14mDE0+pLvGrL43KbsTdS84ZaTt3nabOmoWfaZ8kUdJCu9ZvdTwbEKrdm1UcOC5WAQ== - dependencies: - "@cubejs-backend/cubesql" "1.1.12" - "@cubejs-backend/shared" "1.1.12" - "@cubejs-infra/post-installer" "^0.0.7" - "@cubejs-backend/shared@0.33.20": version "0.33.20" resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-0.33.20.tgz#3d9fa60041599cca9fe4c04df05daa4b8ab8675f" From 73b0bd9ac9fdd40178520a53f47dfb6b91b7b775 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 14 Jan 2025 13:20:15 +0200 Subject: [PATCH 128/128] linter fix --- packages/cubejs-backend-native/js/ResultWrapper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-backend-native/js/ResultWrapper.ts b/packages/cubejs-backend-native/js/ResultWrapper.ts index c34b760174520..9068a83ed3a8c 100644 --- a/packages/cubejs-backend-native/js/ResultWrapper.ts +++ b/packages/cubejs-backend-native/js/ResultWrapper.ts @@ -57,7 +57,7 @@ export class ResultWrapper extends BaseWrapper implements DataResult { const array = this.getArray(); const l = array.length; - return function* yieldArrayItem () { + return function* yieldArrayItem() { for (let i = 0; i < l; i++) { yield array[i]; }