diff --git a/.github/workflows/image-build.yaml b/.github/workflows/image-build.yaml index d6dc08c541433..21f704954aa2b 100644 --- a/.github/workflows/image-build.yaml +++ b/.github/workflows/image-build.yaml @@ -1,7 +1,7 @@ name: image build env: - TAG: v0.35.79-gorgias + TAG: v0.35.80-gorgias on: push: @@ -42,7 +42,7 @@ jobs: DOCKER_BUILD_RECORD_UPLOAD: false DOCKER_BUILD_SUMMARY: true with: - push: ${{ github.ref == 'refs/heads/gorgias' }} + push: true # ${{ github.ref == 'refs/heads/gorgias' }} context: rust/cubestore file: rust/cubestore/gorgias.Dockerfile tags: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 8901385b30626..aa451ef07acd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + + +### Bug Fixes + +* **schema-compiler:** propagate FILTER_PARAMS from view to inner cube's SELECT ([#8466](https://github.com/cube-js/cube/issues/8466)) ([c0466fd](https://github.com/cube-js/cube/commit/c0466fde9b7a3834159d7ec592362edcab6d9795)) + + +### Features + +* **cubesql:** Fill pg_description table with cube and members descriptions ([#8618](https://github.com/cube-js/cube/issues/8618)) ([2288c18](https://github.com/cube-js/cube/commit/2288c18bf30d1f3a3299b235fe9b4405d2cb7463)) +* **cubesql:** Support join with type coercion ([#8608](https://github.com/cube-js/cube/issues/8608)) ([46b3a36](https://github.com/cube-js/cube/commit/46b3a36936f0f00805144714f0dd87a3c50a5e0a)) + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) diff --git a/README.md b/README.md index a72e798e5a374..96b87e496cf96 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ The CI will build and push the image for the `gorgisa` branch but only build the Locall, build and tag the image with: ```bash -docker build -t us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.79-gorgias -f rust/cubestore/gorgias.Dockerfile rust/cubestore - -docker tag us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.79-gorgias \ - us-central1-docker.pkg.dev/gorgias-revenue-staging/container-images/cubestore:v0.35.79-gorgias -docker tag us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.79-gorgias \ - us-east1-docker.pkg.dev/gorgias-helpdesk-production/container-images/cubestore:v0.35.79-gorgias -docker tag us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.79-gorgias \ - us-central1-docker.pkg.dev/gorgias-revenue-production/container-images/cubestore:v0.35.79-gorgias +docker build -t us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.80-gorgias -f rust/cubestore/gorgias.Dockerfile rust/cubestore + +docker tag us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.80-gorgias \ + us-central1-docker.pkg.dev/gorgias-revenue-staging/container-images/cubestore:v0.35.80-gorgias +docker tag us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.80-gorgias \ + us-east1-docker.pkg.dev/gorgias-helpdesk-production/container-images/cubestore:v0.35.80-gorgias +docker tag us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.80-gorgias \ + us-central1-docker.pkg.dev/gorgias-revenue-production/container-images/cubestore:v0.35.80-gorgias ``` Then push the image to the registry with: @@ -23,10 +23,10 @@ Then push the image to the registry with: gcloud auth configure-docker us-east1-docker.pkg.dev --quiet gcloud auth configure-docker us-central1-docker.pkg.dev --quiet -docker push us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.79-gorgias -docker push us-central1-docker.pkg.dev/gorgias-revenue-staging/container-images/cubestore:v0.35.79-gorgias -docker push us-east1-docker.pkg.dev/gorgias-helpdesk-production/container-images/cubestore:v0.35.79-gorgias -docker push us-central1-docker.pkg.dev/gorgias-revenue-production/container-images/cubestore:v0.35.79-gorgias +docker push us-east1-docker.pkg.dev/gorgias-helpdesk-staging/container-images/cubestore:v0.35.80-gorgias +docker push us-central1-docker.pkg.dev/gorgias-revenue-staging/container-images/cubestore:v0.35.80-gorgias +docker push us-east1-docker.pkg.dev/gorgias-helpdesk-production/container-images/cubestore:v0.35.80-gorgias +docker push us-central1-docker.pkg.dev/gorgias-revenue-production/container-images/cubestore:v0.35.80-gorgias ``` @@ -43,6 +43,13 @@ docker push us-central1-docker.pkg.dev/gorgias-revenue-production/container-imag Cube — Semantic Layer for Data Applications

+

+ + + +

+
+ [Website](https://cube.dev?ref=github-readme) • [Getting Started](https://cube.dev/docs/getting-started?ref=github-readme) • [Docs](https://cube.dev/docs?ref=github-readme) • [Examples](https://cube.dev/docs/examples?ref=github-readme) • [Blog](https://cube.dev/blog?ref=github-readme) • [Slack](https://slack.cube.dev?ref=github-readme) • [Twitter](https://twitter.com/the_cube_dev) [![npm version](https://badge.fury.io/js/%40cubejs-backend%2Fserver.svg)](https://badge.fury.io/js/%40cubejs-backend%2Fserver) diff --git a/docs/pages/guides/style-guide.mdx b/docs/pages/guides/style-guide.mdx index aeb5886c0f995..69ddbd0a6f12b 100644 --- a/docs/pages/guides/style-guide.mdx +++ b/docs/pages/guides/style-guide.mdx @@ -19,8 +19,7 @@ This style guide is intended to be used by: ## Syntax -- Default to [YAML syntax][ref-syntax-model] for data modeling. Use JavaScript - syntax for dynamic data models only. +- Default to [YAML syntax][ref-syntax-model] for data modeling. - Use [snake case][ref-syntax-naming] when using either YAML or JavaScript syntax. - Follow the recommendations on [YAML syntax][self-yaml] and [SQL diff --git a/docs/pages/product/apis-integrations/sql-api/query-format.mdx b/docs/pages/product/apis-integrations/sql-api/query-format.mdx index 14469daaa0450..ee22eba7afc18 100644 --- a/docs/pages/product/apis-integrations/sql-api/query-format.mdx +++ b/docs/pages/product/apis-integrations/sql-api/query-format.mdx @@ -284,7 +284,7 @@ cubes: - name: completed_percentage type: number - sql: "({completed_count} / NULLIF({count}, 0)) * 100.0" + sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))" format: percent ``` diff --git a/docs/pages/product/data-modeling/syntax.mdx b/docs/pages/product/data-modeling/syntax.mdx index 65f3fa91eabaa..ffffadbb46487 100644 --- a/docs/pages/product/data-modeling/syntax.mdx +++ b/docs/pages/product/data-modeling/syntax.mdx @@ -37,7 +37,8 @@ model Cube supports two ways to define data model files: with [YAML][wiki-yaml] or JavaScript syntax. YAML data model files should have the `.yml` extension, -whereas JavaScript data model files should end with `.js`. +whereas JavaScript data model files should end with `.js`. You can mix YAML and +JavaScript files within a single data model. @@ -63,11 +64,15 @@ cubes: -You define the data model statically or build [dynamic data +You can define the data model statically or build [dynamic data models][ref-dynamic-data-models] programmatically. YAML data models use [Jinja and Python][ref-dynamic-data-models-jinja] whereas JavaScript data models use [JavaScript][ref-dynamic-data-models-js]. +It is [recommended][ref-style-guide] to default to YAML syntax because of its +simplicity and readability. However, JavaScript might provide more flexibility +for dynamic data modeling. + ## Naming Common rules apply to names of entities within the data model. All names must: @@ -586,4 +591,5 @@ defining dynamic data models. [wiki-yaml]: https://en.wikipedia.org/wiki/YAML [link-snowflake-listagg]: https://docs.snowflake.com/en/sql-reference/functions/listagg [link-bigquery-stringagg]: https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#string_agg -[link-sql-udf]: https://en.wikipedia.org/wiki/User-defined_function#Databases \ No newline at end of file +[link-sql-udf]: https://en.wikipedia.org/wiki/User-defined_function#Databases +[ref-style-guide]: /guides/style-guide \ No newline at end of file diff --git a/docs/pages/product/getting-started/cloud/create-data-model.mdx b/docs/pages/product/getting-started/cloud/create-data-model.mdx index 440b1a0a29c4a..ea070e534e3fd 100644 --- a/docs/pages/product/getting-started/cloud/create-data-model.mdx +++ b/docs/pages/product/getting-started/cloud/create-data-model.mdx @@ -112,7 +112,7 @@ within the `measures` block. ```yaml - name: completed_percentage type: number - sql: "({completed_count} / NULLIF({count}, 0)) * 100.0" + sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))" format: percent ``` @@ -159,7 +159,7 @@ cubes: - name: completed_percentage type: number - sql: "({completed_count} / NULLIF({count}, 0)) * 100.0" + sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))" format: percent ``` diff --git a/docs/pages/product/getting-started/databricks/create-data-model.mdx b/docs/pages/product/getting-started/databricks/create-data-model.mdx index 502dd0b076592..8c89d9da9d44d 100644 --- a/docs/pages/product/getting-started/databricks/create-data-model.mdx +++ b/docs/pages/product/getting-started/databricks/create-data-model.mdx @@ -107,7 +107,7 @@ within the `measures` block. ```yaml - name: completed_percentage type: number - sql: "({completed_count} / NULLIF({count}, 0)) * 100.0" + sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))" format: percent ``` @@ -154,7 +154,7 @@ cubes: - name: completed_percentage type: number - sql: "({completed_count} / NULLIF({count}, 0)) * 100.0" + sql: "(100.0 * {CUBE.completed_count} / NULLIF({CUBE.count}, 0))" format: percent ``` diff --git a/docs/theme.config.tsx b/docs/theme.config.tsx index 837ca242629e2..c0b9ff483de00 100644 --- a/docs/theme.config.tsx +++ b/docs/theme.config.tsx @@ -106,6 +106,16 @@ const config: DocsThemeConfig = { ) + }, + toc: { + extraContent: ( +
+
+ + + +
+ ) } }; diff --git a/lerna.json b/lerna.json index d0b76af684c9d..369b30da80992 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.35.79", + "version": "0.35.80", "npmClient": "yarn", "useWorkspaces": true, "packages": [ diff --git a/packages/cubejs-api-gateway/CHANGELOG.md b/packages/cubejs-api-gateway/CHANGELOG.md index 69ac919655d59..7feee16c649c7 100644 --- a/packages/cubejs-api-gateway/CHANGELOG.md +++ b/packages/cubejs-api-gateway/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/api-gateway + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) diff --git a/packages/cubejs-api-gateway/package.json b/packages/cubejs-api-gateway/package.json index 503d20fea508b..b06c058cc6ffc 100644 --- a/packages/cubejs-api-gateway/package.json +++ b/packages/cubejs-api-gateway/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/api-gateway", "description": "Cube.js API Gateway", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -27,7 +27,7 @@ "dist/src/*" ], "dependencies": { - "@cubejs-backend/native": "^0.35.79", + "@cubejs-backend/native": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@ungap/structured-clone": "^0.3.4", "body-parser": "^1.19.0", diff --git a/packages/cubejs-athena-driver/CHANGELOG.md b/packages/cubejs-athena-driver/CHANGELOG.md index 26ab5e6b3217c..ed85083cd3c1c 100644 --- a/packages/cubejs-athena-driver/CHANGELOG.md +++ b/packages/cubejs-athena-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/athena-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/athena-driver diff --git a/packages/cubejs-athena-driver/package.json b/packages/cubejs-athena-driver/package.json index 7d01cf0cad96a..58df79e1265fc 100644 --- a/packages/cubejs-athena-driver/package.json +++ b/packages/cubejs-athena-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/athena-driver", "description": "Cube.js Athena database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -37,7 +37,7 @@ }, "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@types/ramda": "^0.27.40", "typescript": "~5.2.2" }, diff --git a/packages/cubejs-backend-native/CHANGELOG.md b/packages/cubejs-backend-native/CHANGELOG.md index 7c9ef9fb7d169..274b72931988d 100644 --- a/packages/cubejs-backend-native/CHANGELOG.md +++ b/packages/cubejs-backend-native/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + + +### Features + +* **cubesql:** Support join with type coercion ([#8608](https://github.com/cube-js/cube/issues/8608)) ([46b3a36](https://github.com/cube-js/cube/commit/46b3a36936f0f00805144714f0dd87a3c50a5e0a)) + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) diff --git a/packages/cubejs-backend-native/Cargo.lock b/packages/cubejs-backend-native/Cargo.lock index d6c4375c21deb..f3b911b4b5687 100644 --- a/packages/cubejs-backend-native/Cargo.lock +++ b/packages/cubejs-backend-native/Cargo.lock @@ -681,7 +681,7 @@ dependencies = [ [[package]] name = "cube-ext" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "chrono", @@ -788,7 +788,6 @@ dependencies = [ "futures-util", "hashbrown 0.14.3", "itertools", - "lazy_static", "log", "lru", "minijinja", @@ -839,7 +838,7 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "datafusion" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -872,7 +871,7 @@ dependencies = [ [[package]] name = "datafusion-common" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "ordered-float 2.10.1", @@ -883,7 +882,7 @@ dependencies = [ [[package]] name = "datafusion-data-access" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "async-trait", "chrono", @@ -896,7 +895,7 @@ dependencies = [ [[package]] name = "datafusion-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -907,7 +906,7 @@ dependencies = [ [[package]] name = "datafusion-physical-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", diff --git a/packages/cubejs-backend-native/package.json b/packages/cubejs-backend-native/package.json index 13462994322a3..517d23cb0b5a9 100644 --- a/packages/cubejs-backend-native/package.json +++ b/packages/cubejs-backend-native/package.json @@ -1,6 +1,6 @@ { "name": "@cubejs-backend/native", - "version": "0.35.79", + "version": "0.35.80", "author": "Cube Dev, Inc.", "description": "Native module for Cube.js (binding to Rust codebase)", "main": "dist/js/index.js", @@ -43,7 +43,7 @@ "uuid": "^8.3.2" }, "dependencies": { - "@cubejs-backend/cubesql": "^0.35.79", + "@cubejs-backend/cubesql": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@cubejs-infra/post-installer": "^0.0.7" }, diff --git a/packages/cubejs-bigquery-driver/CHANGELOG.md b/packages/cubejs-bigquery-driver/CHANGELOG.md index de4493c882a65..c6afd088ecb1e 100644 --- a/packages/cubejs-bigquery-driver/CHANGELOG.md +++ b/packages/cubejs-bigquery-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/bigquery-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/bigquery-driver diff --git a/packages/cubejs-bigquery-driver/package.json b/packages/cubejs-bigquery-driver/package.json index 3a970a7b48da9..8a66c1be371aa 100644 --- a/packages/cubejs-bigquery-driver/package.json +++ b/packages/cubejs-bigquery-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/bigquery-driver", "description": "Cube.js BigQuery database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -36,7 +36,7 @@ "ramda": "^0.27.2" }, "devDependencies": { - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@types/big.js": "^6.2.2", "@types/dedent": "^0.7.0", "@types/jest": "^27", diff --git a/packages/cubejs-cli/CHANGELOG.md b/packages/cubejs-cli/CHANGELOG.md index 74041a952226f..2ac4f7cfc3eb8 100644 --- a/packages/cubejs-cli/CHANGELOG.md +++ b/packages/cubejs-cli/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package cubejs-cli + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package cubejs-cli diff --git a/packages/cubejs-cli/package.json b/packages/cubejs-cli/package.json index 19bcab23fb737..3bd4b21b1e76e 100644 --- a/packages/cubejs-cli/package.json +++ b/packages/cubejs-cli/package.json @@ -2,7 +2,7 @@ "name": "cubejs-cli", "description": "Cube.js Command Line Interface", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -31,7 +31,7 @@ ], "dependencies": { "@cubejs-backend/dotenv": "^9.0.2", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "chalk": "^2.4.2", "cli-progress": "^3.10", @@ -50,7 +50,7 @@ }, "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/server": "^0.35.79", + "@cubejs-backend/server": "^0.35.80", "@oclif/command": "^1.8.0", "@types/cli-progress": "^3.8.0", "@types/cross-spawn": "^6.0.2", diff --git a/packages/cubejs-clickhouse-driver/CHANGELOG.md b/packages/cubejs-clickhouse-driver/CHANGELOG.md index 4ec7a5b286f11..3c08631c82f2b 100644 --- a/packages/cubejs-clickhouse-driver/CHANGELOG.md +++ b/packages/cubejs-clickhouse-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/clickhouse-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/clickhouse-driver diff --git a/packages/cubejs-clickhouse-driver/package.json b/packages/cubejs-clickhouse-driver/package.json index 2df31ed99e9a7..3f87cac36e811 100644 --- a/packages/cubejs-clickhouse-driver/package.json +++ b/packages/cubejs-clickhouse-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/clickhouse-driver", "description": "Cube.js ClickHouse database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -38,7 +38,7 @@ "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@types/jest": "^27", "jest": "27", "typescript": "~5.2.2" diff --git a/packages/cubejs-crate-driver/CHANGELOG.md b/packages/cubejs-crate-driver/CHANGELOG.md index 6eff588fda812..2c5575b987aa6 100644 --- a/packages/cubejs-crate-driver/CHANGELOG.md +++ b/packages/cubejs-crate-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/crate-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/crate-driver diff --git a/packages/cubejs-crate-driver/package.json b/packages/cubejs-crate-driver/package.json index a37e10f89d2ed..31784164d9d1f 100644 --- a/packages/cubejs-crate-driver/package.json +++ b/packages/cubejs-crate-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/crate-driver", "description": "Cube.js Crate database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -28,14 +28,14 @@ "lint:fix": "eslint --fix src/* --ext .ts" }, "dependencies": { - "@cubejs-backend/postgres-driver": "^0.35.79", + "@cubejs-backend/postgres-driver": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "pg": "^8.7.1" }, "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "testcontainers": "^10.10.4", "typescript": "~5.2.2" }, diff --git a/packages/cubejs-databricks-jdbc-driver/CHANGELOG.md b/packages/cubejs-databricks-jdbc-driver/CHANGELOG.md index 1591c48b9acbc..bc3243302318f 100644 --- a/packages/cubejs-databricks-jdbc-driver/CHANGELOG.md +++ b/packages/cubejs-databricks-jdbc-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/databricks-jdbc-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) diff --git a/packages/cubejs-databricks-jdbc-driver/package.json b/packages/cubejs-databricks-jdbc-driver/package.json index dd56a6b414289..d8c128b9ff36e 100644 --- a/packages/cubejs-databricks-jdbc-driver/package.json +++ b/packages/cubejs-databricks-jdbc-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/databricks-jdbc-driver", "description": "Cube.js Databricks database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "license": "Apache-2.0", "repository": { "type": "git", @@ -33,7 +33,7 @@ "@azure/storage-blob": "^12.9.0", "@cubejs-backend/base-driver": "^0.35.67", "@cubejs-backend/jdbc-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "node-fetch": "^2.6.1", "ramda": "^0.27.2", diff --git a/packages/cubejs-dbt-schema-extension/CHANGELOG.md b/packages/cubejs-dbt-schema-extension/CHANGELOG.md index b423caab746c8..0c34376e825f8 100644 --- a/packages/cubejs-dbt-schema-extension/CHANGELOG.md +++ b/packages/cubejs-dbt-schema-extension/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/dbt-schema-extension + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/dbt-schema-extension diff --git a/packages/cubejs-dbt-schema-extension/package.json b/packages/cubejs-dbt-schema-extension/package.json index 04ea86c55770c..55a3df4a78453 100644 --- a/packages/cubejs-dbt-schema-extension/package.json +++ b/packages/cubejs-dbt-schema-extension/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/dbt-schema-extension", "description": "Cube.js dbt Schema Extension", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -25,14 +25,14 @@ "lint:fix": "eslint --fix src/* --ext .ts,.js" }, "dependencies": { - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "fs-extra": "^9.1.0", "inflection": "^1.12.0", "node-fetch": "^2.6.1" }, "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing": "^0.35.79", + "@cubejs-backend/testing": "^0.35.80", "@types/generic-pool": "^3.1.9", "@types/jest": "^27", "jest": "^27", diff --git a/packages/cubejs-docker/CHANGELOG.md b/packages/cubejs-docker/CHANGELOG.md index b33aba18c2b36..fb78cb93db336 100644 --- a/packages/cubejs-docker/CHANGELOG.md +++ b/packages/cubejs-docker/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/docker + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/docker diff --git a/packages/cubejs-docker/package.json b/packages/cubejs-docker/package.json index dc575b609ea12..e13bb865f3c7d 100644 --- a/packages/cubejs-docker/package.json +++ b/packages/cubejs-docker/package.json @@ -1,6 +1,6 @@ { "name": "@cubejs-backend/docker", - "version": "0.35.79", + "version": "0.35.80", "description": "Cube.js In Docker (virtual package)", "author": "Cube Dev, Inc.", "license": "Apache-2.0", @@ -9,33 +9,33 @@ "node": "^14.0.0 || ^16.0.0 || >=17.0.0" }, "dependencies": { - "@cubejs-backend/athena-driver": "^0.35.79", - "@cubejs-backend/bigquery-driver": "^0.35.79", - "@cubejs-backend/clickhouse-driver": "^0.35.79", - "@cubejs-backend/crate-driver": "^0.35.79", - "@cubejs-backend/databricks-jdbc-driver": "^0.35.79", - "@cubejs-backend/dbt-schema-extension": "^0.35.79", - "@cubejs-backend/dremio-driver": "^0.35.79", - "@cubejs-backend/druid-driver": "^0.35.79", - "@cubejs-backend/duckdb-driver": "^0.35.79", + "@cubejs-backend/athena-driver": "^0.35.80", + "@cubejs-backend/bigquery-driver": "^0.35.80", + "@cubejs-backend/clickhouse-driver": "^0.35.80", + "@cubejs-backend/crate-driver": "^0.35.80", + "@cubejs-backend/databricks-jdbc-driver": "^0.35.80", + "@cubejs-backend/dbt-schema-extension": "^0.35.80", + "@cubejs-backend/dremio-driver": "^0.35.80", + "@cubejs-backend/druid-driver": "^0.35.80", + "@cubejs-backend/duckdb-driver": "^0.35.80", "@cubejs-backend/elasticsearch-driver": "^0.35.67", - "@cubejs-backend/firebolt-driver": "^0.35.79", + "@cubejs-backend/firebolt-driver": "^0.35.80", "@cubejs-backend/hive-driver": "^0.35.67", - "@cubejs-backend/ksql-driver": "^0.35.79", - "@cubejs-backend/materialize-driver": "^0.35.79", + "@cubejs-backend/ksql-driver": "^0.35.80", + "@cubejs-backend/materialize-driver": "^0.35.80", "@cubejs-backend/mongobi-driver": "^0.35.67", "@cubejs-backend/mssql-driver": "^0.35.67", - "@cubejs-backend/mysql-driver": "^0.35.79", + "@cubejs-backend/mysql-driver": "^0.35.80", "@cubejs-backend/oracle-driver": "^0.35.67", - "@cubejs-backend/postgres-driver": "^0.35.79", + "@cubejs-backend/postgres-driver": "^0.35.80", "@cubejs-backend/prestodb-driver": "^0.35.67", - "@cubejs-backend/questdb-driver": "^0.35.79", - "@cubejs-backend/redshift-driver": "^0.35.79", - "@cubejs-backend/server": "^0.35.79", + "@cubejs-backend/questdb-driver": "^0.35.80", + "@cubejs-backend/redshift-driver": "^0.35.80", + "@cubejs-backend/server": "^0.35.80", "@cubejs-backend/snowflake-driver": "^0.35.67", "@cubejs-backend/sqlite-driver": "^0.35.67", - "@cubejs-backend/trino-driver": "^0.35.79", - "cubejs-cli": "^0.35.79", + "@cubejs-backend/trino-driver": "^0.35.80", + "cubejs-cli": "^0.35.80", "typescript": "~5.2.2" }, "resolutions": { diff --git a/packages/cubejs-dremio-driver/CHANGELOG.md b/packages/cubejs-dremio-driver/CHANGELOG.md index 9b13d66090b7a..b346f641447cb 100644 --- a/packages/cubejs-dremio-driver/CHANGELOG.md +++ b/packages/cubejs-dremio-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/dremio-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/dremio-driver diff --git a/packages/cubejs-dremio-driver/package.json b/packages/cubejs-dremio-driver/package.json index 81507ebec476f..1f37cb653be7d 100644 --- a/packages/cubejs-dremio-driver/package.json +++ b/packages/cubejs-dremio-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/dremio-driver", "description": "Cube.js Dremio driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -18,7 +18,7 @@ }, "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "axios": "^0.21.1", "moment-timezone": "^0.5.31", diff --git a/packages/cubejs-druid-driver/CHANGELOG.md b/packages/cubejs-druid-driver/CHANGELOG.md index bfd237b5f65af..ddcd4c08f5519 100644 --- a/packages/cubejs-druid-driver/CHANGELOG.md +++ b/packages/cubejs-druid-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/druid-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/druid-driver diff --git a/packages/cubejs-druid-driver/package.json b/packages/cubejs-druid-driver/package.json index a99c69e61e858..50a62a1492992 100644 --- a/packages/cubejs-druid-driver/package.json +++ b/packages/cubejs-druid-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/druid-driver", "description": "Cube.js Druid database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "license": "Apache-2.0", "repository": { "type": "git", @@ -29,7 +29,7 @@ ], "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "axios": "^0.21.1", "moment-timezone": "^0.5.31" diff --git a/packages/cubejs-duckdb-driver/CHANGELOG.md b/packages/cubejs-duckdb-driver/CHANGELOG.md index 25f4fad80a61d..1956d2a85cb8d 100644 --- a/packages/cubejs-duckdb-driver/CHANGELOG.md +++ b/packages/cubejs-duckdb-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/duckdb-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/duckdb-driver diff --git a/packages/cubejs-duckdb-driver/package.json b/packages/cubejs-duckdb-driver/package.json index bfc22c9cbe401..0d8491a5ac02b 100644 --- a/packages/cubejs-duckdb-driver/package.json +++ b/packages/cubejs-duckdb-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/duckdb-driver", "description": "Cube DuckDB database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -28,14 +28,14 @@ }, "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "duckdb": "^1.0.0" }, "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@types/jest": "^27", "@types/node": "^16", "jest": "^27", diff --git a/packages/cubejs-firebolt-driver/CHANGELOG.md b/packages/cubejs-firebolt-driver/CHANGELOG.md index e2218d3ddd7af..0ada0959c2ee3 100644 --- a/packages/cubejs-firebolt-driver/CHANGELOG.md +++ b/packages/cubejs-firebolt-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/firebolt-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/firebolt-driver diff --git a/packages/cubejs-firebolt-driver/package.json b/packages/cubejs-firebolt-driver/package.json index 595f54fb95c77..dd09e7f692052 100644 --- a/packages/cubejs-firebolt-driver/package.json +++ b/packages/cubejs-firebolt-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/firebolt-driver", "description": "Cube.js Firebolt database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -29,14 +29,14 @@ }, "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "firebolt-sdk": "^1.2.0" }, "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "typescript": "~5.2.2" }, "publishConfig": { diff --git a/packages/cubejs-ksql-driver/CHANGELOG.md b/packages/cubejs-ksql-driver/CHANGELOG.md index 5674a1e75b476..2e878e5625468 100644 --- a/packages/cubejs-ksql-driver/CHANGELOG.md +++ b/packages/cubejs-ksql-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/ksql-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/ksql-driver diff --git a/packages/cubejs-ksql-driver/package.json b/packages/cubejs-ksql-driver/package.json index 72a3b4e477fc4..064d8004e11f9 100644 --- a/packages/cubejs-ksql-driver/package.json +++ b/packages/cubejs-ksql-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/ksql-driver", "description": "Cube.js ksql database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -26,7 +26,7 @@ }, "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "async-mutex": "0.3.2", "axios": "^0.21.1", diff --git a/packages/cubejs-materialize-driver/CHANGELOG.md b/packages/cubejs-materialize-driver/CHANGELOG.md index 3fbdc3a260bc6..b9bf68d0dd5dd 100644 --- a/packages/cubejs-materialize-driver/CHANGELOG.md +++ b/packages/cubejs-materialize-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/materialize-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/materialize-driver diff --git a/packages/cubejs-materialize-driver/package.json b/packages/cubejs-materialize-driver/package.json index c94a92bb8303b..abbe3f9c8aea0 100644 --- a/packages/cubejs-materialize-driver/package.json +++ b/packages/cubejs-materialize-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/materialize-driver", "description": "Cube.js Materialize database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -28,7 +28,7 @@ }, "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/postgres-driver": "^0.35.79", + "@cubejs-backend/postgres-driver": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@types/pg": "^8.6.0", "pg": "^8.6.0", @@ -38,7 +38,7 @@ "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing": "^0.35.79", + "@cubejs-backend/testing": "^0.35.80", "typescript": "~5.2.2" }, "publishConfig": { diff --git a/packages/cubejs-mysql-driver/CHANGELOG.md b/packages/cubejs-mysql-driver/CHANGELOG.md index 8ad803649b64b..600455fa747a1 100644 --- a/packages/cubejs-mysql-driver/CHANGELOG.md +++ b/packages/cubejs-mysql-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/mysql-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/mysql-driver diff --git a/packages/cubejs-mysql-driver/package.json b/packages/cubejs-mysql-driver/package.json index eb6b465ae64a4..6bc4366234726 100644 --- a/packages/cubejs-mysql-driver/package.json +++ b/packages/cubejs-mysql-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/mysql-driver", "description": "Cube.js Mysql database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -35,7 +35,7 @@ }, "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@types/generic-pool": "^3.1.9", "@types/jest": "^27", "jest": "^27", diff --git a/packages/cubejs-postgres-driver/CHANGELOG.md b/packages/cubejs-postgres-driver/CHANGELOG.md index edda8532676ad..9e5819aab51c9 100644 --- a/packages/cubejs-postgres-driver/CHANGELOG.md +++ b/packages/cubejs-postgres-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/postgres-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/postgres-driver diff --git a/packages/cubejs-postgres-driver/package.json b/packages/cubejs-postgres-driver/package.json index e6bd93cf7b632..051cec7c6aa14 100644 --- a/packages/cubejs-postgres-driver/package.json +++ b/packages/cubejs-postgres-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/postgres-driver", "description": "Cube.js Postgres database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -38,7 +38,7 @@ "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "testcontainers": "^10.10.4", "typescript": "~5.2.2" }, diff --git a/packages/cubejs-questdb-driver/CHANGELOG.md b/packages/cubejs-questdb-driver/CHANGELOG.md index 1d1549136d208..443686ac992db 100644 --- a/packages/cubejs-questdb-driver/CHANGELOG.md +++ b/packages/cubejs-questdb-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/questdb-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/questdb-driver diff --git a/packages/cubejs-questdb-driver/package.json b/packages/cubejs-questdb-driver/package.json index 93d4b5ce6f70d..71d442cbb98fb 100644 --- a/packages/cubejs-questdb-driver/package.json +++ b/packages/cubejs-questdb-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/questdb-driver", "description": "Cube.js QuestDB database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -28,7 +28,7 @@ }, "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@types/pg": "^8.6.0", "moment": "^2.24.0", @@ -38,7 +38,7 @@ "license": "Apache-2.0", "devDependencies": { "@cubejs-backend/linter": "^0.35.0", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "testcontainers": "^10.10.4", "typescript": "~5.2.2" }, diff --git a/packages/cubejs-redshift-driver/CHANGELOG.md b/packages/cubejs-redshift-driver/CHANGELOG.md index 1550450f58729..99689d63de4f8 100644 --- a/packages/cubejs-redshift-driver/CHANGELOG.md +++ b/packages/cubejs-redshift-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/redshift-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/redshift-driver diff --git a/packages/cubejs-redshift-driver/package.json b/packages/cubejs-redshift-driver/package.json index 485073b704d8e..78bbf34f8e8e5 100644 --- a/packages/cubejs-redshift-driver/package.json +++ b/packages/cubejs-redshift-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/redshift-driver", "description": "Cube.js Redshift database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -28,7 +28,7 @@ "@aws-sdk/client-s3": "^3.17.0", "@aws-sdk/s3-request-presigner": "^3.17.0", "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/postgres-driver": "^0.35.79", + "@cubejs-backend/postgres-driver": "^0.35.80", "@cubejs-backend/shared": "^0.35.67" }, "license": "Apache-2.0", diff --git a/packages/cubejs-schema-compiler/CHANGELOG.md b/packages/cubejs-schema-compiler/CHANGELOG.md index 8d37163770d07..a2daa39a1130e 100644 --- a/packages/cubejs-schema-compiler/CHANGELOG.md +++ b/packages/cubejs-schema-compiler/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + + +### Bug Fixes + +* **schema-compiler:** propagate FILTER_PARAMS from view to inner cube's SELECT ([#8466](https://github.com/cube-js/cube/issues/8466)) ([c0466fd](https://github.com/cube-js/cube/commit/c0466fde9b7a3834159d7ec592362edcab6d9795)) + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) diff --git a/packages/cubejs-schema-compiler/package.json b/packages/cubejs-schema-compiler/package.json index 02cc4b08ac373..9f168f6357473 100644 --- a/packages/cubejs-schema-compiler/package.json +++ b/packages/cubejs-schema-compiler/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/schema-compiler", "description": "Cube schema compiler", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -40,7 +40,7 @@ "@babel/standalone": "^7.24", "@babel/traverse": "^7.24", "@babel/types": "^7.24", - "@cubejs-backend/native": "^0.35.79", + "@cubejs-backend/native": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "antlr4ts": "0.5.0-alpha.4", "camelcase": "^6.2.0", diff --git a/packages/cubejs-schema-compiler/src/adapter/BaseGroupFilter.ts b/packages/cubejs-schema-compiler/src/adapter/BaseGroupFilter.ts index 9dd2bc613a8a4..49f17519739aa 100644 --- a/packages/cubejs-schema-compiler/src/adapter/BaseGroupFilter.ts +++ b/packages/cubejs-schema-compiler/src/adapter/BaseGroupFilter.ts @@ -1,5 +1,3 @@ -import R from 'ramda'; - export class BaseGroupFilter { protected readonly values: any; @@ -31,7 +29,7 @@ export class BaseGroupFilter { return null; } return `(${sql})`; - }).filter(R.identity).join(` ${this.operator.toUpperCase()} `); + }).filter(x => x).join(` ${this.operator.toUpperCase()} `); if (!r.length) { return null; diff --git a/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js b/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js index affda97b5fece..07ad2fdc528ff 100644 --- a/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js +++ b/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js @@ -2180,15 +2180,16 @@ export class BaseQuery { const memberPathArray = [cubeName, name]; const memberPath = this.cubeEvaluator.pathFromArray(memberPathArray); let type = memberExpressionType; - if (!type && this.cubeEvaluator.isMeasure(memberPathArray)) { - type = 'measure'; - } - if (!type && this.cubeEvaluator.isDimension(memberPathArray)) { - type = 'dimension'; - } - if (!type && this.cubeEvaluator.isSegment(memberPathArray)) { - type = 'segment'; + if (!type) { + if (this.cubeEvaluator.isMeasure(memberPathArray)) { + type = 'measure'; + } else if (this.cubeEvaluator.isDimension(memberPathArray)) { + type = 'dimension'; + } else if (this.cubeEvaluator.isSegment(memberPathArray)) { + type = 'segment'; + } } + const parentMember = this.safeEvaluateSymbolContext().currentMember; if (this.safeEvaluateSymbolContext().memberChildren && parentMember) { this.safeEvaluateSymbolContext().memberChildren[parentMember] = this.safeEvaluateSymbolContext().memberChildren[parentMember] || []; @@ -2358,7 +2359,7 @@ export class BaseQuery { /** * Evaluate escaped SQL-alias for cube or cube's property - * (measure, dimention). + * (measure, dimension). * @param {string} cubeName * @returns string */ @@ -3529,25 +3530,29 @@ export class BaseQuery { static extractFilterMembers(filter) { if (filter.operator === 'and' || filter.operator === 'or') { return filter.values.map(f => BaseQuery.extractFilterMembers(f)).reduce((a, b) => ((a && b) ? { ...a, ...b } : null), {}); - } else if (filter.measure || filter.dimension) { + } else if (filter.measure) { + return { + [filter.measure]: true + }; + } else if (filter.dimension) { return { - [filter.measure || filter.dimension]: true + [filter.dimension]: true }; } else { return null; } } - static findAndSubTreeForFilterGroup(filter, groupMembers, newGroupFilter) { + static findAndSubTreeForFilterGroup(filter, groupMembers, newGroupFilter, aliases) { if ((filter.operator === 'and' || filter.operator === 'or') && !filter.values?.length) { return null; } const filterMembers = BaseQuery.extractFilterMembers(filter); - if (filterMembers && Object.keys(filterMembers).every(m => groupMembers.indexOf(m) !== -1)) { + if (filterMembers && Object.keys(filterMembers).every(m => (groupMembers.indexOf(m) !== -1 || aliases.indexOf(m) !== -1))) { return filter; } if (filter.operator === 'and') { - const result = filter.values.map(f => BaseQuery.findAndSubTreeForFilterGroup(f, groupMembers, newGroupFilter)).filter(f => !!f); + const result = filter.values.map(f => BaseQuery.findAndSubTreeForFilterGroup(f, groupMembers, newGroupFilter, aliases)).filter(f => !!f); if (!result.length) { return null; } @@ -3572,21 +3577,30 @@ export class BaseQuery { ); } - static renderFilterParams(filter, filterParamArgs, allocateParam, newGroupFilter) { + static renderFilterParams(filter, filterParamArgs, allocateParam, newGroupFilter, aliases) { if (!filter) { return '1 = 1'; } if (filter.operator === 'and' || filter.operator === 'or') { const values = filter.values - .map(f => BaseQuery.renderFilterParams(f, filterParamArgs, allocateParam, newGroupFilter)) + .map(f => BaseQuery.renderFilterParams(f, filterParamArgs, allocateParam, newGroupFilter, aliases)) .map(v => ({ filterToWhere: () => v })); return newGroupFilter({ operator: filter.operator, values }).filterToWhere(); } - const filterParams = filter && filter.filterParams(); - const filterParamArg = filterParamArgs.filter(p => p.__member() === filter.measure || p.__member() === filter.dimension)[0]; + const filterParams = filter.filterParams(); + const filterParamArg = filterParamArgs.filter(p => { + const member = p.__member(); + return member === filter.measure || + member === filter.dimension || + (aliases[member] && ( + aliases[member] === filter.measure || + aliases[member] === filter.dimension + )); + })[0]; + if (!filterParamArg) { throw new Error(`FILTER_PARAMS arg not found for ${filter.measure || filter.dimension}`); } @@ -3619,15 +3633,25 @@ export class BaseQuery { return f.__member(); }); - const filter = BaseQuery.findAndSubTreeForFilterGroup(newGroupFilter({ operator: 'and', values: allFilters }), groupMembers, newGroupFilter); + const aliases = allFilters ? + allFilters + .map(v => (v.query ? v.query.allBackAliasMembersExceptSegments() : {})) + .reduce((a, b) => ({ ...a, ...b }), {}) + : {}; + const filter = BaseQuery.findAndSubTreeForFilterGroup( + newGroupFilter({ operator: 'and', values: allFilters }), + groupMembers, + newGroupFilter, + Object.values(aliases) + ); - return `(${BaseQuery.renderFilterParams(filter, filterParamArgs, allocateParam, newGroupFilter)})`; + return `(${BaseQuery.renderFilterParams(filter, filterParamArgs, allocateParam, newGroupFilter, aliases)})`; }; } static filterProxyFromAllFilters(allFilters, cubeEvaluator, allocateParam, newGroupFilter) { return new Proxy({}, { - get: (target, name) => { + get: (_target, name) => { if (name === '_objectWithResolvedProperties') { return true; } @@ -3644,12 +3668,28 @@ export class BaseQuery { return cubeEvaluator.pathFromArray([cubeNameObj.cube, propertyName]); }, toString() { + // Segments should be excluded because they are evaluated separately in cubeReferenceProxy + // In other case this falls into the recursive loop/stack exceeded caused by: + // collectFrom() -> traverseSymbol() -> evaluateSymbolSql() -> + // evaluateSql() -> resolveSymbolsCall() -> cubeReferenceProxy->toString() -> + // evaluateSymbolSql() -> evaluateSql()... -> and got here again + const aliases = allFilters ? + allFilters + .map(v => (v.query ? v.query.allBackAliasMembersExceptSegments() : {})) + .reduce((a, b) => ({ ...a, ...b }), {}) + : {}; + // Filtering aliases that somehow relate to this cube + const filteredAliases = Object.entries(aliases) + .filter(([key, value]) => key.startsWith(cubeNameObj.cube) || value.startsWith(cubeNameObj.cube)) + .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}); const filter = BaseQuery.findAndSubTreeForFilterGroup( newGroupFilter({ operator: 'and', values: allFilters }), [cubeEvaluator.pathFromArray([cubeNameObj.cube, propertyName])], - newGroupFilter + newGroupFilter, + Object.values(filteredAliases) ); - return `(${BaseQuery.renderFilterParams(filter, [this], allocateParam, newGroupFilter)})`; + + return `(${BaseQuery.renderFilterParams(filter, [this], allocateParam, newGroupFilter, aliases)})`; } }) }) @@ -3657,4 +3697,46 @@ export class BaseQuery { } }); } + + flattenAllMembers(excludeSegments = false) { + return R.flatten( + this.measures + .concat(this.dimensions) + .concat(excludeSegments ? [] : this.segments) + .concat(this.filters) + .concat(this.measureFilters) + .concat(this.timeDimensions) + .map(m => m.getMembers()), + ); + } + + allBackAliasMembersExceptSegments() { + return this.backAliasMembers(this.flattenAllMembers(true)); + } + + allBackAliasMembers() { + return this.backAliasMembers(this.flattenAllMembers()); + } + + backAliasMembers(members) { + const query = this; + return members.map( + member => { + const collectedMembers = query + .collectFrom([member], query.collectMemberNamesFor.bind(query), 'collectMemberNamesFor'); + const memberPath = member.expressionPath(); + let nonAliasSeen = false; + return collectedMembers + .filter(d => { + if (!query.cubeEvaluator.byPathAnyType(d).aliasMember) { + nonAliasSeen = true; + } + return !nonAliasSeen; + }) + .map(d => ( + { [query.cubeEvaluator.byPathAnyType(d).aliasMember]: memberPath } + )).reduce((a, b) => ({ ...a, ...b }), {}); + } + ).reduce((a, b) => ({ ...a, ...b }), {}); + } } diff --git a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js index bded2c1e0365d..9edc16c70ca53 100644 --- a/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js +++ b/packages/cubejs-schema-compiler/src/adapter/PreAggregations.js @@ -157,7 +157,7 @@ export class PreAggregations { const queryForSqlEvaluation = this.query.preAggregationQueryForSqlEvaluation(cube, preAggregation); const partitionInvalidateKeyQueries = queryForSqlEvaluation.partitionInvalidateKeyQueries && queryForSqlEvaluation.partitionInvalidateKeyQueries(cube, preAggregation); - const allBackAliasMembers = PreAggregations.allBackAliasMembers(this.query); + const allBackAliasMembers = this.query.allBackAliasMembers(); const matchedTimeDimension = preAggregation.partitionGranularity && !this.hasCumulativeMeasures && this.query.timeDimensions.find(td => { @@ -292,7 +292,7 @@ export class PreAggregations { static transformQueryToCanUseForm(query) { const flattenDimensionMembers = this.flattenDimensionMembers(query); const sortedDimensions = this.squashDimensions(query, flattenDimensionMembers); - const allBackAliasMembers = this.allBackAliasMembers(query); + const allBackAliasMembers = query.allBackAliasMembers(); const measures = query.measures.concat(query.measureFilters); const measurePaths = R.uniq(this.flattenMembers(measures).map(m => m.expressionPath())); const collectLeafMeasures = query.collectLeafMeasures.bind(query); @@ -426,31 +426,6 @@ export class PreAggregations { ); } - static backAliasMembers(query, members) { - return members.map( - member => { - const collectedMembers = query - .collectFrom([member], query.collectMemberNamesFor.bind(query), 'collectMemberNamesFor'); - const memberPath = member.expressionPath(); - let nonAliasSeen = false; - return collectedMembers - .filter(d => { - if (!query.cubeEvaluator.byPathAnyType(d).aliasMember) { - nonAliasSeen = true; - } - return !nonAliasSeen; - }) - .map(d => ( - { [query.cubeEvaluator.byPathAnyType(d).aliasMember]: memberPath } - )).reduce((a, b) => ({ ...a, ...b }), {}); - } - ).reduce((a, b) => ({ ...a, ...b }), {}); - } - - static allBackAliasMembers(query) { - return this.backAliasMembers(query, this.flattenAllMembers(query)); - } - static sortTimeDimensionsWithRollupGranularity(timeDimensions) { return timeDimensions && R.sortBy( R.prop(0), @@ -750,18 +725,6 @@ export class PreAggregations { ); } - static flattenAllMembers(query) { - return R.flatten( - query.measures - .concat(query.dimensions) - .concat(query.segments) - .concat(query.filters) - .concat(query.measureFilters) - .concat(query.timeDimensions) - .map(m => m.getMembers()), - ); - } - // eslint-disable-next-line no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars getCubeLattice(cube, preAggregationName, preAggregation) { diff --git a/packages/cubejs-schema-compiler/test/integration/postgres/yaml-compiler.test.ts b/packages/cubejs-schema-compiler/test/integration/postgres/yaml-compiler.test.ts index 74fd630b1379f..bd829ce6ff840 100644 --- a/packages/cubejs-schema-compiler/test/integration/postgres/yaml-compiler.test.ts +++ b/packages/cubejs-schema-compiler/test/integration/postgres/yaml-compiler.test.ts @@ -10,7 +10,7 @@ describe('YAMLCompiler', () => { cubes: - name: ActiveUsers sql: "SELECT 1 as user_id, '2022-01-01' as timestamp" - + measures: - name: weeklyActive sql: "{CUBE}.user_id" @@ -62,7 +62,7 @@ cubes: cubes: - name: ActiveUsers sql: "SELECT 1 as user_id, '2022-01-01' as timestamp" - + measures: - name: weeklyActive sql: "{CUBE}.user_id" @@ -83,7 +83,7 @@ cubes: cubes: - name: ActiveUsers sql: "SELECT 1 as user_id, '2022-01-01'::timestamptz as timestamp" - + measures: - name: withFilter sql: "{CUBE}.user_id" @@ -126,7 +126,7 @@ cubes: cubes: - name: ActiveUsers sql: "SELECT 1 as user_id, '2022-01-01' as timestamp" - + measures: - name: weeklyActive sql: "{user_id}" @@ -181,7 +181,7 @@ cubes: cubes: - name: ActiveUsers sql: "SELECT 1 as user_id, '2022-01-01' as timestamp" - + measures: - name: weeklyActive sql: "{CUBE.user_id}" @@ -197,7 +197,7 @@ cubes: - name: time sql: "{CUBE}.timestamp" type: time - + preAggregations: - name: main measures: @@ -248,7 +248,7 @@ cubes: cubes: - name: active_users sql: "SELECT * FROM (SELECT 1 as user_id, '2022-01-01'::timestamptz as \\"timestamp\\") t WHERE {FILTER_PARAMS.active_users.time.filter(\\"timestamp\\")} AND {FILTER_PARAMS.active_users.time.filter(lambda a,b : f'timestamp >= {a}::timestamptz AND timestamp <= {b}::timestamptz')}" - + measures: - name: weekly_active sql: "{CUBE.user_id}" @@ -303,13 +303,20 @@ cubes: const { compiler, joinGraph, cubeEvaluator } = prepareYamlCompiler(` cubes: - name: orders - sql: "SELECT 1 as id, 1 as customer_id, TO_TIMESTAMP('2022-01-01', 'YYYY-MM-DD') as timestamp WHERE {FILTER_PARAMS.orders.time.filter(\\"timestamp\\")}" - + sql: "SELECT * + FROM ( + SELECT + 1 as id, + 1 as customer_id, + TO_TIMESTAMP('2022-01-01', 'YYYY-MM-DD') as timestamp + ) sq + WHERE {FILTER_PARAMS.orders.time.filter(\\"timestamp\\")}" + joins: - name: customers sql: "{CUBE}.customer_id = {customers}.id" relationship: many_to_one - + measures: - name: count type: count @@ -319,11 +326,11 @@ cubes: sql: "{CUBE}.id" type: string primary_key: true - + - name: time sql: "{CUBE}.timestamp" type: time - + preAggregations: - name: main measures: [orders.count] @@ -356,11 +363,11 @@ cubes: measures: - name: count type: count - - + + - name: customers sql: "SELECT 1 as id, 'Foo' as name" - + measures: - name: count type: count @@ -370,11 +377,11 @@ cubes: sql: id type: string primary_key: true - + - name: name sql: "{CUBE}.name" type: string - + views: - name: line_items_view @@ -385,13 +392,13 @@ views: - join_path: line_items.orders prefix: true includes: "*" - excludes: + excludes: - count - + - join_path: line_items.orders.customers alias: aliased_customers prefix: true - includes: + includes: - name: name alias: full_name `); @@ -425,12 +432,12 @@ views: cubes: - name: BaseUsers sql: "SELECT 1" - + dimensions: - name: time sql: "{CUBE}.timestamp" type: time - + - name: ActiveUsers sql: "SELECT 1 as user_id, '2022-01-01' as timestamp" extends: BaseUsers @@ -527,9 +534,9 @@ cubes: type: string sql: w_id primary_key: true - + joins: - + - name: Z sql: "{CUBE}.z_id = {Z}.z_id" relationship: many_to_one @@ -550,9 +557,9 @@ cubes: type: string sql: m_id primary_key: true - + joins: - + - name: V sql: "{CUBE}.v_id = {V}.v_id" relationship: many_to_one @@ -560,11 +567,11 @@ cubes: - name: W sql: "{CUBE}.w_id = {W}.w_id" relationship: many_to_one - + - name: Z sql: > SELECT 1 as z_id, 'US' as COUNTRY - + dimensions: - name: country sql: "{CUBE}.COUNTRY" @@ -574,7 +581,7 @@ cubes: sql: "{CUBE}.z_id" type: string primaryKey: true - + - name: V sql: | SELECT 1 as v_id, 1 as z_id @@ -595,7 +602,7 @@ cubes: views: - name: m_view - + cubes: - join_path: M diff --git a/packages/cubejs-schema-compiler/test/unit/base-query.test.ts b/packages/cubejs-schema-compiler/test/unit/base-query.test.ts index cf879dd21481c..8e74bb852cda3 100644 --- a/packages/cubejs-schema-compiler/test/unit/base-query.test.ts +++ b/packages/cubejs-schema-compiler/test/unit/base-query.test.ts @@ -688,21 +688,30 @@ describe('SQL Generation', () => { /** @type {Compilers} */ const compilers = prepareYamlCompiler( createSchemaYaml({ - cubes: [ - { - name: 'Order', - sql: 'select * from order where {FILTER_PARAMS.Order.type.filter(\'type\')}', - measures: [{ - name: 'count', - type: 'count', - }], - dimensions: [{ - name: 'type', - sql: 'type', - type: 'string' - }] - }, - ] + cubes: [{ + name: 'Order', + sql: 'select * from order where {FILTER_PARAMS.Order.type.filter(\'type\')}', + measures: [{ + name: 'count', + type: 'count', + }], + dimensions: [{ + name: 'type', + sql: 'type', + type: 'string' + }] + }], + views: [{ + name: 'orders_view', + cubes: [{ + join_path: 'Order', + prefix: true, + includes: [ + 'type', + 'count', + ] + }] + }] }) ); @@ -857,6 +866,23 @@ describe('SQL Generation', () => { const cubeSQL = query.cubeSql('Order'); expect(cubeSQL).toMatch(/\(\s*\(.*type\s*=\s*\$\d\$.*OR.*type\s*=\s*\$\d\$.*\)\s*AND\s*\(.*type\s*=\s*\$\d\$.*OR.*type\s*=\s*\$\d\$.*\)\s*\)/); }); + + it('propagate filter params from view into cube\'s query', async () => { + await compilers.compiler.compile(); + const query = new BaseQuery(compilers, { + measures: ['orders_view.Order_count'], + filters: [ + { + member: 'orders_view.Order_type', + operator: 'equals', + values: ['online'], + }, + ], + }); + const cubeSQL = query.cubeSql('Order'); + console.log('TEST: ', cubeSQL); + expect(cubeSQL).toContain('select * from order where ((type = $0$))'); + }); }); describe('FILTER_GROUP', () => { diff --git a/packages/cubejs-server-core/CHANGELOG.md b/packages/cubejs-server-core/CHANGELOG.md index b57a34031151b..aa9f0f195ba82 100644 --- a/packages/cubejs-server-core/CHANGELOG.md +++ b/packages/cubejs-server-core/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + + +### Bug Fixes + +* **schema-compiler:** propagate FILTER_PARAMS from view to inner cube's SELECT ([#8466](https://github.com/cube-js/cube/issues/8466)) ([c0466fd](https://github.com/cube-js/cube/commit/c0466fde9b7a3834159d7ec592362edcab6d9795)) + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/server-core diff --git a/packages/cubejs-server-core/package.json b/packages/cubejs-server-core/package.json index 15bdce1744f0c..b9bac813d1ef8 100644 --- a/packages/cubejs-server-core/package.json +++ b/packages/cubejs-server-core/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/server-core", "description": "Cube.js base component to wire all backend components together", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -29,12 +29,12 @@ "unit": "jest --runInBand --forceExit --coverage dist/test" }, "dependencies": { - "@cubejs-backend/api-gateway": "^0.35.79", + "@cubejs-backend/api-gateway": "^0.35.80", "@cubejs-backend/cloud": "^0.35.67", "@cubejs-backend/dotenv": "^9.0.2", - "@cubejs-backend/native": "^0.35.79", + "@cubejs-backend/native": "^0.35.80", "@cubejs-backend/query-orchestrator": "^0.35.78", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@cubejs-backend/templates": "^0.35.67", "codesandbox-import-utils": "^2.1.12", diff --git a/packages/cubejs-server-core/src/core/CompilerApi.js b/packages/cubejs-server-core/src/core/CompilerApi.js index 489c1816d6cb5..401e50ac5d46c 100644 --- a/packages/cubejs-server-core/src/core/CompilerApi.js +++ b/packages/cubejs-server-core/src/core/CompilerApi.js @@ -129,7 +129,7 @@ export class CompilerApi { async getSqlGenerator(query, dataSource) { const dbType = await this.getDbType(dataSource); const compilers = await this.getCompilers({ requestId: query.requestId }); - let sqlGenerator = await this.createQueryByDataSource(compilers, query, dataSource); + let sqlGenerator = await this.createQueryByDataSource(compilers, query, dataSource, dbType); if (!sqlGenerator) { throw new Error(`Unknown dbType: ${dbType}`); @@ -142,7 +142,8 @@ export class CompilerApi { sqlGenerator = await this.createQueryByDataSource( compilers, query, - dataSource + dataSource, + _dbType ); if (!sqlGenerator) { @@ -203,8 +204,10 @@ export class CompilerApi { return cubeEvaluator.scheduledPreAggregations(); } - async createQueryByDataSource(compilers, query, dataSource) { - const dbType = await this.getDbType(dataSource); + async createQueryByDataSource(compilers, query, dataSource, dbType) { + if (!dbType) { + dbType = await this.getDbType(dataSource); + } return this.createQuery(compilers, dbType, this.getDialectClass(dataSource, dbType), query); } diff --git a/packages/cubejs-server/CHANGELOG.md b/packages/cubejs-server/CHANGELOG.md index 9a92b9528d87f..8ccb75089ceb3 100644 --- a/packages/cubejs-server/CHANGELOG.md +++ b/packages/cubejs-server/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/server + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/server diff --git a/packages/cubejs-server/package.json b/packages/cubejs-server/package.json index 3e7e3a67793ad..ce57b1e96a67c 100644 --- a/packages/cubejs-server/package.json +++ b/packages/cubejs-server/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/server", "description": "Cube.js all-in-one server", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "types": "index.d.ts", "repository": { "type": "git", @@ -42,8 +42,8 @@ "dependencies": { "@cubejs-backend/cubestore-driver": "^0.35.78", "@cubejs-backend/dotenv": "^9.0.2", - "@cubejs-backend/native": "^0.35.79", - "@cubejs-backend/server-core": "^0.35.79", + "@cubejs-backend/native": "^0.35.80", + "@cubejs-backend/server-core": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@oclif/color": "^1.0.0", "@oclif/command": "^1.8.13", diff --git a/packages/cubejs-testing-drivers/CHANGELOG.md b/packages/cubejs-testing-drivers/CHANGELOG.md index 1cdbaa9bc6738..dd86f1ae3c8e2 100644 --- a/packages/cubejs-testing-drivers/CHANGELOG.md +++ b/packages/cubejs-testing-drivers/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/testing-drivers + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/testing-drivers diff --git a/packages/cubejs-testing-drivers/package.json b/packages/cubejs-testing-drivers/package.json index af7eba46bd814..4201ad4214a0e 100644 --- a/packages/cubejs-testing-drivers/package.json +++ b/packages/cubejs-testing-drivers/package.json @@ -1,6 +1,6 @@ { "name": "@cubejs-backend/testing-drivers", - "version": "0.35.79", + "version": "0.35.80", "description": "Cube.js drivers test suite", "author": "Cube Dev, Inc.", "license": "MIT", @@ -46,22 +46,22 @@ "dist/src" ], "dependencies": { - "@cubejs-backend/athena-driver": "^0.35.79", + "@cubejs-backend/athena-driver": "^0.35.80", "@cubejs-backend/base-driver": "^0.35.67", - "@cubejs-backend/bigquery-driver": "^0.35.79", - "@cubejs-backend/clickhouse-driver": "^0.35.79", + "@cubejs-backend/bigquery-driver": "^0.35.80", + "@cubejs-backend/clickhouse-driver": "^0.35.80", "@cubejs-backend/cubestore-driver": "^0.35.78", - "@cubejs-backend/databricks-jdbc-driver": "^0.35.79", + "@cubejs-backend/databricks-jdbc-driver": "^0.35.80", "@cubejs-backend/dotenv": "^9.0.2", "@cubejs-backend/linter": "^0.35.0", "@cubejs-backend/mssql-driver": "^0.35.67", - "@cubejs-backend/mysql-driver": "^0.35.79", - "@cubejs-backend/postgres-driver": "^0.35.79", + "@cubejs-backend/mysql-driver": "^0.35.80", + "@cubejs-backend/postgres-driver": "^0.35.80", "@cubejs-backend/query-orchestrator": "^0.35.78", - "@cubejs-backend/server-core": "^0.35.79", + "@cubejs-backend/server-core": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "@cubejs-backend/snowflake-driver": "^0.35.67", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@cubejs-client/core": "^0.35.23", "@cubejs-client/ws-transport": "^0.35.23", "@jest/globals": "^27", diff --git a/packages/cubejs-testing-shared/CHANGELOG.md b/packages/cubejs-testing-shared/CHANGELOG.md index bf5413bc5a079..2b50ab8071c60 100644 --- a/packages/cubejs-testing-shared/CHANGELOG.md +++ b/packages/cubejs-testing-shared/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/testing-shared + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/testing-shared diff --git a/packages/cubejs-testing-shared/package.json b/packages/cubejs-testing-shared/package.json index 1e43f3e2286cf..dc0431853fe67 100644 --- a/packages/cubejs-testing-shared/package.json +++ b/packages/cubejs-testing-shared/package.json @@ -1,6 +1,6 @@ { "name": "@cubejs-backend/testing-shared", - "version": "0.35.79", + "version": "0.35.80", "description": "Cube.js Testing Helpers", "author": "Cube Dev, Inc.", "license": "Apache-2.0", @@ -22,7 +22,7 @@ "dependencies": { "@cubejs-backend/dotenv": "^9.0.2", "@cubejs-backend/query-orchestrator": "^0.35.78", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "dedent": "^0.7.0", "node-fetch": "^2.6.7", diff --git a/packages/cubejs-testing/CHANGELOG.md b/packages/cubejs-testing/CHANGELOG.md index 9bc1e584d8833..046a668afacc0 100644 --- a/packages/cubejs-testing/CHANGELOG.md +++ b/packages/cubejs-testing/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/testing + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/testing diff --git a/packages/cubejs-testing/package.json b/packages/cubejs-testing/package.json index 1da510b58e11a..c607441e95b33 100644 --- a/packages/cubejs-testing/package.json +++ b/packages/cubejs-testing/package.json @@ -1,6 +1,6 @@ { "name": "@cubejs-backend/testing", - "version": "0.35.79", + "version": "0.35.80", "description": "Cube.js e2e tests", "author": "Cube Dev, Inc.", "license": "Apache-2.0", @@ -91,11 +91,11 @@ "dependencies": { "@cubejs-backend/cubestore-driver": "^0.35.78", "@cubejs-backend/dotenv": "^9.0.2", - "@cubejs-backend/postgres-driver": "^0.35.79", + "@cubejs-backend/postgres-driver": "^0.35.80", "@cubejs-backend/query-orchestrator": "^0.35.78", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", - "@cubejs-backend/testing-shared": "^0.35.79", + "@cubejs-backend/testing-shared": "^0.35.80", "@cubejs-client/ws-transport": "^0.35.23", "dedent": "^0.7.0", "fs-extra": "^8.1.0", diff --git a/packages/cubejs-trino-driver/CHANGELOG.md b/packages/cubejs-trino-driver/CHANGELOG.md index 137635b32a63a..522141eaccbcc 100644 --- a/packages/cubejs-trino-driver/CHANGELOG.md +++ b/packages/cubejs-trino-driver/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + +**Note:** Version bump only for package @cubejs-backend/trino-driver + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/trino-driver diff --git a/packages/cubejs-trino-driver/package.json b/packages/cubejs-trino-driver/package.json index a78b95bcd71c8..b9e61df387a84 100644 --- a/packages/cubejs-trino-driver/package.json +++ b/packages/cubejs-trino-driver/package.json @@ -2,7 +2,7 @@ "name": "@cubejs-backend/trino-driver", "description": "Cube.js Trino database driver", "author": "Cube Dev, Inc.", - "version": "0.35.79", + "version": "0.35.80", "repository": { "type": "git", "url": "https://github.com/cube-js/cube.git", @@ -27,7 +27,7 @@ "dependencies": { "@cubejs-backend/base-driver": "^0.35.67", "@cubejs-backend/prestodb-driver": "^0.35.67", - "@cubejs-backend/schema-compiler": "^0.35.79", + "@cubejs-backend/schema-compiler": "^0.35.80", "@cubejs-backend/shared": "^0.35.67", "presto-client": "^0.12.2", "ramda": "^0.27.0", diff --git a/rust/cubenativeutils/Cargo.lock b/rust/cubenativeutils/Cargo.lock index 8a7ca561e9dbd..b91bfac98f144 100644 --- a/rust/cubenativeutils/Cargo.lock +++ b/rust/cubenativeutils/Cargo.lock @@ -629,7 +629,7 @@ dependencies = [ [[package]] name = "cube-ext" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "chrono", @@ -706,7 +706,6 @@ dependencies = [ "futures-util", "hashbrown 0.14.5", "itertools", - "lazy_static", "log", "lru", "minijinja", @@ -718,7 +717,6 @@ dependencies = [ "regex", "rust_decimal", "serde", - "serde_derive", "serde_json", "sha1_smol", "sha2", @@ -736,7 +734,7 @@ dependencies = [ [[package]] name = "datafusion" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -769,7 +767,7 @@ dependencies = [ [[package]] name = "datafusion-common" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "ordered-float 2.10.1", @@ -780,7 +778,7 @@ dependencies = [ [[package]] name = "datafusion-data-access" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "async-trait", "chrono", @@ -793,7 +791,7 @@ dependencies = [ [[package]] name = "datafusion-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -804,7 +802,7 @@ dependencies = [ [[package]] name = "datafusion-physical-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", diff --git a/rust/cubesql/CHANGELOG.md b/rust/cubesql/CHANGELOG.md index d316a9473e7bb..6d28a9b1da705 100644 --- a/rust/cubesql/CHANGELOG.md +++ b/rust/cubesql/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.35.80](https://github.com/cube-js/cube/compare/v0.35.79...v0.35.80) (2024-09-09) + + +### Features + +* **cubesql:** Fill pg_description table with cube and members descriptions ([#8618](https://github.com/cube-js/cube/issues/8618)) ([2288c18](https://github.com/cube-js/cube/commit/2288c18bf30d1f3a3299b235fe9b4405d2cb7463)) +* **cubesql:** Support join with type coercion ([#8608](https://github.com/cube-js/cube/issues/8608)) ([46b3a36](https://github.com/cube-js/cube/commit/46b3a36936f0f00805144714f0dd87a3c50a5e0a)) + + + + + ## [0.35.79](https://github.com/cube-js/cube/compare/v0.35.78...v0.35.79) (2024-09-04) **Note:** Version bump only for package @cubejs-backend/cubesql diff --git a/rust/cubesql/Cargo.lock b/rust/cubesql/Cargo.lock index 447302de31405..a832246ac7504 100644 --- a/rust/cubesql/Cargo.lock +++ b/rust/cubesql/Cargo.lock @@ -721,7 +721,7 @@ dependencies = [ [[package]] name = "cube-ext" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "chrono", @@ -775,7 +775,6 @@ dependencies = [ "hashbrown 0.14.3", "insta", "itertools", - "lazy_static", "log", "lru", "minijinja", @@ -852,7 +851,7 @@ dependencies = [ [[package]] name = "datafusion" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -885,7 +884,7 @@ dependencies = [ [[package]] name = "datafusion-common" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "ordered-float 2.10.0", @@ -896,7 +895,7 @@ dependencies = [ [[package]] name = "datafusion-data-access" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "async-trait", "chrono", @@ -909,7 +908,7 @@ dependencies = [ [[package]] name = "datafusion-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -920,7 +919,7 @@ dependencies = [ [[package]] name = "datafusion-physical-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", diff --git a/rust/cubesql/cubesql/Cargo.toml b/rust/cubesql/cubesql/Cargo.toml index 2e70b15dac9dc..e88ffd9fc6346 100644 --- a/rust/cubesql/cubesql/Cargo.toml +++ b/rust/cubesql/cubesql/Cargo.toml @@ -10,13 +10,12 @@ homepage = "https://cube.dev" [dependencies] arc-swap = "1" -datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "400fa0d889a8a38ca69f36d5750dfb572fc6018e", default-features = false, features = ["regex_expressions", "unicode_expressions"] } +datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "dcf3e4aa26fd112043ef26fa4a78db5dbd443c86", default-features = false, features = ["regex_expressions", "unicode_expressions"] } anyhow = "1.0" thiserror = "1.0.50" cubeclient = { path = "../cubeclient" } pg-srv = { path = "../pg-srv" } sqlparser = { git = 'https://github.com/cube-js/sqlparser-rs.git', rev = "6a54d27d3b75a04b9f9cbe309a83078aa54b32fd" } -lazy_static = "1.4.0" base64 = "0.13.0" tokio = { version = "^1.35", features = ["full", "rt", "tracing"] } serde = { version = "^1.0", features = ["derive"] } diff --git a/rust/cubesql/cubesql/src/compile/engine/context_postgresql.rs b/rust/cubesql/cubesql/src/compile/engine/context_postgresql.rs index 68dbf97893dd9..2b1b227553d8c 100644 --- a/rust/cubesql/cubesql/src/compile/engine/context_postgresql.rs +++ b/rust/cubesql/cubesql/src/compile/engine/context_postgresql.rs @@ -327,7 +327,11 @@ impl DatabaseProtocol { context.session_state.all_variables(), ))) } - "pg_description" => return Some(Arc::new(PgCatalogDescriptionProvider::new())), + "pg_description" => { + return Some(Arc::new(PgCatalogDescriptionProvider::new( + &context.meta.tables, + ))) + } "pg_constraint" => return Some(Arc::new(PgCatalogConstraintProvider::new())), "pg_depend" => return Some(Arc::new(PgCatalogDependProvider::new())), "pg_am" => return Some(Arc::new(PgCatalogAmProvider::new())), diff --git a/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs b/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs index 869528f7602cd..1c7edf39dc6a1 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/wrapper.rs @@ -32,8 +32,16 @@ use itertools::Itertools; use regex::{Captures, Regex}; use serde::{Deserialize, Serialize}; use std::{ - any::Any, cmp::min, collections::HashMap, convert::TryInto, fmt, future::Future, iter, - pin::Pin, result, sync::Arc, + any::Any, + cmp::min, + collections::HashMap, + convert::TryInto, + fmt, + future::Future, + iter, + pin::Pin, + result, + sync::{Arc, LazyLock}, }; #[derive(Debug, Clone, Deserialize)] @@ -160,12 +168,12 @@ impl SqlQuery { } pub fn finalize_query(&mut self, sql_templates: Arc) -> Result<()> { + static REGEX: LazyLock = LazyLock::new(|| Regex::new(r"\$(\d+)\$").unwrap()); + let mut params = Vec::new(); let mut rendered_params = HashMap::new(); - let regex = Regex::new(r"\$(\d+)\$") - .map_err(|e| DataFusionError::Execution(format!("Can't parse regex: {}", e)))?; let mut res = Ok(()); - let replaced_sql = regex.replace_all(self.sql.as_str(), |c: &Captures<'_>| { + let replaced_sql = REGEX.replace_all(self.sql.as_str(), |c: &Captures<'_>| { let param = c.get(1).map(|x| x.as_str()); match self.render_param(sql_templates.clone(), param, &rendered_params, params.len()) { Ok((param_index, param, push_param)) => { @@ -260,9 +268,7 @@ pub struct SqlGenerationResult { pub request: TransportLoadRequestQuery, } -lazy_static! { - static ref DATE_PART_REGEX: Regex = Regex::new("^[A-Za-z_ ]+$").unwrap(); -} +static DATE_PART_REGEX: LazyLock = LazyLock::new(|| Regex::new("^[A-Za-z_ ]+$").unwrap()); macro_rules! generate_sql_for_timestamp { (@generic $value:ident, $value_block:expr, $sql_generator:expr, $sql_query:expr) => { @@ -950,8 +956,9 @@ impl CubeScanWrapperNode { ungrouped_scan_node: Option>, subqueries: Arc>, ) -> result::Result<(Vec, SqlQuery), CubeError> { - let non_id_regex = Regex::new(r"[^a-zA-Z0-9_]") - .map_err(|e| CubeError::internal(format!("Can't parse regex: {}", e)))?; + static NON_ID_REGEX: LazyLock = + LazyLock::new(|| Regex::new(r"[^a-zA-Z0-9_]").unwrap()); + let mut aliased_columns = Vec::new(); for original_expr in exprs { let expr = if let Some(column_remapping) = column_remapping.as_ref() { @@ -1001,7 +1008,7 @@ impl CubeScanWrapperNode { let alias = if can_rename_columns { let alias = expr_name(&expr, &schema)?; - let mut truncated_alias = non_id_regex + let mut truncated_alias = NON_ID_REGEX .replace_all(&alias, "_") .trim_start_matches("_") .to_lowercase(); diff --git a/rust/cubesql/cubesql/src/compile/engine/information_schema/postgres/pg_description.rs b/rust/cubesql/cubesql/src/compile/engine/information_schema/postgres/pg_description.rs index bc9ecebdfed90..b3de6e0d25779 100644 --- a/rust/cubesql/cubesql/src/compile/engine/information_schema/postgres/pg_description.rs +++ b/rust/cubesql/cubesql/src/compile/engine/information_schema/postgres/pg_description.rs @@ -1,4 +1,4 @@ -use std::{any::Any, sync::Arc}; +use std::{any::Any, convert::TryFrom, sync::Arc}; use async_trait::async_trait; @@ -14,10 +14,19 @@ use datafusion::{ physical_plan::{memory::MemoryExec, ExecutionPlan}, }; +use crate::{ + compile::engine::information_schema::postgres::PG_CLASS_CLASS_OID, transport::CubeMetaTable, +}; + +/// See https://www.postgresql.org/docs/16/catalog-pg-description.html struct PgCatalogDescriptionBuilder { + /// The OID of the object this description pertains to objoid: UInt32Builder, + /// The OID of the system catalog this object appears in classoid: UInt32Builder, + /// For a comment on a table column, this is the column number (the objoid and classoid refer to the table itself). For all other object types, this column is zero. objsubid: Int32Builder, + /// Arbitrary text that serves as the description of this object description: StringBuilder, } @@ -33,6 +42,23 @@ impl PgCatalogDescriptionBuilder { } } + fn add_table(&mut self, table_oid: u32, description: impl AsRef) { + self.objoid.append_value(table_oid).unwrap(); + self.classoid.append_value(PG_CLASS_CLASS_OID).unwrap(); + self.objsubid.append_value(0).unwrap(); + self.description.append_value(description).unwrap(); + } + + fn add_column(&mut self, table_oid: u32, column_idx: usize, description: impl AsRef) { + self.objoid.append_value(table_oid).unwrap(); + self.classoid.append_value(PG_CLASS_CLASS_OID).unwrap(); + // Column subids starts with 1 + self.objsubid + .append_value(i32::try_from(column_idx).unwrap() + 1) + .unwrap(); + self.description.append_value(description).unwrap(); + } + fn finish(mut self) -> Vec> { let columns: Vec> = vec![ Arc::new(self.objoid.finish()), @@ -50,8 +76,20 @@ pub struct PgCatalogDescriptionProvider { } impl PgCatalogDescriptionProvider { - pub fn new() -> Self { - let builder = PgCatalogDescriptionBuilder::new(); + pub fn new(tables: &[CubeMetaTable]) -> Self { + let mut builder = PgCatalogDescriptionBuilder::new(); + + for table in tables { + if let Some(description) = &table.description { + builder.add_table(table.oid, description); + } + + for (idx, column) in table.columns.iter().enumerate() { + if let Some(description) = &column.description { + builder.add_column(table.oid, idx, description); + } + } + } Self { data: Arc::new(builder.finish()), diff --git a/rust/cubesql/cubesql/src/compile/engine/udf/common.rs b/rust/cubesql/cubesql/src/compile/engine/udf/common.rs index 3be9c598e23fb..db8c96e279eda 100644 --- a/rust/cubesql/cubesql/src/compile/engine/udf/common.rs +++ b/rust/cubesql/cubesql/src/compile/engine/udf/common.rs @@ -1,4 +1,8 @@ -use std::{any::type_name, sync::Arc, thread}; +use std::{ + any::type_name, + sync::{Arc, LazyLock}, + thread, +}; use chrono::{Datelike, Days, Duration, Months, NaiveDate, NaiveDateTime, NaiveTime}; use datafusion::{ @@ -3329,17 +3333,18 @@ pub fn create_current_setting_udf() -> ScalarUDF { } pub fn create_quote_ident_udf() -> ScalarUDF { + static RE: LazyLock = LazyLock::new(|| Regex::new(r"^[a-z_][a-z0-9_]*$").unwrap()); + let fun = make_scalar_function(move |args: &[ArrayRef]| { assert!(args.len() == 1); let idents = downcast_string_arg!(args[0], "str", i32); - let re = Regex::new(r"^[a-z_][a-z0-9_]*$").unwrap(); let result = idents .iter() .map(|ident| { ident.map(|ident| { - if re.is_match(ident) { + if RE.is_match(ident) { return ident.to_string(); } format!("\"{}\"", ident.replace("\"", "\"\"")) diff --git a/rust/cubesql/cubesql/src/compile/parser.rs b/rust/cubesql/cubesql/src/compile/parser.rs index 53c324ed9bc10..58f79445ee7cc 100644 --- a/rust/cubesql/cubesql/src/compile/parser.rs +++ b/rust/cubesql/cubesql/src/compile/parser.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use std::{collections::HashMap, sync::LazyLock}; use regex::Regex; use sqlparser::{ @@ -36,9 +36,9 @@ impl Dialect for MySqlDialectWithBackTicks { } } -lazy_static! { - static ref SIGMA_WORKAROUND: Regex = Regex::new(r#"(?s)^\s*with\s+nsp\sas\s\(.*nspname\s=\s.*\),\s+tbl\sas\s\(.*relname\s=\s.*\).*select\s+attname.*from\spg_attribute.*$"#).unwrap(); -} +static SIGMA_WORKAROUND: LazyLock = LazyLock::new(|| { + Regex::new(r#"(?s)^\s*with\s+nsp\sas\s\(.*nspname\s=\s.*\),\s+tbl\sas\s\(.*relname\s=\s.*\).*select\s+attname.*from\spg_attribute.*$"#).unwrap() +}); pub fn parse_sql_to_statements( query: &String, @@ -118,13 +118,18 @@ pub fn parse_sql_to_statements( // Sigma Computing WITH query workaround // TODO: remove workaround when subquery is supported in JOIN ON conditions let query = if SIGMA_WORKAROUND.is_match(&query) { - let relnamespace_re = Regex::new(r#"(?s)from\spg_catalog\.pg_class\s+where\s+relname\s=\s(?P'(?:[^']|'')+'|\$\d+)\s+and\s+relnamespace\s=\s\(select\soid\sfrom\snsp\)"#).unwrap(); - let relnamespace_replaced = relnamespace_re.replace( + static RELNAMESPACE_RE: LazyLock = LazyLock::new(|| { + Regex::new(r#"(?s)from\spg_catalog\.pg_class\s+where\s+relname\s=\s(?P'(?:[^']|'')+'|\$\d+)\s+and\s+relnamespace\s=\s\(select\soid\sfrom\snsp\)"#).unwrap() + }); + static ATTRELID_RE: LazyLock = LazyLock::new(|| { + Regex::new(r#"(?s)left\sjoin\spg_description\son\s+attrelid\s=\sobjoid\sand\s+attnum\s=\sobjsubid\s+where\s+attnum\s>\s0\s+and\s+attrelid\s=\s\(select\soid\sfrom\stbl\)"#).unwrap() + }); + + let relnamespace_replaced = RELNAMESPACE_RE.replace( &query, "from pg_catalog.pg_class join nsp on relnamespace = nsp.oid where relname = $relname", ); - let attrelid_re = Regex::new(r#"(?s)left\sjoin\spg_description\son\s+attrelid\s=\sobjoid\sand\s+attnum\s=\sobjsubid\s+where\s+attnum\s>\s0\s+and\s+attrelid\s=\s\(select\soid\sfrom\stbl\)"#).unwrap(); - let attrelid_replaced = attrelid_re.replace(&relnamespace_replaced, "left join pg_description on attrelid = objoid and attnum = objsubid join tbl on attrelid = tbl.oid where attnum > 0"); + let attrelid_replaced = ATTRELID_RE.replace(&relnamespace_replaced, "left join pg_description on attrelid = objoid and attnum = objsubid join tbl on attrelid = tbl.oid where attnum > 0"); attrelid_replaced.to_string() } else { query diff --git a/rust/cubesql/cubesql/src/compile/rewrite/converter.rs b/rust/cubesql/cubesql/src/compile/rewrite/converter.rs index f60a36b3f537d..32fb6ec754778 100644 --- a/rust/cubesql/cubesql/src/compile/rewrite/converter.rs +++ b/rust/cubesql/cubesql/src/compile/rewrite/converter.rs @@ -59,7 +59,7 @@ use std::{ collections::{HashMap, HashSet}, env, ops::Index, - sync::Arc, + sync::{Arc, LazyLock}, }; pub use super::rewriter::CubeRunner; @@ -170,8 +170,8 @@ macro_rules! add_plan_list_node { }}; } -lazy_static! { - static ref EXCLUDED_PARAM_VALUES: HashSet = vec![ +static EXCLUDED_PARAM_VALUES: LazyLock> = LazyLock::new(|| { + vec![ ScalarValue::Utf8(Some("second".to_string())), ScalarValue::Utf8(Some("minute".to_string())), ScalarValue::Utf8(Some("hour".to_string())), @@ -182,8 +182,8 @@ lazy_static! { ] .into_iter() .chain((0..50).map(|i| ScalarValue::Int64(Some(i)))) - .collect(); -} + .collect() +}); pub struct LogicalPlanToLanguageConverter { graph: EGraph, diff --git a/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs b/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs index 291b7d32a352a..79fa094a995ea 100644 --- a/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs +++ b/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs @@ -46,7 +46,7 @@ use std::{ collections::{HashMap, HashSet}, fmt::Display, ops::{Index, IndexMut}, - sync::Arc, + sync::{Arc, LazyLock}, }; pub struct MemberRules { @@ -2857,27 +2857,30 @@ pub fn add_member_error( ])) } -lazy_static! { - static ref STANDARD_GRANULARITIES_PARENTS: HashMap<&'static str, Vec<&'static str>> = [ - ( - "year", - vec!["year", "quarter", "month", "day", "hour", "minute", "second"] - ), - ( - "quarter", - vec!["quarter", "month", "day", "hour", "minute", "second"] - ), - ("month", vec!["month", "day", "hour", "minute", "second"]), - ("week", vec!["week", "day", "hour", "minute", "second"]), - ("day", vec!["day", "hour", "minute", "second"]), - ("hour", vec!["hour", "minute", "second"]), - ("minute", vec!["minute", "second"]), - ("second", vec!["second"]), - ] - .iter() - .cloned() - .collect(); -} +static STANDARD_GRANULARITIES_PARENTS: LazyLock>> = + LazyLock::new(|| { + [ + ( + "year", + vec![ + "year", "quarter", "month", "day", "hour", "minute", "second", + ], + ), + ( + "quarter", + vec!["quarter", "month", "day", "hour", "minute", "second"], + ), + ("month", vec!["month", "day", "hour", "minute", "second"]), + ("week", vec!["week", "day", "hour", "minute", "second"]), + ("day", vec!["day", "hour", "minute", "second"]), + ("hour", vec!["hour", "minute", "second"]), + ("minute", vec!["minute", "second"]), + ("second", vec!["second"]), + ] + .iter() + .cloned() + .collect() + }); pub fn min_granularity(granularity_a: &String, granularity_b: &String) -> Option { let granularity_a = granularity_a.to_lowercase(); diff --git a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__metabase_pg_class_query.snap b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__metabase_pg_class_query.snap index c8d28203015fe..d804b18e6e1a5 100644 --- a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__metabase_pg_class_query.snap +++ b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__metabase_pg_class_query.snap @@ -2,23 +2,23 @@ source: cubesql/src/compile/mod.rs expression: "execute_query(\"\n SELECT *\n FROM (\n SELECT n.nspname,\n c.relname,\n a.attname,\n a.atttypid,\n a.attnotnull or (t.typtype = 'd' AND t.typnotnull) AS attnotnull,\n a.atttypmod,\n a.attlen,\n t.typtypmod,\n row_number() OVER (partition BY a.attrelid ORDER BY a.attnum) AS attnum,\n NULLIF(a.attidentity, '') AS attidentity,\n pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS adsrc,\n dsc.description,\n t.typbasetype,\n t.typtype\n FROM pg_catalog.pg_namespace n\n JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid)\n JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid)\n JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid)\n LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum)\n LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)\n LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class')\n LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog')\n WHERE c.relkind IN ('r', 'p', 'v', 'f', 'm') AND a.attnum > 0 AND NOT a.attisdropped AND n.nspname LIKE 'public' AND c.relname LIKE 'KibanaSampleDataEcommerce') c\n WHERE true\n ORDER BY nspname, c.relname, attnum;\n \".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+---------+---------------------------+--------------------+----------+------------+-----------+--------+-----------+--------+-------------+-------+-------------+-------------+---------+ -| nspname | relname | attname | atttypid | attnotnull | atttypmod | attlen | typtypmod | attnum | attidentity | adsrc | description | typbasetype | typtype | -+---------+---------------------------+--------------------+----------+------------+-----------+--------+-----------+--------+-------------+-------+-------------+-------------+---------+ -| public | KibanaSampleDataEcommerce | count | 20 | true | -1 | 8 | -1 | 1 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | maxPrice | 1700 | true | -1 | -1 | -1 | 2 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | sumPrice | 1700 | true | -1 | -1 | -1 | 3 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | minPrice | 1700 | true | -1 | -1 | -1 | 4 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | avgPrice | 1700 | true | -1 | -1 | -1 | 5 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | countDistinct | 20 | true | -1 | 8 | -1 | 6 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | order_date | 1114 | false | -1 | 8 | -1 | 7 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | last_mod | 1114 | false | -1 | 8 | -1 | 8 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | customer_gender | 25 | false | -1 | -1 | -1 | 9 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | notes | 25 | false | -1 | -1 | -1 | 10 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | taxful_total_price | 1700 | false | -1 | -1 | -1 | 11 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | has_subscription | 16 | false | -1 | 1 | -1 | 12 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | is_male | 16 | true | -1 | 1 | -1 | 13 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | is_female | 16 | true | -1 | 1 | -1 | 14 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | __user | 25 | false | -1 | -1 | -1 | 15 | NULL | NULL | NULL | 0 | b | -| public | KibanaSampleDataEcommerce | __cubeJoinField | 25 | false | -1 | -1 | -1 | 16 | NULL | NULL | NULL | 0 | b | -+---------+---------------------------+--------------------+----------+------------+-----------+--------+-----------+--------+-------------+-------+-------------+-------------+---------+ ++---------+---------------------------+--------------------+----------+------------+-----------+--------+-----------+--------+-------------+-------+-----------------------------------------------+-------------+---------+ +| nspname | relname | attname | atttypid | attnotnull | atttypmod | attlen | typtypmod | attnum | attidentity | adsrc | description | typbasetype | typtype | ++---------+---------------------------+--------------------+----------+------------+-----------+--------+-----------+--------+-------------+-------+-----------------------------------------------+-------------+---------+ +| public | KibanaSampleDataEcommerce | count | 20 | true | -1 | 8 | -1 | 1 | NULL | NULL | Events count | 0 | b | +| public | KibanaSampleDataEcommerce | maxPrice | 1700 | true | -1 | -1 | -1 | 2 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | sumPrice | 1700 | true | -1 | -1 | -1 | 3 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | minPrice | 1700 | true | -1 | -1 | -1 | 4 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | avgPrice | 1700 | true | -1 | -1 | -1 | 5 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | countDistinct | 20 | true | -1 | 8 | -1 | 6 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | order_date | 1114 | false | -1 | 8 | -1 | 7 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | last_mod | 1114 | false | -1 | 8 | -1 | 8 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | customer_gender | 25 | false | -1 | -1 | -1 | 9 | NULL | NULL | Customer gender | 0 | b | +| public | KibanaSampleDataEcommerce | notes | 25 | false | -1 | -1 | -1 | 10 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | taxful_total_price | 1700 | false | -1 | -1 | -1 | 11 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | has_subscription | 16 | false | -1 | 1 | -1 | 12 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | is_male | 16 | true | -1 | 1 | -1 | 13 | NULL | NULL | Male users segment | 0 | b | +| public | KibanaSampleDataEcommerce | is_female | 16 | true | -1 | 1 | -1 | 14 | NULL | NULL | NULL | 0 | b | +| public | KibanaSampleDataEcommerce | __user | 25 | false | -1 | -1 | -1 | 15 | NULL | NULL | Virtual column for security context switching | 0 | b | +| public | KibanaSampleDataEcommerce | __cubeJoinField | 25 | false | -1 | -1 | -1 | 16 | NULL | NULL | Virtual column for joining cubes | 0 | b | ++---------+---------------------------+--------------------+----------+------------+-----------+--------+-----------+--------+-------------+-------+-----------------------------------------------+-------------+---------+ diff --git a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__pgcatalog_pgdescription_postgres.snap b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__pgcatalog_pgdescription_postgres.snap index f33ec88a25943..a8c95f329dd65 100644 --- a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__pgcatalog_pgdescription_postgres.snap +++ b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__pgcatalog_pgdescription_postgres.snap @@ -1,8 +1,88 @@ --- source: cubesql/src/compile/mod.rs -expression: "execute_query(\"SELECT * FROM pg_catalog.pg_description\".to_string(),\n DatabaseProtocol::PostgreSQL).await?" +expression: "execute_query(\"SELECT * FROM pg_catalog.pg_description\".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+--------+----------+----------+-------------+ -| objoid | classoid | objsubid | description | -+--------+----------+----------+-------------+ -+--------+----------+----------+-------------+ ++--------+----------+----------+-------------------------------------------------------+ +| objoid | classoid | objsubid | description | ++--------+----------+----------+-------------------------------------------------------+ +| 18000 | 1259 | 0 | Sample data for tracking eCommerce orders from Kibana | +| 18000 | 1259 | 1 | Events count | +| 18000 | 1259 | 9 | Customer gender | +| 18000 | 1259 | 13 | Male users segment | +| 18000 | 1259 | 15 | Virtual column for security context switching | +| 18000 | 1259 | 16 | Virtual column for joining cubes | +| 18019 | 1259 | 6 | Virtual column for security context switching | +| 18019 | 1259 | 7 | Virtual column for joining cubes | +| 18029 | 1259 | 2 | Virtual column for security context switching | +| 18029 | 1259 | 3 | Virtual column for joining cubes | +| 18035 | 1259 | 206 | Virtual column for security context switching | +| 18035 | 1259 | 207 | Virtual column for joining cubes | +| 18245 | 1259 | 0 | Test cube with a little bit of everything | +| 18245 | 1259 | 1 | Test number measure 0 | +| 18245 | 1259 | 2 | Test max(string) measure 0 | +| 18245 | 1259 | 3 | Test max(time) measure 0 | +| 18245 | 1259 | 4 | Test number measure 1 | +| 18245 | 1259 | 5 | Test max(string) measure 1 | +| 18245 | 1259 | 6 | Test max(time) measure 1 | +| 18245 | 1259 | 7 | Test number measure 2 | +| 18245 | 1259 | 8 | Test max(string) measure 2 | +| 18245 | 1259 | 9 | Test max(time) measure 2 | +| 18245 | 1259 | 10 | Test number measure 3 | +| 18245 | 1259 | 11 | Test max(string) measure 3 | +| 18245 | 1259 | 12 | Test max(time) measure 3 | +| 18245 | 1259 | 13 | Test number measure 4 | +| 18245 | 1259 | 14 | Test max(string) measure 4 | +| 18245 | 1259 | 15 | Test max(time) measure 4 | +| 18245 | 1259 | 16 | Test number measure 5 | +| 18245 | 1259 | 17 | Test max(string) measure 5 | +| 18245 | 1259 | 18 | Test max(time) measure 5 | +| 18245 | 1259 | 19 | Test number measure 6 | +| 18245 | 1259 | 20 | Test max(string) measure 6 | +| 18245 | 1259 | 21 | Test max(time) measure 6 | +| 18245 | 1259 | 22 | Test number measure 7 | +| 18245 | 1259 | 23 | Test max(string) measure 7 | +| 18245 | 1259 | 24 | Test max(time) measure 7 | +| 18245 | 1259 | 25 | Test number measure 8 | +| 18245 | 1259 | 26 | Test max(string) measure 8 | +| 18245 | 1259 | 27 | Test max(time) measure 8 | +| 18245 | 1259 | 28 | Test number measure 9 | +| 18245 | 1259 | 29 | Test max(string) measure 9 | +| 18245 | 1259 | 30 | Test max(time) measure 9 | +| 18245 | 1259 | 31 | Test count measure | +| 18245 | 1259 | 32 | Test maxPrice measure | +| 18245 | 1259 | 33 | Test minPrice measure | +| 18245 | 1259 | 34 | Test avgPrice measure | +| 18245 | 1259 | 35 | Test countDistinct measure | +| 18245 | 1259 | 36 | Test numeric dimention 0 | +| 18245 | 1259 | 37 | Test string dimention 0 | +| 18245 | 1259 | 38 | Test time dimention 0 | +| 18245 | 1259 | 39 | Test numeric dimention 1 | +| 18245 | 1259 | 40 | Test string dimention 1 | +| 18245 | 1259 | 41 | Test time dimention 1 | +| 18245 | 1259 | 42 | Test numeric dimention 2 | +| 18245 | 1259 | 43 | Test string dimention 2 | +| 18245 | 1259 | 44 | Test time dimention 2 | +| 18245 | 1259 | 45 | Test numeric dimention 3 | +| 18245 | 1259 | 46 | Test string dimention 3 | +| 18245 | 1259 | 47 | Test time dimention 3 | +| 18245 | 1259 | 48 | Test numeric dimention 4 | +| 18245 | 1259 | 49 | Test string dimention 4 | +| 18245 | 1259 | 50 | Test time dimention 4 | +| 18245 | 1259 | 51 | Test numeric dimention 5 | +| 18245 | 1259 | 52 | Test string dimention 5 | +| 18245 | 1259 | 53 | Test time dimention 5 | +| 18245 | 1259 | 54 | Test numeric dimention 6 | +| 18245 | 1259 | 55 | Test string dimention 6 | +| 18245 | 1259 | 56 | Test time dimention 6 | +| 18245 | 1259 | 57 | Test numeric dimention 7 | +| 18245 | 1259 | 58 | Test string dimention 7 | +| 18245 | 1259 | 59 | Test time dimention 7 | +| 18245 | 1259 | 60 | Test numeric dimention 8 | +| 18245 | 1259 | 61 | Test string dimention 8 | +| 18245 | 1259 | 62 | Test time dimention 8 | +| 18245 | 1259 | 63 | Test numeric dimention 9 | +| 18245 | 1259 | 64 | Test string dimention 9 | +| 18245 | 1259 | 65 | Test time dimention 9 | +| 18245 | 1259 | 66 | Virtual column for security context switching | +| 18245 | 1259 | 67 | Virtual column for joining cubes | ++--------+----------+----------+-------------------------------------------------------+ diff --git a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__thought_spot_table_columns.snap b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__thought_spot_table_columns.snap index 6e17dd07d170d..ebec7d37ee693 100644 --- a/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__thought_spot_table_columns.snap +++ b/rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__thought_spot_table_columns.snap @@ -1,25 +1,24 @@ --- source: cubesql/src/compile/mod.rs -assertion_line: 6432 -expression: "execute_query(\"SELECT * FROM ( SELECT current_database() AS TABLE_CAT, n.nspname AS TABLE_SCHEM, c.relname as TABLE_NAME , a.attname as COLUMN_NAME, CAST(case typname when 'text' THEN 12 when 'bit' THEN -7 when 'bool' THEN -7 when 'boolean' THEN -7 when 'varchar' THEN 12 when 'character varying' THEN 12 when 'char' THEN 1 when '\\\"char\\\"' THEN 1 when 'character' THEN 1 when 'nchar' THEN 12 when 'bpchar' THEN 1 when 'nvarchar' THEN 12 when 'date' THEN 91 when 'timestamp' THEN 93 when 'timestamp without time zone' THEN 93 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 4 when 'int' THEN 4 when 'int4' THEN 4 when 'bigint' THEN -5 when 'int8' THEN -5 when 'decimal' THEN 3 when 'real' THEN 7 when 'float4' THEN 7 when 'double precision' THEN 8 when 'float8' THEN 8 when 'float' THEN 6 when 'numeric' THEN 2 when '_float4' THEN 2003 when 'timestamptz' THEN 2014 when 'timestamp with time zone' THEN 2014 when '_aclitem' THEN 2003 when '_text' THEN 2003 when 'bytea' THEN -2 when 'oid' THEN -5 when 'name' THEN 12 when '_int4' THEN 2003 when '_int2' THEN 2003 when 'ARRAY' THEN 2003 when 'geometry' THEN -4 when 'super' THEN -16 else 1111 END as SMALLINT) AS DATA_TYPE, t.typname as TYPE_NAME, case typname when 'int4' THEN 10 when 'bit' THEN 1 when 'bool' THEN 1 when 'varchar' THEN atttypmod -4 when 'character varying' THEN atttypmod -4 when 'char' THEN atttypmod -4 when 'character' THEN atttypmod -4 when 'nchar' THEN atttypmod -4 when 'bpchar' THEN atttypmod -4 when 'nvarchar' THEN atttypmod -4 when 'date' THEN 13 when 'timestamp' THEN 29 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 10 when 'int' THEN 10 when 'int4' THEN 10 when 'bigint' THEN 19 when 'int8' THEN 19 when 'decimal' then (atttypmod - 4) >> 16 when 'real' THEN 8 when 'float4' THEN 8 when 'double precision' THEN 17 when 'float8' THEN 17 when 'float' THEN 17 when 'numeric' THEN (atttypmod - 4) >> 16 when '_float4' THEN 8 when 'timestamptz' THEN 35 when 'oid' THEN 10 when '_int4' THEN 10 when '_int2' THEN 5 when 'geometry' THEN NULL when 'super' THEN NULL else 2147483647 end as COLUMN_SIZE , null as BUFFER_LENGTH , case typname when 'float4' then 8 when 'float8' then 17 when 'numeric' then (atttypmod - 4) & 65535 when 'timestamp' then 6 when 'geometry' then NULL when 'super' then NULL else 0 end as DECIMAL_DIGITS, 10 AS NUM_PREC_RADIX , case a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) when 'false' then 1 when NULL then 2 else 0 end AS NULLABLE , dsc.description as REMARKS , pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS COLUMN_DEF, CAST(case typname when 'text' THEN 12 when 'bit' THEN -7 when 'bool' THEN -7 when 'boolean' THEN -7 when 'varchar' THEN 12 when 'character varying' THEN 12 when '\\\"char\\\"' THEN 1 when 'char' THEN 1 when 'character' THEN 1 when 'nchar' THEN 1 when 'bpchar' THEN 1 when 'nvarchar' THEN 12 when 'date' THEN 91 when 'timestamp' THEN 93 when 'timestamp without time zone' THEN 93 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 4 when 'int' THEN 4 when 'int4' THEN 4 when 'bigint' THEN -5 when 'int8' THEN -5 when 'decimal' THEN 3 when 'real' THEN 7 when 'float4' THEN 7 when 'double precision' THEN 8 when 'float8' THEN 8 when 'float' THEN 6 when 'numeric' THEN 2 when '_float4' THEN 2003 when 'timestamptz' THEN 2014 when 'timestamp with time zone' THEN 2014 when '_aclitem' THEN 2003 when '_text' THEN 2003 when 'bytea' THEN -2 when 'oid' THEN -5 when 'name' THEN 12 when '_int4' THEN 2003 when '_int2' THEN 2003 when 'ARRAY' THEN 2003 when 'geometry' THEN -4 when 'super' THEN -16 else 1111 END as SMALLINT) AS SQL_DATA_TYPE, CAST(NULL AS SMALLINT) as SQL_DATETIME_SUB , case typname when 'int4' THEN 10 when 'bit' THEN 1 when 'bool' THEN 1 when 'varchar' THEN atttypmod -4 when 'character varying' THEN atttypmod -4 when 'char' THEN atttypmod -4 when 'character' THEN atttypmod -4 when 'nchar' THEN atttypmod -4 when 'bpchar' THEN atttypmod -4 when 'nvarchar' THEN atttypmod -4 when 'date' THEN 13 when 'timestamp' THEN 29 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 10 when 'int' THEN 10 when 'int4' THEN 10 when 'bigint' THEN 19 when 'int8' THEN 19 when 'decimal' then ((atttypmod - 4) >> 16) & 65535 when 'real' THEN 8 when 'float4' THEN 8 when 'double precision' THEN 17 when 'float8' THEN 17 when 'float' THEN 17 when 'numeric' THEN ((atttypmod - 4) >> 16) & 65535 when '_float4' THEN 8 when 'timestamptz' THEN 35 when 'oid' THEN 10 when '_int4' THEN 10 when '_int2' THEN 5 when 'geometry' THEN NULL when 'super' THEN NULL else 2147483647 end as CHAR_OCTET_LENGTH , a.attnum AS ORDINAL_POSITION, case a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) when 'false' then 'YES' when NULL then '' else 'NO' end AS IS_NULLABLE, null as SCOPE_CATALOG , null as SCOPE_SCHEMA , null as SCOPE_TABLE, t.typbasetype AS SOURCE_DATA_TYPE , CASE WHEN left(pg_catalog.pg_get_expr(def.adbin, def.adrelid), 16) = 'default_identity' THEN 'YES' ELSE 'NO' END AS IS_AUTOINCREMENT, IS_AUTOINCREMENT AS IS_GENERATEDCOLUMN FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid) JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') WHERE a.attnum > 0 AND NOT a.attisdropped AND current_database() = 'cubedb' AND n.nspname LIKE 'public' AND c.relname LIKE 'KibanaSampleDataEcommerce' ORDER BY TABLE_SCHEM,c.relname,attnum ) UNION ALL SELECT current_database()::VARCHAR(128) AS TABLE_CAT, schemaname::varchar(128) AS table_schem, tablename::varchar(128) AS table_name, columnname::varchar(128) AS column_name, CAST(CASE columntype_rep WHEN 'text' THEN 12 WHEN 'bit' THEN -7 WHEN 'bool' THEN -7 WHEN 'boolean' THEN -7 WHEN 'varchar' THEN 12 WHEN 'character varying' THEN 12 WHEN 'char' THEN 1 WHEN 'character' THEN 1 WHEN 'nchar' THEN 1 WHEN 'bpchar' THEN 1 WHEN 'nvarchar' THEN 12 WHEN '\\\"char\\\"' THEN 1 WHEN 'date' THEN 91 WHEN 'timestamp' THEN 93 WHEN 'timestamp without time zone' THEN 93 WHEN 'timestamp with time zone' THEN 2014 WHEN 'smallint' THEN 5 WHEN 'int2' THEN 5 WHEN 'integer' THEN 4 WHEN 'int' THEN 4 WHEN 'int4' THEN 4 WHEN 'bigint' THEN -5 WHEN 'int8' THEN -5 WHEN 'decimal' THEN 3 WHEN 'real' THEN 7 WHEN 'float4' THEN 7 WHEN 'double precision' THEN 8 WHEN 'float8' THEN 8 WHEN 'float' THEN 6 WHEN 'numeric' THEN 2 WHEN 'timestamptz' THEN 2014 WHEN 'bytea' THEN -2 WHEN 'oid' THEN -5 WHEN 'name' THEN 12 WHEN 'ARRAY' THEN 2003 WHEN 'geometry' THEN -4 WHEN 'super' THEN -16 ELSE 1111 END AS SMALLINT) AS DATA_TYPE, COALESCE(NULL,CASE columntype WHEN 'boolean' THEN 'bool' WHEN 'character varying' THEN 'varchar' WHEN '\\\"char\\\"' THEN 'char' WHEN 'smallint' THEN 'int2' WHEN 'integer' THEN 'int4'WHEN 'bigint' THEN 'int8' WHEN 'real' THEN 'float4' WHEN 'double precision' THEN 'float8' WHEN 'timestamp without time zone' THEN 'timestamp' WHEN 'timestamp with time zone' THEN 'timestamptz' ELSE columntype END) AS TYPE_NAME, CASE columntype_rep WHEN 'int4' THEN 10 WHEN 'bit' THEN 1 WHEN 'bool' THEN 1WHEN 'boolean' THEN 1WHEN 'varchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'character varying' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'char' THEN regexp_substr (columntype,'[0-9]+',4)::INTEGER WHEN 'character' THEN regexp_substr (columntype,'[0-9]+',4)::INTEGER WHEN 'nchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'bpchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'nvarchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'date' THEN 13 WHEN 'timestamp' THEN 29 WHEN 'timestamp without time zone' THEN 29 WHEN 'smallint' THEN 5 WHEN 'int2' THEN 5 WHEN 'integer' THEN 10 WHEN 'int' THEN 10 WHEN 'int4' THEN 10 WHEN 'bigint' THEN 19 WHEN 'int8' THEN 19 WHEN 'decimal' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'real' THEN 8 WHEN 'float4' THEN 8 WHEN 'double precision' THEN 17 WHEN 'float8' THEN 17 WHEN 'float' THEN 17WHEN 'numeric' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN '_float4' THEN 8 WHEN 'timestamptz' THEN 35 WHEN 'timestamp with time zone' THEN 35 WHEN 'oid' THEN 10 WHEN '_int4' THEN 10 WHEN '_int2' THEN 5 WHEN 'geometry' THEN NULL WHEN 'super' THEN NULL ELSE 2147483647 END AS COLUMN_SIZE, NULL AS BUFFER_LENGTH, CASE columntype WHEN 'real' THEN 8 WHEN 'float4' THEN 8 WHEN 'double precision' THEN 17 WHEN 'float8' THEN 17 WHEN 'timestamp' THEN 6 WHEN 'timestamp without time zone' THEN 6 WHEN 'geometry' THEN NULL WHEN 'super' THEN NULL ELSE 0 END AS DECIMAL_DIGITS, 10 AS NUM_PREC_RADIX, NULL AS NULLABLE, NULL AS REMARKS, NULL AS COLUMN_DEF, CAST(CASE columntype_rep WHEN 'text' THEN 12 WHEN 'bit' THEN -7 WHEN 'bool' THEN -7 WHEN 'boolean' THEN -7 WHEN 'varchar' THEN 12 WHEN 'character varying' THEN 12 WHEN 'char' THEN 1 WHEN 'character' THEN 1 WHEN 'nchar' THEN 12 WHEN 'bpchar' THEN 1 WHEN 'nvarchar' THEN 12 WHEN '\\\"char\\\"' THEN 1 WHEN 'date' THEN 91 WHEN 'timestamp' THEN 93 WHEN 'timestamp without time zone' THEN 93 WHEN 'timestamp with time zone' THEN 2014 WHEN 'smallint' THEN 5 WHEN 'int2' THEN 5 WHEN 'integer' THEN 4 WHEN 'int' THEN 4 WHEN 'int4' THEN 4 WHEN 'bigint' THEN -5 WHEN 'int8' THEN -5 WHEN 'decimal' THEN 3 WHEN 'real' THEN 7 WHEN 'float4' THEN 7 WHEN 'double precision' THEN 8 WHEN 'float8' THEN 8 WHEN 'float' THEN 6 WHEN 'numeric' THEN 2 WHEN 'timestamptz' THEN 2014 WHEN 'bytea' THEN -2 WHEN 'oid' THEN -5 WHEN 'name' THEN 12 WHEN 'ARRAY' THEN 2003 WHEN 'geometry' THEN -4 WHEN 'super' THEN -4 ELSE 1111 END AS SMALLINT) AS SQL_DATA_TYPE, CAST(NULL AS SMALLINT) AS SQL_DATETIME_SUB, CASE WHEN LEFT (columntype,7) = 'varchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN LEFT (columntype,4) = 'char' THEN regexp_substr (columntype,'[0-9]+',4)::INTEGER WHEN columntype = 'string' THEN 16383 ELSE NULL END AS CHAR_OCTET_LENGTH, columnnum AS ORDINAL_POSITION, NULL AS IS_NULLABLE, NULL AS SCOPE_CATALOG, NULL AS SCOPE_SCHEMA, NULL AS SCOPE_TABLE, NULL AS SOURCE_DATA_TYPE, 'NO' AS IS_AUTOINCREMENT, 'NO' as IS_GENERATEDCOLUMN FROM (select lbv_cols.schemaname, lbv_cols.tablename, lbv_cols.columnname,REGEXP_REPLACE(REGEXP_REPLACE(lbv_cols.columntype,'\\\\\\\\(.*\\\\\\\\)'),'^_.+','ARRAY') as columntype_rep,columntype, lbv_cols.columnnum from pg_get_late_binding_view_cols() lbv_cols( schemaname name, tablename name, columnname name, columntype text, columnnum int)) lbv_columns WHERE true AND current_database() = 'cubedb' AND schemaname LIKE 'public' AND tablename LIKE 'KibanaSampleDataEcommerce';\".to_string(),\n DatabaseProtocol::PostgreSQL).await?" +expression: "execute_query(\"SELECT * FROM ( SELECT current_database() AS TABLE_CAT, n.nspname AS TABLE_SCHEM, c.relname as TABLE_NAME , a.attname as COLUMN_NAME, CAST(case typname when 'text' THEN 12 when 'bit' THEN -7 when 'bool' THEN -7 when 'boolean' THEN -7 when 'varchar' THEN 12 when 'character varying' THEN 12 when 'char' THEN 1 when '\\\"char\\\"' THEN 1 when 'character' THEN 1 when 'nchar' THEN 12 when 'bpchar' THEN 1 when 'nvarchar' THEN 12 when 'date' THEN 91 when 'timestamp' THEN 93 when 'timestamp without time zone' THEN 93 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 4 when 'int' THEN 4 when 'int4' THEN 4 when 'bigint' THEN -5 when 'int8' THEN -5 when 'decimal' THEN 3 when 'real' THEN 7 when 'float4' THEN 7 when 'double precision' THEN 8 when 'float8' THEN 8 when 'float' THEN 6 when 'numeric' THEN 2 when '_float4' THEN 2003 when 'timestamptz' THEN 2014 when 'timestamp with time zone' THEN 2014 when '_aclitem' THEN 2003 when '_text' THEN 2003 when 'bytea' THEN -2 when 'oid' THEN -5 when 'name' THEN 12 when '_int4' THEN 2003 when '_int2' THEN 2003 when 'ARRAY' THEN 2003 when 'geometry' THEN -4 when 'super' THEN -16 else 1111 END as SMALLINT) AS DATA_TYPE, t.typname as TYPE_NAME, case typname when 'int4' THEN 10 when 'bit' THEN 1 when 'bool' THEN 1 when 'varchar' THEN atttypmod -4 when 'character varying' THEN atttypmod -4 when 'char' THEN atttypmod -4 when 'character' THEN atttypmod -4 when 'nchar' THEN atttypmod -4 when 'bpchar' THEN atttypmod -4 when 'nvarchar' THEN atttypmod -4 when 'date' THEN 13 when 'timestamp' THEN 29 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 10 when 'int' THEN 10 when 'int4' THEN 10 when 'bigint' THEN 19 when 'int8' THEN 19 when 'decimal' then (atttypmod - 4) >> 16 when 'real' THEN 8 when 'float4' THEN 8 when 'double precision' THEN 17 when 'float8' THEN 17 when 'float' THEN 17 when 'numeric' THEN (atttypmod - 4) >> 16 when '_float4' THEN 8 when 'timestamptz' THEN 35 when 'oid' THEN 10 when '_int4' THEN 10 when '_int2' THEN 5 when 'geometry' THEN NULL when 'super' THEN NULL else 2147483647 end as COLUMN_SIZE , null as BUFFER_LENGTH , case typname when 'float4' then 8 when 'float8' then 17 when 'numeric' then (atttypmod - 4) & 65535 when 'timestamp' then 6 when 'geometry' then NULL when 'super' then NULL else 0 end as DECIMAL_DIGITS, 10 AS NUM_PREC_RADIX , case a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) when 'false' then 1 when NULL then 2 else 0 end AS NULLABLE , dsc.description as REMARKS , pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS COLUMN_DEF, CAST(case typname when 'text' THEN 12 when 'bit' THEN -7 when 'bool' THEN -7 when 'boolean' THEN -7 when 'varchar' THEN 12 when 'character varying' THEN 12 when '\\\"char\\\"' THEN 1 when 'char' THEN 1 when 'character' THEN 1 when 'nchar' THEN 1 when 'bpchar' THEN 1 when 'nvarchar' THEN 12 when 'date' THEN 91 when 'timestamp' THEN 93 when 'timestamp without time zone' THEN 93 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 4 when 'int' THEN 4 when 'int4' THEN 4 when 'bigint' THEN -5 when 'int8' THEN -5 when 'decimal' THEN 3 when 'real' THEN 7 when 'float4' THEN 7 when 'double precision' THEN 8 when 'float8' THEN 8 when 'float' THEN 6 when 'numeric' THEN 2 when '_float4' THEN 2003 when 'timestamptz' THEN 2014 when 'timestamp with time zone' THEN 2014 when '_aclitem' THEN 2003 when '_text' THEN 2003 when 'bytea' THEN -2 when 'oid' THEN -5 when 'name' THEN 12 when '_int4' THEN 2003 when '_int2' THEN 2003 when 'ARRAY' THEN 2003 when 'geometry' THEN -4 when 'super' THEN -16 else 1111 END as SMALLINT) AS SQL_DATA_TYPE, CAST(NULL AS SMALLINT) as SQL_DATETIME_SUB , case typname when 'int4' THEN 10 when 'bit' THEN 1 when 'bool' THEN 1 when 'varchar' THEN atttypmod -4 when 'character varying' THEN atttypmod -4 when 'char' THEN atttypmod -4 when 'character' THEN atttypmod -4 when 'nchar' THEN atttypmod -4 when 'bpchar' THEN atttypmod -4 when 'nvarchar' THEN atttypmod -4 when 'date' THEN 13 when 'timestamp' THEN 29 when 'smallint' THEN 5 when 'int2' THEN 5 when 'integer' THEN 10 when 'int' THEN 10 when 'int4' THEN 10 when 'bigint' THEN 19 when 'int8' THEN 19 when 'decimal' then ((atttypmod - 4) >> 16) & 65535 when 'real' THEN 8 when 'float4' THEN 8 when 'double precision' THEN 17 when 'float8' THEN 17 when 'float' THEN 17 when 'numeric' THEN ((atttypmod - 4) >> 16) & 65535 when '_float4' THEN 8 when 'timestamptz' THEN 35 when 'oid' THEN 10 when '_int4' THEN 10 when '_int2' THEN 5 when 'geometry' THEN NULL when 'super' THEN NULL else 2147483647 end as CHAR_OCTET_LENGTH , a.attnum AS ORDINAL_POSITION, case a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) when 'false' then 'YES' when NULL then '' else 'NO' end AS IS_NULLABLE, null as SCOPE_CATALOG , null as SCOPE_SCHEMA , null as SCOPE_TABLE, t.typbasetype AS SOURCE_DATA_TYPE , CASE WHEN left(pg_catalog.pg_get_expr(def.adbin, def.adrelid), 16) = 'default_identity' THEN 'YES' ELSE 'NO' END AS IS_AUTOINCREMENT, IS_AUTOINCREMENT AS IS_GENERATEDCOLUMN FROM pg_catalog.pg_namespace n JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid) JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid) LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') WHERE a.attnum > 0 AND NOT a.attisdropped AND current_database() = 'cubedb' AND n.nspname LIKE 'public' AND c.relname LIKE 'KibanaSampleDataEcommerce' ORDER BY TABLE_SCHEM,c.relname,attnum ) UNION ALL SELECT current_database()::VARCHAR(128) AS TABLE_CAT, schemaname::varchar(128) AS table_schem, tablename::varchar(128) AS table_name, columnname::varchar(128) AS column_name, CAST(CASE columntype_rep WHEN 'text' THEN 12 WHEN 'bit' THEN -7 WHEN 'bool' THEN -7 WHEN 'boolean' THEN -7 WHEN 'varchar' THEN 12 WHEN 'character varying' THEN 12 WHEN 'char' THEN 1 WHEN 'character' THEN 1 WHEN 'nchar' THEN 1 WHEN 'bpchar' THEN 1 WHEN 'nvarchar' THEN 12 WHEN '\\\"char\\\"' THEN 1 WHEN 'date' THEN 91 WHEN 'timestamp' THEN 93 WHEN 'timestamp without time zone' THEN 93 WHEN 'timestamp with time zone' THEN 2014 WHEN 'smallint' THEN 5 WHEN 'int2' THEN 5 WHEN 'integer' THEN 4 WHEN 'int' THEN 4 WHEN 'int4' THEN 4 WHEN 'bigint' THEN -5 WHEN 'int8' THEN -5 WHEN 'decimal' THEN 3 WHEN 'real' THEN 7 WHEN 'float4' THEN 7 WHEN 'double precision' THEN 8 WHEN 'float8' THEN 8 WHEN 'float' THEN 6 WHEN 'numeric' THEN 2 WHEN 'timestamptz' THEN 2014 WHEN 'bytea' THEN -2 WHEN 'oid' THEN -5 WHEN 'name' THEN 12 WHEN 'ARRAY' THEN 2003 WHEN 'geometry' THEN -4 WHEN 'super' THEN -16 ELSE 1111 END AS SMALLINT) AS DATA_TYPE, COALESCE(NULL,CASE columntype WHEN 'boolean' THEN 'bool' WHEN 'character varying' THEN 'varchar' WHEN '\\\"char\\\"' THEN 'char' WHEN 'smallint' THEN 'int2' WHEN 'integer' THEN 'int4'WHEN 'bigint' THEN 'int8' WHEN 'real' THEN 'float4' WHEN 'double precision' THEN 'float8' WHEN 'timestamp without time zone' THEN 'timestamp' WHEN 'timestamp with time zone' THEN 'timestamptz' ELSE columntype END) AS TYPE_NAME, CASE columntype_rep WHEN 'int4' THEN 10 WHEN 'bit' THEN 1 WHEN 'bool' THEN 1WHEN 'boolean' THEN 1WHEN 'varchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'character varying' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'char' THEN regexp_substr (columntype,'[0-9]+',4)::INTEGER WHEN 'character' THEN regexp_substr (columntype,'[0-9]+',4)::INTEGER WHEN 'nchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'bpchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'nvarchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'date' THEN 13 WHEN 'timestamp' THEN 29 WHEN 'timestamp without time zone' THEN 29 WHEN 'smallint' THEN 5 WHEN 'int2' THEN 5 WHEN 'integer' THEN 10 WHEN 'int' THEN 10 WHEN 'int4' THEN 10 WHEN 'bigint' THEN 19 WHEN 'int8' THEN 19 WHEN 'decimal' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN 'real' THEN 8 WHEN 'float4' THEN 8 WHEN 'double precision' THEN 17 WHEN 'float8' THEN 17 WHEN 'float' THEN 17WHEN 'numeric' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN '_float4' THEN 8 WHEN 'timestamptz' THEN 35 WHEN 'timestamp with time zone' THEN 35 WHEN 'oid' THEN 10 WHEN '_int4' THEN 10 WHEN '_int2' THEN 5 WHEN 'geometry' THEN NULL WHEN 'super' THEN NULL ELSE 2147483647 END AS COLUMN_SIZE, NULL AS BUFFER_LENGTH, CASE columntype WHEN 'real' THEN 8 WHEN 'float4' THEN 8 WHEN 'double precision' THEN 17 WHEN 'float8' THEN 17 WHEN 'timestamp' THEN 6 WHEN 'timestamp without time zone' THEN 6 WHEN 'geometry' THEN NULL WHEN 'super' THEN NULL ELSE 0 END AS DECIMAL_DIGITS, 10 AS NUM_PREC_RADIX, NULL AS NULLABLE, NULL AS REMARKS, NULL AS COLUMN_DEF, CAST(CASE columntype_rep WHEN 'text' THEN 12 WHEN 'bit' THEN -7 WHEN 'bool' THEN -7 WHEN 'boolean' THEN -7 WHEN 'varchar' THEN 12 WHEN 'character varying' THEN 12 WHEN 'char' THEN 1 WHEN 'character' THEN 1 WHEN 'nchar' THEN 12 WHEN 'bpchar' THEN 1 WHEN 'nvarchar' THEN 12 WHEN '\\\"char\\\"' THEN 1 WHEN 'date' THEN 91 WHEN 'timestamp' THEN 93 WHEN 'timestamp without time zone' THEN 93 WHEN 'timestamp with time zone' THEN 2014 WHEN 'smallint' THEN 5 WHEN 'int2' THEN 5 WHEN 'integer' THEN 4 WHEN 'int' THEN 4 WHEN 'int4' THEN 4 WHEN 'bigint' THEN -5 WHEN 'int8' THEN -5 WHEN 'decimal' THEN 3 WHEN 'real' THEN 7 WHEN 'float4' THEN 7 WHEN 'double precision' THEN 8 WHEN 'float8' THEN 8 WHEN 'float' THEN 6 WHEN 'numeric' THEN 2 WHEN 'timestamptz' THEN 2014 WHEN 'bytea' THEN -2 WHEN 'oid' THEN -5 WHEN 'name' THEN 12 WHEN 'ARRAY' THEN 2003 WHEN 'geometry' THEN -4 WHEN 'super' THEN -4 ELSE 1111 END AS SMALLINT) AS SQL_DATA_TYPE, CAST(NULL AS SMALLINT) AS SQL_DATETIME_SUB, CASE WHEN LEFT (columntype,7) = 'varchar' THEN regexp_substr (columntype,'[0-9]+',7)::INTEGER WHEN LEFT (columntype,4) = 'char' THEN regexp_substr (columntype,'[0-9]+',4)::INTEGER WHEN columntype = 'string' THEN 16383 ELSE NULL END AS CHAR_OCTET_LENGTH, columnnum AS ORDINAL_POSITION, NULL AS IS_NULLABLE, NULL AS SCOPE_CATALOG, NULL AS SCOPE_SCHEMA, NULL AS SCOPE_TABLE, NULL AS SOURCE_DATA_TYPE, 'NO' AS IS_AUTOINCREMENT, 'NO' as IS_GENERATEDCOLUMN FROM (select lbv_cols.schemaname, lbv_cols.tablename, lbv_cols.columnname,REGEXP_REPLACE(REGEXP_REPLACE(lbv_cols.columntype,'\\\\\\\\(.*\\\\\\\\)'),'^_.+','ARRAY') as columntype_rep,columntype, lbv_cols.columnnum from pg_get_late_binding_view_cols() lbv_cols( schemaname name, tablename name, columnname name, columntype text, columnnum int)) lbv_columns WHERE true AND current_database() = 'cubedb' AND schemaname LIKE 'public' AND tablename LIKE 'KibanaSampleDataEcommerce';\".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ -| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SCOPE_CATALOG | SCOPE_SCHEMA | SCOPE_TABLE | SOURCE_DATA_TYPE | IS_AUTOINCREMENT | IS_GENERATEDCOLUMN | -+-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ -| cubedb | public | KibanaSampleDataEcommerce | count | -5 | int8 | 19 | NULL | 0 | 10 | NULL | NULL | NULL | -5 | NULL | 19 | 1 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | maxPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 2 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | sumPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 3 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | minPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 4 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | avgPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 5 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | countDistinct | -5 | int8 | 19 | NULL | 0 | 10 | NULL | NULL | NULL | -5 | NULL | 19 | 6 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | order_date | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 7 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | last_mod | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 8 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | customer_gender | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 9 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | notes | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 10 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | taxful_total_price | 2 | numeric | -1 | NULL | 65531 | 10 | 1 | NULL | NULL | 2 | NULL | 65535 | 11 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | has_subscription | -7 | bool | 1 | NULL | 0 | 10 | 1 | NULL | NULL | -7 | NULL | 1 | 12 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | is_male | -7 | bool | 1 | NULL | 0 | 10 | NULL | NULL | NULL | -7 | NULL | 1 | 13 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | is_female | -7 | bool | 1 | NULL | 0 | 10 | NULL | NULL | NULL | -7 | NULL | 1 | 14 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | __user | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 15 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | __cubeJoinField | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 16 | YES | NULL | NULL | NULL | 0 | NO | false | -+-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ ++-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+-----------------------------------------------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ +| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SCOPE_CATALOG | SCOPE_SCHEMA | SCOPE_TABLE | SOURCE_DATA_TYPE | IS_AUTOINCREMENT | IS_GENERATEDCOLUMN | ++-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+-----------------------------------------------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ +| cubedb | public | KibanaSampleDataEcommerce | count | -5 | int8 | 19 | NULL | 0 | 10 | NULL | Events count | NULL | -5 | NULL | 19 | 1 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | maxPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 2 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | sumPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 3 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | minPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 4 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | avgPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 5 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | countDistinct | -5 | int8 | 19 | NULL | 0 | 10 | NULL | NULL | NULL | -5 | NULL | 19 | 6 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | order_date | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 7 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | last_mod | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 8 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | customer_gender | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | Customer gender | NULL | 12 | NULL | 2147483647 | 9 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | notes | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 10 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | taxful_total_price | 2 | numeric | -1 | NULL | 65531 | 10 | 1 | NULL | NULL | 2 | NULL | 65535 | 11 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | has_subscription | -7 | bool | 1 | NULL | 0 | 10 | 1 | NULL | NULL | -7 | NULL | 1 | 12 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | is_male | -7 | bool | 1 | NULL | 0 | 10 | NULL | Male users segment | NULL | -7 | NULL | 1 | 13 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | is_female | -7 | bool | 1 | NULL | 0 | 10 | NULL | NULL | NULL | -7 | NULL | 1 | 14 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | __user | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | Virtual column for security context switching | NULL | 12 | NULL | 2147483647 | 15 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | __cubeJoinField | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | Virtual column for joining cubes | NULL | 12 | NULL | 2147483647 | 16 | YES | NULL | NULL | NULL | 0 | NO | false | ++-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+-----------------------------------------------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ diff --git a/rust/cubesql/cubesql/src/compile/test/mod.rs b/rust/cubesql/cubesql/src/compile/test/mod.rs index 4b662f89ed15e..999960e3609ba 100644 --- a/rust/cubesql/cubesql/src/compile/test/mod.rs +++ b/rust/cubesql/cubesql/src/compile/test/mod.rs @@ -31,6 +31,8 @@ pub mod rewrite_engine; #[cfg(test)] pub mod test_bi_workarounds; #[cfg(test)] +pub mod test_df_execution; +#[cfg(test)] pub mod test_introspection; #[cfg(test)] pub mod test_udfs; @@ -41,7 +43,7 @@ pub fn get_test_meta() -> Vec { vec![ CubeMeta { name: "KibanaSampleDataEcommerce".to_string(), - description: None, + description: Some("Sample data for tracking eCommerce orders from Kibana".to_string()), title: None, dimensions: vec![ CubeMetaDimension { @@ -56,7 +58,7 @@ pub fn get_test_meta() -> Vec { }, CubeMetaDimension { name: "KibanaSampleDataEcommerce.customer_gender".to_string(), - description: None, + description: Some("Customer gender".to_string()), _type: "string".to_string(), }, CubeMetaDimension { @@ -79,7 +81,7 @@ pub fn get_test_meta() -> Vec { CubeMetaMeasure { name: "KibanaSampleDataEcommerce.count".to_string(), title: None, - description: None, + description: Some("Events count".to_string()), _type: "number".to_string(), agg_type: Some("count".to_string()), }, @@ -261,24 +263,24 @@ pub fn get_test_meta() -> Vec { }, CubeMeta { name: "MultiTypeCube".to_string(), - description: None, + description: Some("Test cube with a little bit of everything".to_string()), title: None, dimensions: (0..10) .flat_map(|i| { [ CubeMetaDimension { name: format!("MultiTypeCube.dim_num{}", i), - description: None, + description: Some(format!("Test numeric dimention {i}")), _type: "number".to_string(), }, CubeMetaDimension { name: format!("MultiTypeCube.dim_str{}", i), - description: None, + description: Some(format!("Test string dimention {i}")), _type: "string".to_string(), }, CubeMetaDimension { name: format!("MultiTypeCube.dim_date{}", i), - description: None, + description: Some(format!("Test time dimention {i}")), _type: "time".to_string(), }, ] @@ -292,21 +294,21 @@ pub fn get_test_meta() -> Vec { _type: "number".to_string(), agg_type: Some("number".to_string()), title: None, - description: None, + description: Some(format!("Test number measure {i}")), }, CubeMetaMeasure { name: format!("MultiTypeCube.measure_str{}", i), _type: "string".to_string(), agg_type: Some("max".to_string()), title: None, - description: None, + description: Some(format!("Test max(string) measure {i}")), }, CubeMetaMeasure { name: format!("MultiTypeCube.measure_date{}", i), _type: "time".to_string(), agg_type: Some("max".to_string()), title: None, - description: None, + description: Some(format!("Test max(time) measure {i}")), }, ] }) @@ -315,35 +317,35 @@ pub fn get_test_meta() -> Vec { CubeMetaMeasure { name: "MultiTypeCube.count".to_string(), title: None, - description: None, + description: Some("Test count measure".to_string()), _type: "number".to_string(), agg_type: Some("count".to_string()), }, CubeMetaMeasure { name: "MultiTypeCube.maxPrice".to_string(), title: None, - description: None, + description: Some("Test maxPrice measure".to_string()), _type: "number".to_string(), agg_type: Some("max".to_string()), }, CubeMetaMeasure { name: "MultiTypeCube.minPrice".to_string(), title: None, - description: None, + description: Some("Test minPrice measure".to_string()), _type: "number".to_string(), agg_type: Some("min".to_string()), }, CubeMetaMeasure { name: "MultiTypeCube.avgPrice".to_string(), title: None, - description: None, + description: Some("Test avgPrice measure".to_string()), _type: "number".to_string(), agg_type: Some("avg".to_string()), }, CubeMetaMeasure { name: "MultiTypeCube.countDistinct".to_string(), title: None, - description: None, + description: Some("Test countDistinct measure".to_string()), _type: "number".to_string(), agg_type: Some("countDistinct".to_string()), }, @@ -915,14 +917,10 @@ impl TestContext { } } -lazy_static! { - pub static ref TEST_LOGGING_INITIALIZED: std::sync::RwLock = - std::sync::RwLock::new(false); -} +static TEST_LOGGING_INITIALIZED: std::sync::Once = std::sync::Once::new(); pub fn init_testing_logger() { - let mut initialized = TEST_LOGGING_INITIALIZED.write().unwrap(); - if !*initialized { + TEST_LOGGING_INITIALIZED.call_once(|| { let log_level = log::Level::Trace; let logger = simple_logger::SimpleLogger::new() .with_level(log::Level::Error.to_level_filter()) @@ -933,8 +931,7 @@ pub fn init_testing_logger() { log::set_boxed_logger(Box::new(logger)).unwrap(); log::set_max_level(log_level.to_level_filter()); - *initialized = true; - } + }); } pub async fn convert_select_to_query_plan_customized( diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_df_execution__join_with_coercion.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_df_execution__join_with_coercion.snap new file mode 100644 index 0000000000000..2c7e4b8928da7 --- /dev/null +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_df_execution__join_with_coercion.snap @@ -0,0 +1,9 @@ +--- +source: cubesql/src/compile/test/test_df_execution.rs +expression: "execute_query(r#\"\n WITH\n t1 AS (\n SELECT 1::int2 AS i1\n ),\n t2 AS (\n SELECT 1::int4 AS i2\n )\n SELECT\n *\n FROM\n t1 LEFT JOIN t2 ON (t1.i1 = t2.i2)\n \"#.to_string(),\nDatabaseProtocol::PostgreSQL,).await.unwrap()" +--- ++----+----+ +| i1 | i2 | ++----+----+ +| 1 | 1 | ++----+----+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_df_execution__triple_join_with_coercion.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_df_execution__triple_join_with_coercion.snap new file mode 100644 index 0000000000000..607514df95b8c --- /dev/null +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_df_execution__triple_join_with_coercion.snap @@ -0,0 +1,9 @@ +--- +source: cubesql/src/compile/test/test_df_execution.rs +expression: "execute_query(r#\"\n WITH\n t1 AS (\n SELECT 1::int2 AS i1\n ),\n t2 AS (\n SELECT 1::int4 AS i2\n ),\n t3 AS (\n SELECT 1::int8 AS i3\n )\n SELECT\n *\n FROM\n t1\n LEFT JOIN t2 ON (t1.i1 = t2.i2)\n LEFT JOIN t3 ON (t3.i3 = t2.i2)\n \"#.to_string(),\nDatabaseProtocol::PostgreSQL,).await.unwrap()" +--- ++----+----+----+ +| i1 | i2 | i3 | ++----+----+----+ +| 1 | 1 | 1 | ++----+----+----+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_large_select_query.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_large_select_query.snap index 6bf1754107e6b..4d8a3a0f57060 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_large_select_query.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_large_select_query.snap @@ -2,23 +2,23 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(\"\n SELECT\n na.nspname as Schema,\n cl.relname as Table,\n att.attname AS Name,\n att.attnum as Position,\n CASE\n WHEN att.attnotnull = 'f' THEN 'true'\n ELSE 'false'\n END as Nullable,\n CASE\n WHEN\n ty.typname Like 'bit' OR\n ty.typname Like 'varbit' and\n att.atttypmod > 0\n THEN att.atttypmod\n WHEN ty.typname Like 'interval' THEN -1\n WHEN att.atttypmod > 0 THEN att.atttypmod - 4\n ELSE att.atttypmod\n END as Length,\n (information_schema._pg_numeric_precision(information_schema._pg_truetypid(att.*, ty.*), information_schema._pg_truetypmod(att.*, ty.*)))::information_schema.cardinal_number AS Precision,\n (information_schema._pg_numeric_scale(information_schema._pg_truetypid(att.*, ty.*), information_schema._pg_truetypmod(att.*, ty.*)))::information_schema.cardinal_number AS Scale,\n (information_schema._pg_datetime_precision(information_schema._pg_truetypid(att.*, ty.*), information_schema._pg_truetypmod(att.*, ty.*)))::information_schema.cardinal_number AS DatetimeLength,\n CASE\n WHEN att.attnotnull = 'f' THEN 'false'\n ELSE 'true'\n END as IsUnique,\n att.atthasdef as HasDefaultValue,\n att.attisdropped as IsDropped,\n att.attinhcount as ancestorCount,\n att.attndims as Dimension,\n CASE\n WHEN attndims > 0 THEN true\n ELSE false\n END AS isarray,\n CASE\n WHEN ty.typname = 'bpchar' THEN 'char'\n WHEN ty.typname = '_bpchar' THEN '_char'\n ELSE ty.typname\n END as TypeName,\n tn.nspname as TypeSchema,\n et.typname as elementaltypename,\n description as Comment,\n cs.relname AS sername,\n ns.nspname AS serschema,\n att.attidentity as IdentityMode,\n CAST(pg_get_expr(def.adbin, def.adrelid) AS varchar) as DefaultValue,\n (SELECT count(1) FROM pg_type t2 WHERE t2.typname=ty.typname) > 1 AS isdup\n FROM pg_attribute att\n JOIN pg_type ty ON ty.oid=atttypid\n JOIN pg_namespace tn ON tn.oid=ty.typnamespace\n JOIN pg_class cl ON\n cl.oid=attrelid AND\n (\n (cl.relkind = 'r') OR\n (cl.relkind = 's') OR\n (cl.relkind = 'v') OR\n (cl.relkind = 'm') OR\n (cl.relkind = 'f')\n )\n JOIN pg_namespace na ON na.oid=cl.relnamespace\n LEFT OUTER JOIN pg_type et ON et.oid=ty.typelem\n LEFT OUTER JOIN pg_attrdef def ON\n adrelid=attrelid AND\n adnum=attnum\n LEFT OUTER JOIN pg_description des ON\n des.objoid=attrelid AND\n des.objsubid=attnum\n LEFT OUTER JOIN (\n pg_depend\n JOIN pg_class cs ON\n objid=cs.oid AND\n cs.relkind='S' AND\n classid='pg_class'::regclass::oid\n ) ON\n refobjid=attrelid AND\n refobjsubid=attnum\n LEFT OUTER JOIN pg_namespace ns ON ns.oid=cs.relnamespace\n WHERE\n attnum > 0 AND\n attisdropped IS FALSE AND\n cl.relname like E'KibanaSampleDataEcommerce' AND\n na.nspname like E'public' AND\n att.attname like '%'\n ORDER BY attnum\n ;\n \".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+--------+---------------------------+--------------------+----------+----------+--------+-----------+-------+----------------+----------+-----------------+-----------+---------------+-----------+---------+-----------+------------+-------------------+---------+---------+-----------+--------------+--------------+-------+ -| Schema | Table | Name | Position | Nullable | Length | Precision | Scale | DatetimeLength | IsUnique | HasDefaultValue | IsDropped | ancestorCount | Dimension | isarray | TypeName | TypeSchema | elementaltypename | Comment | sername | serschema | IdentityMode | DefaultValue | isdup | -+--------+---------------------------+--------------------+----------+----------+--------+-----------+-------+----------------+----------+-----------------+-----------+---------------+-----------+---------+-----------+------------+-------------------+---------+---------+-----------+--------------+--------------+-------+ -| public | KibanaSampleDataEcommerce | count | 1 | false | -1 | 64 | 0 | NULL | true | false | false | 0 | 0 | false | int8 | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | maxPrice | 2 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | sumPrice | 3 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | minPrice | 4 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | avgPrice | 5 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | countDistinct | 6 | false | -1 | 64 | 0 | NULL | true | false | false | 0 | 0 | false | int8 | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | order_date | 7 | true | -1 | NULL | NULL | 6 | false | false | false | 0 | 0 | false | timestamp | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | last_mod | 8 | true | -1 | NULL | NULL | 6 | false | false | false | 0 | 0 | false | timestamp | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | customer_gender | 9 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | notes | 10 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | taxful_total_price | 11 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | has_subscription | 12 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | bool | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | is_male | 13 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | bool | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | is_female | 14 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | bool | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | __user | 15 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -| public | KibanaSampleDataEcommerce | __cubeJoinField | 16 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | -+--------+---------------------------+--------------------+----------+----------+--------+-----------+-------+----------------+----------+-----------------+-----------+---------------+-----------+---------+-----------+------------+-------------------+---------+---------+-----------+--------------+--------------+-------+ ++--------+---------------------------+--------------------+----------+----------+--------+-----------+-------+----------------+----------+-----------------+-----------+---------------+-----------+---------+-----------+------------+-------------------+-----------------------------------------------+---------+-----------+--------------+--------------+-------+ +| Schema | Table | Name | Position | Nullable | Length | Precision | Scale | DatetimeLength | IsUnique | HasDefaultValue | IsDropped | ancestorCount | Dimension | isarray | TypeName | TypeSchema | elementaltypename | Comment | sername | serschema | IdentityMode | DefaultValue | isdup | ++--------+---------------------------+--------------------+----------+----------+--------+-----------+-------+----------------+----------+-----------------+-----------+---------------+-----------+---------+-----------+------------+-------------------+-----------------------------------------------+---------+-----------+--------------+--------------+-------+ +| public | KibanaSampleDataEcommerce | count | 1 | false | -1 | 64 | 0 | NULL | true | false | false | 0 | 0 | false | int8 | pg_catalog | NULL | Events count | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | maxPrice | 2 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | sumPrice | 3 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | minPrice | 4 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | avgPrice | 5 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | countDistinct | 6 | false | -1 | 64 | 0 | NULL | true | false | false | 0 | 0 | false | int8 | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | order_date | 7 | true | -1 | NULL | NULL | 6 | false | false | false | 0 | 0 | false | timestamp | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | last_mod | 8 | true | -1 | NULL | NULL | 6 | false | false | false | 0 | 0 | false | timestamp | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | customer_gender | 9 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | Customer gender | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | notes | 10 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | taxful_total_price | 11 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | numeric | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | has_subscription | 12 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | bool | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | is_male | 13 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | bool | pg_catalog | NULL | Male users segment | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | is_female | 14 | false | -1 | NULL | NULL | NULL | true | false | false | 0 | 0 | false | bool | pg_catalog | NULL | NULL | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | __user | 15 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | Virtual column for security context switching | NULL | NULL | | NULL | false | +| public | KibanaSampleDataEcommerce | __cubeJoinField | 16 | true | -1 | NULL | NULL | NULL | false | false | false | 0 | 0 | false | text | pg_catalog | NULL | Virtual column for joining cubes | NULL | NULL | | NULL | false | ++--------+---------------------------+--------------------+----------+----------+--------+-----------+-------+----------------+----------+-----------------+-----------+---------------+-----------+---------+-----------+------------+-------------------+-----------------------------------------------+---------+-----------+--------------+--------------+-------+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_select_db_query.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_select_db_query.snap index d54385dfdf071..6c3c50c674549 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_select_db_query.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__excel_select_db_query.snap @@ -2,12 +2,12 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(\"\n SELECT\n 'db' as Database,\n ns.nspname as Schema,\n relname as Name,\n CASE\n WHEN ns.nspname Like E'pg\\\\_catalog' then 'Catalog'\n WHEN ns.nspname Like E'information\\\\_schema' then 'Information'\n WHEN relkind = 'f' then 'Foreign'\n ELSE 'User'\n END as TableType,\n pg_get_userbyid(relowner) AS definer,\n rel.oid as Oid,\n relacl as ACL,\n true as HasOids,\n relhassubclass as HasSubtables,\n reltuples as RowNumber,\n description as Comment,\n relnatts as ColumnNumber,\n relhastriggers as TriggersNumber,\n conname as Constraint,\n conkey as ColumnConstrainsIndexes\n FROM pg_class rel\n INNER JOIN pg_namespace ns ON relnamespace = ns.oid\n LEFT OUTER JOIN pg_description des ON\n des.objoid = rel.oid AND\n des.objsubid = 0\n LEFT OUTER JOIN pg_constraint c ON\n c.conrelid = rel.oid AND\n c.contype = 'p'\n WHERE\n (\n (relkind = 'r') OR\n (relkind = 's') OR\n (relkind = 'f')\n ) AND\n NOT ns.nspname LIKE E'pg\\\\_temp\\\\_%%' AND\n NOT ns.nspname like E'pg\\\\_%' AND\n NOT ns.nspname like E'information\\\\_schema' AND\n ns.nspname::varchar like E'public' AND\n relname::varchar like '%' AND\n pg_get_userbyid(relowner)::varchar like '%'\n ORDER BY relname\n ;\n \".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+----------+--------+---------------------------+-----------+---------+-------+------+---------+--------------+-----------+---------+--------------+----------------+------------+-------------------------+ -| Database | Schema | Name | TableType | definer | Oid | ACL | HasOids | HasSubtables | RowNumber | Comment | ColumnNumber | TriggersNumber | Constraint | ColumnConstrainsIndexes | -+----------+--------+---------------------------+-----------+---------+-------+------+---------+--------------+-----------+---------+--------------+----------------+------------+-------------------------+ -| db | public | KibanaSampleDataEcommerce | User | ovr | 18000 | NULL | true | false | -1 | NULL | 16 | false | NULL | NULL | -| db | public | Logs | User | ovr | 18019 | NULL | true | false | -1 | NULL | 7 | false | NULL | NULL | -| db | public | MultiTypeCube | User | ovr | 18245 | NULL | true | false | -1 | NULL | 67 | false | NULL | NULL | -| db | public | NumberCube | User | ovr | 18029 | NULL | true | false | -1 | NULL | 3 | false | NULL | NULL | -| db | public | WideCube | User | ovr | 18035 | NULL | true | false | -1 | NULL | 207 | false | NULL | NULL | -+----------+--------+---------------------------+-----------+---------+-------+------+---------+--------------+-----------+---------+--------------+----------------+------------+-------------------------+ ++----------+--------+---------------------------+-----------+---------+-------+------+---------+--------------+-----------+-------------------------------------------------------+--------------+----------------+------------+-------------------------+ +| Database | Schema | Name | TableType | definer | Oid | ACL | HasOids | HasSubtables | RowNumber | Comment | ColumnNumber | TriggersNumber | Constraint | ColumnConstrainsIndexes | ++----------+--------+---------------------------+-----------+---------+-------+------+---------+--------------+-----------+-------------------------------------------------------+--------------+----------------+------------+-------------------------+ +| db | public | KibanaSampleDataEcommerce | User | ovr | 18000 | NULL | true | false | -1 | Sample data for tracking eCommerce orders from Kibana | 16 | false | NULL | NULL | +| db | public | Logs | User | ovr | 18019 | NULL | true | false | -1 | NULL | 7 | false | NULL | NULL | +| db | public | MultiTypeCube | User | ovr | 18245 | NULL | true | false | -1 | Test cube with a little bit of everything | 67 | false | NULL | NULL | +| db | public | NumberCube | User | ovr | 18029 | NULL | true | false | -1 | NULL | 3 | false | NULL | NULL | +| db | public | WideCube | User | ovr | 18035 | NULL | true | false | -1 | NULL | 207 | false | NULL | NULL | ++----------+--------+---------------------------+-----------+---------+-------+------+---------+--------------+-----------+-------------------------------------------------------+--------------+----------------+------------+-------------------------+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sigma_computing_with_subquery_query.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sigma_computing_with_subquery_query.snap index dec355a0046fb..57c2822c9acdb 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sigma_computing_with_subquery_query.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sigma_computing_with_subquery_query.snap @@ -2,23 +2,23 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(\"\n with\n nsp as (\n select oid\n from pg_catalog.pg_namespace\n where nspname = 'public'\n ),\n tbl as (\n select oid\n from pg_catalog.pg_class\n where\n relname = 'KibanaSampleDataEcommerce' and\n relnamespace = (select oid from nsp)\n )\n select\n attname,\n typname,\n description\n from pg_attribute a\n join pg_type on atttypid = pg_type.oid\n left join pg_description on\n attrelid = objoid and\n attnum = objsubid\n where\n attnum > 0 and\n attrelid = (select oid from tbl)\n order by attnum\n ;\n \".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+--------------------+-----------+-------------+ -| attname | typname | description | -+--------------------+-----------+-------------+ -| count | int8 | NULL | -| maxPrice | numeric | NULL | -| sumPrice | numeric | NULL | -| minPrice | numeric | NULL | -| avgPrice | numeric | NULL | -| countDistinct | int8 | NULL | -| order_date | timestamp | NULL | -| last_mod | timestamp | NULL | -| customer_gender | text | NULL | -| notes | text | NULL | -| taxful_total_price | numeric | NULL | -| has_subscription | bool | NULL | -| is_male | bool | NULL | -| is_female | bool | NULL | -| __user | text | NULL | -| __cubeJoinField | text | NULL | -+--------------------+-----------+-------------+ ++--------------------+-----------+-----------------------------------------------+ +| attname | typname | description | ++--------------------+-----------+-----------------------------------------------+ +| count | int8 | Events count | +| maxPrice | numeric | NULL | +| sumPrice | numeric | NULL | +| minPrice | numeric | NULL | +| avgPrice | numeric | NULL | +| countDistinct | int8 | NULL | +| order_date | timestamp | NULL | +| last_mod | timestamp | NULL | +| customer_gender | text | Customer gender | +| notes | text | NULL | +| taxful_total_price | numeric | NULL | +| has_subscription | bool | NULL | +| is_male | bool | Male users segment | +| is_female | bool | NULL | +| __user | text | Virtual column for security context switching | +| __cubeJoinField | text | Virtual column for joining cubes | ++--------------------+-----------+-----------------------------------------------+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sqlalchemy_new_conname_query.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sqlalchemy_new_conname_query.snap index 460faff0ba4a2..39066ea680e91 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sqlalchemy_new_conname_query.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__sqlalchemy_new_conname_query.snap @@ -2,23 +2,23 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(r#\"SELECT\n a.attname,\n pg_catalog.format_type(a.atttypid, a.atttypmod),\n (\n SELECT\n pg_catalog.pg_get_expr(d.adbin, d.adrelid)\n FROM\n pg_catalog.pg_attrdef AS d\n WHERE\n d.adrelid = a.attrelid\n AND d.adnum = a.attnum\n AND a.atthasdef\n ) AS DEFAULT,\n a.attnotnull,\n a.attrelid AS table_oid,\n pgd.description AS comment,\n a.attgenerated AS generated,\n (\n SELECT\n json_build_object(\n 'always',\n a.attidentity = 'a',\n 'start',\n s.seqstart,\n 'increment',\n s.seqincrement,\n 'minvalue',\n s.seqmin,\n 'maxvalue',\n s.seqmax,\n 'cache',\n s.seqcache,\n 'cycle',\n s.seqcycle\n )\n FROM\n pg_catalog.pg_sequence AS s\n JOIN pg_catalog.pg_class AS c ON s.seqrelid = c.\"oid\"\n WHERE\n c.relkind = 'S'\n AND a.attidentity <> ''\n AND s.seqrelid = CAST(\n pg_catalog.pg_get_serial_sequence(\n CAST(CAST(a.attrelid AS REGCLASS) AS TEXT),\n a.attname\n ) AS REGCLASS\n )\n ) AS identity_options\n FROM\n pg_catalog.pg_attribute AS a\n LEFT JOIN pg_catalog.pg_description AS pgd ON (\n pgd.objoid = a.attrelid\n AND pgd.objsubid = a.attnum\n )\n WHERE\n a.attrelid = 18000\n AND a.attnum > 0\n AND NOT a.attisdropped\n ORDER BY\n a.attnum\"#.to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+--------------------+-------------------------------------+---------+------------+-----------+---------+-----------+------------------+ -| attname | format_type(a.atttypid,a.atttypmod) | DEFAULT | attnotnull | table_oid | comment | generated | identity_options | -+--------------------+-------------------------------------+---------+------------+-----------+---------+-----------+------------------+ -| count | bigint | NULL | true | 18000 | NULL | | NULL | -| maxPrice | numeric | NULL | true | 18000 | NULL | | NULL | -| sumPrice | numeric | NULL | true | 18000 | NULL | | NULL | -| minPrice | numeric | NULL | true | 18000 | NULL | | NULL | -| avgPrice | numeric | NULL | true | 18000 | NULL | | NULL | -| countDistinct | bigint | NULL | true | 18000 | NULL | | NULL | -| order_date | timestamp without time zone | NULL | false | 18000 | NULL | | NULL | -| last_mod | timestamp without time zone | NULL | false | 18000 | NULL | | NULL | -| customer_gender | text | NULL | false | 18000 | NULL | | NULL | -| notes | text | NULL | false | 18000 | NULL | | NULL | -| taxful_total_price | numeric | NULL | false | 18000 | NULL | | NULL | -| has_subscription | boolean | NULL | false | 18000 | NULL | | NULL | -| is_male | boolean | NULL | true | 18000 | NULL | | NULL | -| is_female | boolean | NULL | true | 18000 | NULL | | NULL | -| __user | text | NULL | false | 18000 | NULL | | NULL | -| __cubeJoinField | text | NULL | false | 18000 | NULL | | NULL | -+--------------------+-------------------------------------+---------+------------+-----------+---------+-----------+------------------+ ++--------------------+-------------------------------------+---------+------------+-----------+-----------------------------------------------+-----------+------------------+ +| attname | format_type(a.atttypid,a.atttypmod) | DEFAULT | attnotnull | table_oid | comment | generated | identity_options | ++--------------------+-------------------------------------+---------+------------+-----------+-----------------------------------------------+-----------+------------------+ +| count | bigint | NULL | true | 18000 | Events count | | NULL | +| maxPrice | numeric | NULL | true | 18000 | NULL | | NULL | +| sumPrice | numeric | NULL | true | 18000 | NULL | | NULL | +| minPrice | numeric | NULL | true | 18000 | NULL | | NULL | +| avgPrice | numeric | NULL | true | 18000 | NULL | | NULL | +| countDistinct | bigint | NULL | true | 18000 | NULL | | NULL | +| order_date | timestamp without time zone | NULL | false | 18000 | NULL | | NULL | +| last_mod | timestamp without time zone | NULL | false | 18000 | NULL | | NULL | +| customer_gender | text | NULL | false | 18000 | Customer gender | | NULL | +| notes | text | NULL | false | 18000 | NULL | | NULL | +| taxful_total_price | numeric | NULL | false | 18000 | NULL | | NULL | +| has_subscription | boolean | NULL | false | 18000 | NULL | | NULL | +| is_male | boolean | NULL | true | 18000 | Male users segment | | NULL | +| is_female | boolean | NULL | true | 18000 | NULL | | NULL | +| __user | text | NULL | false | 18000 | Virtual column for security context switching | | NULL | +| __cubeJoinField | text | NULL | false | 18000 | Virtual column for joining cubes | | NULL | ++--------------------+-------------------------------------+---------+------------+-----------+-----------------------------------------------+-----------+------------------+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__superset_subquery.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__superset_subquery.snap index 5808a86aacb4e..948c96230dcc4 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__superset_subquery.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__superset_subquery.snap @@ -2,23 +2,23 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(\"\n SELECT\n a.attname,\n pg_catalog.format_type(a.atttypid, a.atttypmod),\n (\n SELECT pg_catalog.pg_get_expr(d.adbin, d.adrelid)\n FROM pg_catalog.pg_attrdef d\n WHERE\n d.adrelid = a.attrelid AND\n d.adnum = a.attnum AND\n a.atthasdef\n ) AS DEFAULT,\n a.attnotnull,\n a.attnum,\n a.attrelid as table_oid,\n pgd.description as comment,\n a.attgenerated as generated\n FROM pg_catalog.pg_attribute a\n LEFT JOIN pg_catalog.pg_description pgd ON (\n pgd.objoid = a.attrelid AND\n pgd.objsubid = a.attnum\n )\n WHERE\n a.attrelid = 18000\n AND a.attnum > 0\n AND NOT a.attisdropped\n ORDER BY a.attnum\n ;\n \".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+--------------------+-------------------------------------+---------+------------+--------+-----------+---------+-----------+ -| attname | format_type(a.atttypid,a.atttypmod) | DEFAULT | attnotnull | attnum | table_oid | comment | generated | -+--------------------+-------------------------------------+---------+------------+--------+-----------+---------+-----------+ -| count | bigint | NULL | true | 1 | 18000 | NULL | | -| maxPrice | numeric | NULL | true | 2 | 18000 | NULL | | -| sumPrice | numeric | NULL | true | 3 | 18000 | NULL | | -| minPrice | numeric | NULL | true | 4 | 18000 | NULL | | -| avgPrice | numeric | NULL | true | 5 | 18000 | NULL | | -| countDistinct | bigint | NULL | true | 6 | 18000 | NULL | | -| order_date | timestamp without time zone | NULL | false | 7 | 18000 | NULL | | -| last_mod | timestamp without time zone | NULL | false | 8 | 18000 | NULL | | -| customer_gender | text | NULL | false | 9 | 18000 | NULL | | -| notes | text | NULL | false | 10 | 18000 | NULL | | -| taxful_total_price | numeric | NULL | false | 11 | 18000 | NULL | | -| has_subscription | boolean | NULL | false | 12 | 18000 | NULL | | -| is_male | boolean | NULL | true | 13 | 18000 | NULL | | -| is_female | boolean | NULL | true | 14 | 18000 | NULL | | -| __user | text | NULL | false | 15 | 18000 | NULL | | -| __cubeJoinField | text | NULL | false | 16 | 18000 | NULL | | -+--------------------+-------------------------------------+---------+------------+--------+-----------+---------+-----------+ ++--------------------+-------------------------------------+---------+------------+--------+-----------+-----------------------------------------------+-----------+ +| attname | format_type(a.atttypid,a.atttypmod) | DEFAULT | attnotnull | attnum | table_oid | comment | generated | ++--------------------+-------------------------------------+---------+------------+--------+-----------+-----------------------------------------------+-----------+ +| count | bigint | NULL | true | 1 | 18000 | Events count | | +| maxPrice | numeric | NULL | true | 2 | 18000 | NULL | | +| sumPrice | numeric | NULL | true | 3 | 18000 | NULL | | +| minPrice | numeric | NULL | true | 4 | 18000 | NULL | | +| avgPrice | numeric | NULL | true | 5 | 18000 | NULL | | +| countDistinct | bigint | NULL | true | 6 | 18000 | NULL | | +| order_date | timestamp without time zone | NULL | false | 7 | 18000 | NULL | | +| last_mod | timestamp without time zone | NULL | false | 8 | 18000 | NULL | | +| customer_gender | text | NULL | false | 9 | 18000 | Customer gender | | +| notes | text | NULL | false | 10 | 18000 | NULL | | +| taxful_total_price | numeric | NULL | false | 11 | 18000 | NULL | | +| has_subscription | boolean | NULL | false | 12 | 18000 | NULL | | +| is_male | boolean | NULL | true | 13 | 18000 | Male users segment | | +| is_female | boolean | NULL | true | 14 | 18000 | NULL | | +| __user | text | NULL | false | 15 | 18000 | Virtual column for security context switching | | +| __cubeJoinField | text | NULL | false | 16 | 18000 | Virtual column for joining cubes | | ++--------------------+-------------------------------------+---------+------------+--------+-----------+-----------------------------------------------+-----------+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__tableau_regclass_query.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__tableau_regclass_query.snap index af41cdf149bf3..fd6a8ec013151 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__tableau_regclass_query.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__tableau_regclass_query.snap @@ -2,12 +2,12 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(\"SELECT NULL AS TABLE_CAT,\n n.nspname AS TABLE_SCHEM,\n c.relname AS TABLE_NAME,\n CASE n.nspname ~ '^pg_'\n OR n.nspname = 'information_schema'\n WHEN true THEN\n CASE\n WHEN n.nspname = 'pg_catalog'\n OR n.nspname = 'information_schema' THEN\n CASE c.relkind\n WHEN 'r' THEN 'SYSTEM TABLE'\n WHEN 'v' THEN 'SYSTEM VIEW'\n WHEN 'i' THEN 'SYSTEM INDEX'\n ELSE NULL\n end\n WHEN n.nspname = 'pg_toast' THEN\n CASE c.relkind\n WHEN 'r' THEN 'SYSTEM TOAST TABLE'\n WHEN 'i' THEN 'SYSTEM TOAST INDEX'\n ELSE NULL\n end\n ELSE\n CASE c.relkind\n WHEN 'r' THEN 'TEMPORARY TABLE'\n WHEN 'p' THEN 'TEMPORARY TABLE'\n WHEN 'i' THEN 'TEMPORARY INDEX'\n WHEN 'S' THEN 'TEMPORARY SEQUENCE'\n WHEN 'v' THEN 'TEMPORARY VIEW'\n ELSE NULL\n end\n end\n WHEN false THEN\n CASE c.relkind\n WHEN 'r' THEN 'TABLE'\n WHEN 'p' THEN 'PARTITIONED TABLE'\n WHEN 'i' THEN 'INDEX'\n WHEN 'P' THEN 'PARTITIONED INDEX'\n WHEN 'S' THEN 'SEQUENCE'\n WHEN 'v' THEN 'VIEW'\n WHEN 'c' THEN 'TYPE'\n WHEN 'f' THEN 'FOREIGN TABLE'\n WHEN 'm' THEN 'MATERIALIZED VIEW'\n ELSE NULL\n end\n ELSE NULL\n end AS TABLE_TYPE,\n d.description AS REMARKS,\n '' AS TYPE_CAT,\n '' AS TYPE_SCHEM,\n '' AS TYPE_NAME,\n '' AS SELF_REFERENCING_COL_NAME,\n '' AS REF_GENERATION\n FROM pg_catalog.pg_namespace n,\n pg_catalog.pg_class c\n LEFT JOIN pg_catalog.pg_description d\n ON ( c.oid = d.objoid\n AND d.objsubid = 0\n AND d.classoid = 'pg_class' :: regclass )\n WHERE c.relnamespace = n.oid\n AND ( false\n OR ( c.relkind = 'f' )\n OR ( c.relkind = 'm' )\n OR ( c.relkind = 'p'\n AND n.nspname !~ '^pg_'\n AND n.nspname <> 'information_schema' )\n OR ( c.relkind = 'r'\n AND n.nspname !~ '^pg_'\n AND n.nspname <> 'information_schema' )\n OR ( c.relkind = 'v'\n AND n.nspname <> 'pg_catalog'\n AND n.nspname <> 'information_schema' ) )\n ORDER BY TABLE_SCHEM ASC, TABLE_NAME ASC\n ;\".to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+-----------+-------------+---------------------------+------------+---------+----------+------------+-----------+---------------------------+----------------+ -| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | -+-----------+-------------+---------------------------+------------+---------+----------+------------+-----------+---------------------------+----------------+ -| NULL | public | KibanaSampleDataEcommerce | TABLE | NULL | | | | | | -| NULL | public | Logs | TABLE | NULL | | | | | | -| NULL | public | MultiTypeCube | TABLE | NULL | | | | | | -| NULL | public | NumberCube | TABLE | NULL | | | | | | -| NULL | public | WideCube | TABLE | NULL | | | | | | -+-----------+-------------+---------------------------+------------+---------+----------+------------+-----------+---------------------------+----------------+ ++-----------+-------------+---------------------------+------------+-------------------------------------------------------+----------+------------+-----------+---------------------------+----------------+ +| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION | ++-----------+-------------+---------------------------+------------+-------------------------------------------------------+----------+------------+-----------+---------------------------+----------------+ +| NULL | public | KibanaSampleDataEcommerce | TABLE | Sample data for tracking eCommerce orders from Kibana | | | | | | +| NULL | public | Logs | TABLE | NULL | | | | | | +| NULL | public | MultiTypeCube | TABLE | Test cube with a little bit of everything | | | | | | +| NULL | public | NumberCube | TABLE | NULL | | | | | | +| NULL | public | WideCube | TABLE | NULL | | | | | | ++-----------+-------------+---------------------------+------------+-------------------------------------------------------+----------+------------+-----------+---------------------------+----------------+ diff --git a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__thoughtspot_table_introspection.snap b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__thoughtspot_table_introspection.snap index 590bbb9bf4a54..631471621aeb1 100644 --- a/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__thoughtspot_table_introspection.snap +++ b/rust/cubesql/cubesql/src/compile/test/snapshots/cubesql__compile__test__test_introspection__thoughtspot_table_introspection.snap @@ -2,23 +2,23 @@ source: cubesql/src/compile/test/test_introspection.rs expression: "execute_query(r#\"\n SELECT *\n FROM (\n SELECT\n current_database() AS TABLE_CAT,\n n.nspname AS TABLE_SCHEM,\n c.relname AS TABLE_NAME,\n a.attname AS COLUMN_NAME,\n CAST(\n CASE typname\n WHEN 'text' THEN 12\n WHEN 'bit' THEN - 7\n WHEN 'bool' THEN - 7\n WHEN 'boolean' THEN - 7\n WHEN 'varchar' THEN 12\n WHEN 'character varying' THEN 12\n WHEN 'char' THEN 1\n WHEN '\"char\"' THEN 1\n WHEN 'character' THEN 1\n WHEN 'nchar' THEN 12\n WHEN 'bpchar' THEN 1\n WHEN 'nvarchar' THEN 12\n WHEN 'date' THEN 91\n WHEN 'time' THEN 92\n WHEN 'time without time zone' THEN 92\n WHEN 'timetz' THEN 2013\n WHEN 'time with time zone' THEN 2013\n WHEN 'timestamp' THEN 93\n WHEN 'timestamp without time zone' THEN 93\n WHEN 'timestamptz' THEN 2014\n WHEN 'timestamp with time zone' THEN 2014\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 4\n WHEN 'int' THEN 4\n WHEN 'int4' THEN 4\n WHEN 'bigint' THEN - 5\n WHEN 'int8' THEN - 5\n WHEN 'decimal' THEN 3\n WHEN 'real' THEN 7\n WHEN 'float4' THEN 7\n WHEN 'double precision' THEN 8\n WHEN 'float8' THEN 8\n WHEN 'float' THEN 6\n WHEN 'numeric' THEN 2\n WHEN '_float4' THEN 2003\n WHEN '_aclitem' THEN 2003\n WHEN '_text' THEN 2003\n WHEN 'bytea' THEN - 2\n WHEN 'oid' THEN - 5\n WHEN 'name' THEN 12\n WHEN '_int4' THEN 2003\n WHEN '_int2' THEN 2003\n WHEN 'ARRAY' THEN 2003\n WHEN 'geometry' THEN - 4\n WHEN 'super' THEN - 16\n WHEN 'varbyte' THEN - 4\n WHEN 'geography' THEN - 4\n ELSE 1111\n END\n AS SMALLINT\n ) AS DATA_TYPE,\n t.typname AS TYPE_NAME,\n CASE typname\n WHEN 'int4' THEN 10\n WHEN 'bit' THEN 1\n WHEN 'bool' THEN 1\n WHEN 'varchar' THEN atttypmod - 4\n WHEN 'character varying' THEN atttypmod - 4\n WHEN 'char' THEN atttypmod - 4\n WHEN 'character' THEN atttypmod - 4\n WHEN 'nchar' THEN atttypmod - 4\n WHEN 'bpchar' THEN atttypmod - 4\n WHEN 'nvarchar' THEN atttypmod - 4\n WHEN 'date' THEN 13\n WHEN 'time' THEN 15\n WHEN 'time without time zone' THEN 15\n WHEN 'timetz' THEN 21\n WHEN 'time with time zone' THEN 21\n WHEN 'timestamp' THEN 29\n WHEN 'timestamp without time zone' THEN 29\n WHEN 'timestamptz' THEN 35\n WHEN 'timestamp with time zone' THEN 35\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 10\n WHEN 'int' THEN 10\n WHEN 'int4' THEN 10\n WHEN 'bigint' THEN 19\n WHEN 'int8' THEN 19\n WHEN 'decimal' THEN (atttypmod - 4) >> 16\n WHEN 'real' THEN 8\n WHEN 'float4' THEN 8\n WHEN 'double precision' THEN 17\n WHEN 'float8' THEN 17\n WHEN 'float' THEN 17\n WHEN 'numeric' THEN (atttypmod - 4) >> 16\n WHEN '_float4' THEN 8\n WHEN 'oid' THEN 10\n WHEN '_int4' THEN 10\n WHEN '_int2' THEN 5\n WHEN 'geometry' THEN NULL\n WHEN 'super' THEN NULL\n WHEN 'varbyte' THEN NULL\n WHEN 'geography' THEN NULL\n ELSE 2147483647\n END AS COLUMN_SIZE,\n NULL AS BUFFER_LENGTH,\n CASE typname\n WHEN 'float4' THEN 8\n WHEN 'float8' THEN 17\n WHEN 'numeric' THEN (atttypmod - 4) & 65535\n WHEN 'time without time zone' THEN 6\n WHEN 'timetz' THEN 6\n WHEN 'time with time zone' THEN 6\n WHEN 'timestamp without time zone' THEN 6\n WHEN 'timestamp' THEN 6\n WHEN 'geometry' THEN NULL\n WHEN 'super' THEN NULL\n WHEN 'varbyte' THEN NULL\n WHEN 'geography' THEN NULL\n ELSE 0\n END AS DECIMAL_DIGITS,\n CASE typname\n WHEN 'varbyte' THEN 2\n WHEN 'geography' THEN 2\n ELSE 10\n END AS NUM_PREC_RADIX,\n CASE a.attnotnull OR (t.typtype = 'd' AND t.typnotnull)\n WHEN 'false' THEN 1\n WHEN NULL THEN 2\n ELSE 0\n END AS NULLABLE,\n dsc.description AS REMARKS,\n pg_catalog.pg_get_expr(def.adbin, def.adrelid) AS COLUMN_DEF,\n CAST(\n CASE typname\n WHEN 'text' THEN 12\n WHEN 'bit' THEN - 7\n WHEN 'bool' THEN - 7\n WHEN 'boolean' THEN - 7\n WHEN 'varchar' THEN 12\n WHEN 'character varying' THEN 12\n WHEN '\"char\"' THEN 1\n WHEN 'char' THEN 1\n WHEN 'character' THEN 1\n WHEN 'nchar' THEN 1\n WHEN 'bpchar' THEN 1\n WHEN 'nvarchar' THEN 12\n WHEN 'date' THEN 91\n WHEN 'time' THEN 92\n WHEN 'time without time zone' THEN 92\n WHEN 'timetz' THEN 2013\n WHEN 'time with time zone' THEN 2013\n WHEN 'timestamp with time zone' THEN 2014\n WHEN 'timestamp' THEN 93\n WHEN 'timestamp without time zone' THEN 93\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 4\n WHEN 'int' THEN 4\n WHEN 'int4' THEN 4\n WHEN 'bigint' THEN - 5\n WHEN 'int8' THEN - 5\n WHEN 'decimal' THEN 3\n WHEN 'real' THEN 7\n WHEN 'float4' THEN 7\n WHEN 'double precision' THEN 8\n WHEN 'float8' THEN 8\n WHEN 'float' THEN 6\n WHEN 'numeric' THEN 2\n WHEN '_float4' THEN 2003\n WHEN 'timestamptz' THEN 2014\n WHEN 'timestamp with time zone' THEN 2014\n WHEN '_aclitem' THEN 2003\n WHEN '_text' THEN 2003\n WHEN 'bytea' THEN - 2\n WHEN 'oid' THEN - 5\n WHEN 'name' THEN 12\n WHEN '_int4' THEN 2003\n WHEN '_int2' THEN 2003\n WHEN 'ARRAY' THEN 2003\n WHEN 'geometry' THEN - 4\n WHEN 'super' THEN - 16\n WHEN 'varbyte' THEN - 4\n WHEN 'geography' THEN - 4 ELSE 1111\n END\n AS SMALLINT\n ) AS SQL_DATA_TYPE,\n CAST(NULL AS SMALLINT) AS SQL_DATETIME_SUB,\n CASE typname\n WHEN 'int4' THEN 10\n WHEN 'bit' THEN 1\n WHEN 'bool' THEN 1\n WHEN 'varchar' THEN atttypmod - 4\n WHEN 'character varying' THEN atttypmod - 4\n WHEN 'char' THEN atttypmod - 4\n WHEN 'character' THEN atttypmod - 4\n WHEN 'nchar' THEN atttypmod - 4\n WHEN 'bpchar' THEN atttypmod - 4\n WHEN 'nvarchar' THEN atttypmod - 4\n WHEN 'date' THEN 13\n WHEN 'time' THEN 15\n WHEN 'time without time zone' THEN 15\n WHEN 'timetz' THEN 21\n WHEN 'time with time zone' THEN 21\n WHEN 'timestamp' THEN 29\n WHEN 'timestamp without time zone' THEN 29\n WHEN 'timestamptz' THEN 35\n WHEN 'timestamp with time zone' THEN 35\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 10\n WHEN 'int' THEN 10\n WHEN 'int4' THEN 10\n WHEN 'bigint' THEN 19\n WHEN 'int8' THEN 19\n WHEN 'decimal' THEN ((atttypmod - 4) >> 16) & 65535\n WHEN 'real' THEN 8\n WHEN 'float4' THEN 8\n WHEN 'double precision' THEN 17\n WHEN 'float8' THEN 17\n WHEN 'float' THEN 17\n WHEN 'numeric' THEN ((atttypmod - 4) >> 16) & 65535\n WHEN '_float4' THEN 8\n WHEN 'oid' THEN 10\n WHEN '_int4' THEN 10\n WHEN '_int2' THEN 5\n WHEN 'geometry' THEN NULL\n WHEN 'super' THEN NULL\n WHEN 'varbyte' THEN NULL\n WHEN 'geography' THEN NULL\n ELSE 2147483647\n END AS CHAR_OCTET_LENGTH,\n a.attnum AS ORDINAL_POSITION,\n CASE a.attnotnull OR (t.typtype = 'd' AND t.typnotnull)\n WHEN 'false' THEN 'YES'\n WHEN NULL THEN ''\n ELSE 'NO'\n END AS IS_NULLABLE,\n NULL AS SCOPE_CATALOG,\n NULL AS SCOPE_SCHEMA,\n NULL AS SCOPE_TABLE,\n t.typbasetype AS SOURCE_DATA_TYPE,\n CASE\n WHEN left(pg_catalog.pg_get_expr(def.adbin, def.adrelid), 16) = 'default_identity' THEN 'YES'\n ELSE 'NO'\n END AS IS_AUTOINCREMENT,\n false AS IS_GENERATEDCOLUMN\n FROM pg_catalog.pg_namespace AS n\n JOIN pg_catalog.pg_class AS c ON (c.relnamespace = n.oid)\n JOIN pg_catalog.pg_attribute AS a ON (a.attrelid = c.oid)\n JOIN pg_catalog.pg_type AS t ON (a.atttypid = t.oid)\n LEFT JOIN pg_catalog.pg_attrdef AS def ON (a.attrelid = def.adrelid AND a.attnum = def.adnum)\n LEFT JOIN pg_catalog.pg_description AS dsc ON (c.oid = dsc.objoid AND a.attnum = dsc.objsubid)\n LEFT JOIN pg_catalog.pg_class AS dc ON (dc.oid = dsc.classoid AND dc.relname = 'pg_class')\n LEFT JOIN pg_catalog.pg_namespace AS dn ON (dc.relnamespace = dn.oid AND dn.nspname = 'pg_catalog')\n WHERE\n a.attnum > 0 AND\n NOT a.attisdropped AND\n current_database() = 'cubedb' AND\n n.nspname LIKE 'public' AND\n c.relname LIKE 'KibanaSampleDataEcommerce'\n ORDER BY\n TABLE_SCHEM,\n c.relname,\n attnum\n ) AS t\n UNION ALL\n SELECT\n CAST(current_database() AS CHARACTER VARYING(128)) AS TABLE_CAT,\n CAST(schemaname AS CHARACTER VARYING(128)) AS table_schem,\n CAST(tablename AS CHARACTER VARYING(128)) AS table_name,\n CAST(columnname AS CHARACTER VARYING(128)) AS column_name,\n CAST(\n CASE columntype_rep\n WHEN 'text' THEN 12\n WHEN 'bit' THEN - 7\n WHEN 'bool' THEN - 7\n WHEN 'boolean' THEN - 7\n WHEN 'varchar' THEN 12\n WHEN 'character varying' THEN 12\n WHEN 'char' THEN 1\n WHEN 'character' THEN 1\n WHEN 'nchar' THEN 1\n WHEN 'bpchar' THEN 1\n WHEN 'nvarchar' THEN 12\n WHEN '\"char\"' THEN 1\n WHEN 'date' THEN 91\n WHEN 'time' THEN 92\n WHEN 'time without time zone' THEN 92\n WHEN 'timetz' THEN 2013\n WHEN 'time with time zone' THEN 2013\n WHEN 'timestamp' THEN 93\n WHEN 'timestamp without time zone' THEN 93\n WHEN 'timestamptz' THEN 2014\n WHEN 'timestamp with time zone' THEN 2014\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 4\n WHEN 'int' THEN 4\n WHEN 'int4' THEN 4\n WHEN 'bigint' THEN - 5\n WHEN 'int8' THEN - 5\n WHEN 'decimal' THEN 3\n WHEN 'real' THEN 7\n WHEN 'float4' THEN 7\n WHEN 'double precision' THEN 8\n WHEN 'float8' THEN 8\n WHEN 'float' THEN 6\n WHEN 'numeric' THEN 2\n WHEN 'timestamptz' THEN 2014\n WHEN 'bytea' THEN - 2\n WHEN 'oid' THEN - 5\n WHEN 'name' THEN 12\n WHEN 'ARRAY' THEN 2003\n WHEN 'geometry' THEN - 4\n WHEN 'super' THEN - 16\n WHEN 'varbyte' THEN - 4\n WHEN 'geography' THEN - 4\n ELSE 1111\n END\n AS SMALLINT\n ) AS DATA_TYPE,\n COALESCE(\n NULL,\n CASE columntype\n WHEN 'boolean' THEN 'bool'\n WHEN 'character varying' THEN 'varchar'\n WHEN '\"char\"' THEN 'char'\n WHEN 'smallint' THEN 'int2'\n WHEN 'integer' THEN 'int4'\n WHEN 'bigint' THEN 'int8'\n WHEN 'real' THEN 'float4'\n WHEN 'double precision' THEN 'float8'\n WHEN 'time without time zone' THEN 'time'\n WHEN 'time with time zone' THEN 'timetz'\n WHEN 'timestamp without time zone' THEN 'timestamp'\n WHEN 'timestamp with time zone' THEN 'timestamptz'\n ELSE columntype\n END\n ) AS TYPE_NAME,\n CASE columntype_rep\n WHEN 'int4' THEN 10\n WHEN 'bit' THEN 1\n WHEN 'bool' THEN 1\n WHEN 'boolean' THEN 1\n WHEN 'varchar' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN 'character varying' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN 'char' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 4), ''), '0') AS INT)\n WHEN 'character' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 4), ''), '0') AS INT)\n WHEN 'nchar' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN 'bpchar' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN 'nvarchar' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN 'date' THEN 13\n WHEN 'time' THEN 15\n WHEN 'time without time zone' THEN 15\n WHEN 'timetz' THEN 21\n WHEN 'timestamp' THEN 29\n WHEN 'timestamp without time zone' THEN 29\n WHEN 'time with time zone' THEN 21\n WHEN 'timestamptz' THEN 35\n WHEN 'timestamp with time zone' THEN 35\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 10\n WHEN 'int' THEN 10\n WHEN 'int4' THEN 10\n WHEN 'bigint' THEN 19\n WHEN 'int8' THEN 19\n WHEN 'decimal' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN 'real' THEN 8\n WHEN 'float4' THEN 8\n WHEN 'double precision' THEN 17\n WHEN 'float8' THEN 17\n WHEN 'float' THEN 17\n WHEN 'numeric' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN '_float4' THEN 8\n WHEN 'oid' THEN 10\n WHEN '_int4' THEN 10\n WHEN '_int2' THEN 5\n WHEN 'geometry' THEN NULL\n WHEN 'super' THEN NULL\n WHEN 'varbyte' THEN NULL\n WHEN 'geography' THEN NULL\n ELSE 2147483647\n END AS COLUMN_SIZE,\n NULL AS BUFFER_LENGTH,\n CASE REGEXP_REPLACE(columntype, '[()0-9,]')\n WHEN 'real' THEN 8\n WHEN 'float4' THEN 8\n WHEN 'double precision' THEN 17\n WHEN 'float8' THEN 17\n WHEN 'timestamp' THEN 6\n WHEN 'timestamp without time zone' THEN 6\n WHEN 'geometry' THEN NULL\n WHEN 'super' THEN NULL\n WHEN 'numeric' THEN CAST(regexp_substr(columntype, '[0-9]+', charindex(',', columntype)) AS INT)\n WHEN 'varbyte' THEN NULL\n WHEN 'geography' THEN NULL\n ELSE 0\n END AS DECIMAL_DIGITS,\n CASE columntype\n WHEN 'varbyte' THEN 2\n WHEN 'geography' THEN 2\n ELSE 10\n END AS NUM_PREC_RADIX,\n NULL AS NULLABLE,\n NULL AS REMARKS,\n NULL AS COLUMN_DEF,\n CAST(\n CASE columntype_rep\n WHEN 'text' THEN 12\n WHEN 'bit' THEN - 7\n WHEN 'bool' THEN - 7\n WHEN 'boolean' THEN - 7\n WHEN 'varchar' THEN 12\n WHEN 'character varying' THEN 12\n WHEN 'char' THEN 1\n WHEN 'character' THEN 1\n WHEN 'nchar' THEN 12\n WHEN 'bpchar' THEN 1\n WHEN 'nvarchar' THEN 12\n WHEN '\"char\"' THEN 1\n WHEN 'date' THEN 91\n WHEN 'time' THEN 92\n WHEN 'time without time zone' THEN 92\n WHEN 'timetz' THEN 2013\n WHEN 'time with time zone' THEN 2013\n WHEN 'timestamp' THEN 93\n WHEN 'timestamp without time zone' THEN 93\n WHEN 'timestamptz' THEN 2014\n WHEN 'timestamp with time zone' THEN 2014\n WHEN 'smallint' THEN 5\n WHEN 'int2' THEN 5\n WHEN 'integer' THEN 4\n WHEN 'int' THEN 4\n WHEN 'int4' THEN 4\n WHEN 'bigint' THEN - 5\n WHEN 'int8' THEN - 5\n WHEN 'decimal' THEN 3\n WHEN 'real' THEN 7\n WHEN 'float4' THEN 7\n WHEN 'double precision' THEN 8\n WHEN 'float8' THEN 8\n WHEN 'float' THEN 6\n WHEN 'numeric' THEN 2\n WHEN 'bytea' THEN - 2\n WHEN 'oid' THEN - 5\n WHEN 'name' THEN 12\n WHEN 'ARRAY' THEN 2003\n WHEN 'geometry' THEN - 4\n WHEN 'super' THEN - 16\n WHEN 'varbyte' THEN - 4\n WHEN 'geography' THEN - 4\n ELSE 1111\n END\n AS SMALLINT\n ) AS SQL_DATA_TYPE,\n CAST(NULL AS SMALLINT) AS SQL_DATETIME_SUB,\n CASE\n WHEN LEFT(columntype, 7) = 'varchar' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 7), ''), '0') AS INT)\n WHEN LEFT(columntype, 4) = 'char' THEN CAST(isnull(nullif(regexp_substr(columntype, '[0-9]+', 4), ''), '0') AS INT)\n WHEN columntype = 'string' THEN 16383\n ELSE NULL\n END AS CHAR_OCTET_LENGTH,\n columnnum AS ORDINAL_POSITION,\n NULL AS IS_NULLABLE,\n NULL AS SCOPE_CATALOG,\n NULL AS SCOPE_SCHEMA,\n NULL AS SCOPE_TABLE,\n NULL AS SOURCE_DATA_TYPE,\n 'NO' AS IS_AUTOINCREMENT,\n 'NO' AS IS_GENERATEDCOLUMN\n FROM (\n SELECT\n schemaname,\n tablename,\n columnname,\n columntype AS columntype_rep,\n columntype,\n columnnum\n FROM get_late_binding_view_cols_unpacked\n ) AS lbv_columns\n WHERE\n true AND\n current_database() = 'cubedb' AND\n schemaname LIKE 'public' AND\n tablename LIKE 'KibanaSampleDataEcommerce'\n ;\"#.to_string(),\nDatabaseProtocol::PostgreSQL).await?" --- -+-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ -| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SCOPE_CATALOG | SCOPE_SCHEMA | SCOPE_TABLE | SOURCE_DATA_TYPE | IS_AUTOINCREMENT | IS_GENERATEDCOLUMN | -+-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ -| cubedb | public | KibanaSampleDataEcommerce | count | -5 | int8 | 19 | NULL | 0 | 10 | NULL | NULL | NULL | -5 | NULL | 19 | 1 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | maxPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 2 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | sumPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 3 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | minPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 4 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | avgPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 5 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | countDistinct | -5 | int8 | 19 | NULL | 0 | 10 | NULL | NULL | NULL | -5 | NULL | 19 | 6 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | order_date | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 7 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | last_mod | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 8 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | customer_gender | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 9 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | notes | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 10 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | taxful_total_price | 2 | numeric | -1 | NULL | 65531 | 10 | 1 | NULL | NULL | 2 | NULL | 65535 | 11 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | has_subscription | -7 | bool | 1 | NULL | 0 | 10 | 1 | NULL | NULL | -7 | NULL | 1 | 12 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | is_male | -7 | bool | 1 | NULL | 0 | 10 | NULL | NULL | NULL | -7 | NULL | 1 | 13 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | is_female | -7 | bool | 1 | NULL | 0 | 10 | NULL | NULL | NULL | -7 | NULL | 1 | 14 | NULL | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | __user | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 15 | YES | NULL | NULL | NULL | 0 | NO | false | -| cubedb | public | KibanaSampleDataEcommerce | __cubeJoinField | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 16 | YES | NULL | NULL | NULL | 0 | NO | false | -+-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+---------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ ++-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+-----------------------------------------------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ +| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB | CHAR_OCTET_LENGTH | ORDINAL_POSITION | IS_NULLABLE | SCOPE_CATALOG | SCOPE_SCHEMA | SCOPE_TABLE | SOURCE_DATA_TYPE | IS_AUTOINCREMENT | IS_GENERATEDCOLUMN | ++-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+-----------------------------------------------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ +| cubedb | public | KibanaSampleDataEcommerce | count | -5 | int8 | 19 | NULL | 0 | 10 | NULL | Events count | NULL | -5 | NULL | 19 | 1 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | maxPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 2 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | sumPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 3 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | minPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 4 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | avgPrice | 2 | numeric | -1 | NULL | 65531 | 10 | NULL | NULL | NULL | 2 | NULL | 65535 | 5 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | countDistinct | -5 | int8 | 19 | NULL | 0 | 10 | NULL | NULL | NULL | -5 | NULL | 19 | 6 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | order_date | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 7 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | last_mod | 93 | timestamp | 29 | NULL | 6 | 10 | 1 | NULL | NULL | 93 | NULL | 29 | 8 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | customer_gender | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | Customer gender | NULL | 12 | NULL | 2147483647 | 9 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | notes | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | NULL | NULL | 12 | NULL | 2147483647 | 10 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | taxful_total_price | 2 | numeric | -1 | NULL | 65531 | 10 | 1 | NULL | NULL | 2 | NULL | 65535 | 11 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | has_subscription | -7 | bool | 1 | NULL | 0 | 10 | 1 | NULL | NULL | -7 | NULL | 1 | 12 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | is_male | -7 | bool | 1 | NULL | 0 | 10 | NULL | Male users segment | NULL | -7 | NULL | 1 | 13 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | is_female | -7 | bool | 1 | NULL | 0 | 10 | NULL | NULL | NULL | -7 | NULL | 1 | 14 | NULL | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | __user | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | Virtual column for security context switching | NULL | 12 | NULL | 2147483647 | 15 | YES | NULL | NULL | NULL | 0 | NO | false | +| cubedb | public | KibanaSampleDataEcommerce | __cubeJoinField | 12 | text | 2147483647 | NULL | 0 | 10 | 1 | Virtual column for joining cubes | NULL | 12 | NULL | 2147483647 | 16 | YES | NULL | NULL | NULL | 0 | NO | false | ++-----------+-------------+---------------------------+--------------------+-----------+-----------+-------------+---------------+----------------+----------------+----------+-----------------------------------------------+------------+---------------+------------------+-------------------+------------------+-------------+---------------+--------------+-------------+------------------+------------------+--------------------+ diff --git a/rust/cubesql/cubesql/src/compile/test/test_df_execution.rs b/rust/cubesql/cubesql/src/compile/test/test_df_execution.rs new file mode 100644 index 0000000000000..2558517b6efe6 --- /dev/null +++ b/rust/cubesql/cubesql/src/compile/test/test_df_execution.rs @@ -0,0 +1,63 @@ +//! Tests that validate that complex but self-contained queries can be executed correctly by DF + +use crate::compile::{ + test::{execute_query, init_testing_logger}, + DatabaseProtocol, +}; + +#[tokio::test] +async fn test_join_with_coercion() { + init_testing_logger(); + + insta::assert_snapshot!(execute_query( + // language=PostgreSQL + r#" + WITH + t1 AS ( + SELECT 1::int2 AS i1 + ), + t2 AS ( + SELECT 1::int4 AS i2 + ) + SELECT + * + FROM + t1 LEFT JOIN t2 ON (t1.i1 = t2.i2) + "# + .to_string(), + DatabaseProtocol::PostgreSQL, + ) + .await + .unwrap()); +} + +#[tokio::test] +async fn test_triple_join_with_coercion() { + init_testing_logger(); + + insta::assert_snapshot!(execute_query( + // language=PostgreSQL + r#" + WITH + t1 AS ( + SELECT 1::int2 AS i1 + ), + t2 AS ( + SELECT 1::int4 AS i2 + ), + t3 AS ( + SELECT 1::int8 AS i3 + ) + SELECT + * + FROM + t1 + LEFT JOIN t2 ON (t1.i1 = t2.i2) + LEFT JOIN t3 ON (t3.i3 = t2.i2) + "# + .to_string(), + DatabaseProtocol::PostgreSQL, + ) + .await + .unwrap()); +} diff --git a/rust/cubesql/cubesql/src/config/mod.rs b/rust/cubesql/cubesql/src/config/mod.rs index a314c5841c7f4..1f73528e00df1 100644 --- a/rust/cubesql/cubesql/src/config/mod.rs +++ b/rust/cubesql/cubesql/src/config/mod.rs @@ -237,11 +237,6 @@ impl ConfigObj for ConfigObjImpl { } } -lazy_static! { - pub static ref TEST_LOGGING_INITIALIZED: tokio::sync::RwLock = - tokio::sync::RwLock::new(false); -} - impl Config { pub fn default() -> Config { Config { diff --git a/rust/cubesql/cubesql/src/lib.rs b/rust/cubesql/cubesql/src/lib.rs index 1252d2bc77e63..ae7f986c9256c 100644 --- a/rust/cubesql/cubesql/src/lib.rs +++ b/rust/cubesql/cubesql/src/lib.rs @@ -15,8 +15,6 @@ // trace_macros!(false); -#[macro_use] -extern crate lazy_static; extern crate core; pub mod compile; diff --git a/rust/cubesql/cubesql/src/sql/session.rs b/rust/cubesql/cubesql/src/sql/session.rs index a265722e2956f..75a4541ffce85 100644 --- a/rust/cubesql/cubesql/src/sql/session.rs +++ b/rust/cubesql/cubesql/src/sql/session.rs @@ -3,7 +3,7 @@ use log::trace; use rand::Rng; use std::{ collections::HashMap, - sync::{Arc, RwLock as RwLockSync, Weak}, + sync::{Arc, LazyLock, RwLock as RwLockSync, Weak}, time::{Duration, SystemTime}, }; use tokio_util::sync::CancellationToken; @@ -23,8 +23,6 @@ use crate::{ RWLockAsync, }; -extern crate lazy_static; - #[derive(Debug, Clone)] pub struct SessionProperties { user: Option, @@ -37,10 +35,10 @@ impl SessionProperties { } } -lazy_static! { - static ref POSTGRES_DEFAULT_VARIABLES: DatabaseVariables = postgres_default_session_variables(); - static ref MYSQL_DEFAULT_VARIABLES: DatabaseVariables = mysql_default_session_variables(); -} +static POSTGRES_DEFAULT_VARIABLES: LazyLock = + LazyLock::new(postgres_default_session_variables); +static MYSQL_DEFAULT_VARIABLES: LazyLock = + LazyLock::new(mysql_default_session_variables); #[derive(Debug)] pub enum TransactionState { diff --git a/rust/cubesql/cubesql/src/telemetry/mod.rs b/rust/cubesql/cubesql/src/telemetry/mod.rs index 76eaa795e8c8b..5fc813889dc39 100644 --- a/rust/cubesql/cubesql/src/telemetry/mod.rs +++ b/rust/cubesql/cubesql/src/telemetry/mod.rs @@ -1,12 +1,14 @@ use crate::{compile::DatabaseProtocolDetails, sql::SessionState, CubeError}; use arc_swap::ArcSwap; use log::{Level, LevelFilter}; -use std::{collections::HashMap, fmt::Debug, sync::Arc}; - -lazy_static! { - static ref REPORTER: ArcSwap> = - ArcSwap::from_pointee(Box::new(LocalReporter::new())); -} +use std::{ + collections::HashMap, + fmt::Debug, + sync::{Arc, LazyLock}, +}; + +static REPORTER: LazyLock>> = + LazyLock::new(|| ArcSwap::from_pointee(Box::new(LocalReporter::new()))); pub trait LogReporter: Send + Sync + Debug { fn log(&self, event: String, properties: HashMap, level: Level); diff --git a/rust/cubesql/cubesql/src/transport/ctx.rs b/rust/cubesql/cubesql/src/transport/ctx.rs index ae8141c571fc5..a3ceee2a4c7f4 100644 --- a/rust/cubesql/cubesql/src/transport/ctx.rs +++ b/rust/cubesql/cubesql/src/transport/ctx.rs @@ -22,6 +22,7 @@ pub struct CubeMetaTable { pub record_oid: u32, pub array_handler_oid: u32, pub name: String, + pub description: Option, pub columns: Vec, } @@ -29,6 +30,7 @@ pub struct CubeMetaTable { pub struct CubeMetaColumn { pub oid: u32, pub name: String, + pub description: Option, pub column_type: ColumnType, pub can_be_null: bool, } @@ -49,12 +51,14 @@ impl MetaContext { record_oid: oid_iter.next().unwrap_or(0), array_handler_oid: oid_iter.next().unwrap_or(0), name: cube.name.clone(), + description: cube.description.clone(), columns: cube .get_columns() .iter() .map(|column| CubeMetaColumn { oid: oid_iter.next().unwrap_or(0), name: column.get_name().clone(), + description: column.get_description().clone(), column_type: column.get_column_type().clone(), can_be_null: column.sql_can_be_null(), }) diff --git a/rust/cubesql/cubesql/src/transport/ext.rs b/rust/cubesql/cubesql/src/transport/ext.rs index 654069f8f6092..98e2d823f64d4 100644 --- a/rust/cubesql/cubesql/src/transport/ext.rs +++ b/rust/cubesql/cubesql/src/transport/ext.rs @@ -199,7 +199,7 @@ impl V1CubeMetaExt for CubeMeta { columns.push(CubeColumn { member_name: measure.name.clone(), name: measure.get_real_name(), - description: None, + description: measure.description.clone(), column_type: measure.get_sql_type(), can_be_null: false, }); @@ -209,7 +209,7 @@ impl V1CubeMetaExt for CubeMeta { columns.push(CubeColumn { member_name: dimension.name.clone(), name: dimension.get_real_name(), - description: None, + description: dimension.description.clone(), column_type: dimension.get_sql_type(), can_be_null: dimension.sql_can_be_null(), }); @@ -219,7 +219,7 @@ impl V1CubeMetaExt for CubeMeta { columns.push(CubeColumn { member_name: segment.name.clone(), name: segment.get_real_name(), - description: None, + description: segment.description.clone(), column_type: ColumnType::Boolean, can_be_null: false, }); diff --git a/rust/cubesql/package.json b/rust/cubesql/package.json index b0adb96c4ead5..39b594d78c683 100644 --- a/rust/cubesql/package.json +++ b/rust/cubesql/package.json @@ -1,6 +1,6 @@ { "name": "@cubejs-backend/cubesql", - "version": "0.35.79", + "version": "0.35.80", "description": "SQL API for Cube as proxy over MySQL protocol.", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" diff --git a/rust/cubesqlplanner/Cargo.lock b/rust/cubesqlplanner/Cargo.lock index c5e3de6e44247..58acf427b2091 100644 --- a/rust/cubesqlplanner/Cargo.lock +++ b/rust/cubesqlplanner/Cargo.lock @@ -639,7 +639,7 @@ dependencies = [ [[package]] name = "cube-ext" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "chrono", @@ -714,7 +714,6 @@ dependencies = [ "futures-util", "hashbrown 0.14.5", "itertools", - "lazy_static", "log", "lru", "minijinja", @@ -726,7 +725,6 @@ dependencies = [ "regex", "rust_decimal", "serde", - "serde_derive", "serde_json", "sha1_smol", "sha2", @@ -760,7 +758,7 @@ dependencies = [ [[package]] name = "datafusion" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -793,7 +791,7 @@ dependencies = [ [[package]] name = "datafusion-common" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "arrow", "ordered-float 2.10.1", @@ -804,7 +802,7 @@ dependencies = [ [[package]] name = "datafusion-data-access" version = "1.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "async-trait", "chrono", @@ -817,7 +815,7 @@ dependencies = [ [[package]] name = "datafusion-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", @@ -828,7 +826,7 @@ dependencies = [ [[package]] name = "datafusion-physical-expr" version = "7.0.0" -source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=400fa0d889a8a38ca69f36d5750dfb572fc6018e#400fa0d889a8a38ca69f36d5750dfb572fc6018e" +source = "git+https://github.com/cube-js/arrow-datafusion.git?rev=dcf3e4aa26fd112043ef26fa4a78db5dbd443c86#dcf3e4aa26fd112043ef26fa4a78db5dbd443c86" dependencies = [ "ahash 0.7.8", "arrow", diff --git a/rust/cubesqlplanner/cubesqlplanner/Cargo.toml b/rust/cubesqlplanner/cubesqlplanner/Cargo.toml index 5d4218eb4f086..309e341b5f4fd 100644 --- a/rust/cubesqlplanner/cubesqlplanner/Cargo.toml +++ b/rust/cubesqlplanner/cubesqlplanner/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "400fa0d889a8a38ca69f36d5750dfb572fc6018e", default-features = false, features = ["regex_expressions", "unicode_expressions"] } +datafusion = { git = 'https://github.com/cube-js/arrow-datafusion.git', rev = "dcf3e4aa26fd112043ef26fa4a78db5dbd443c86", default-features = false, features = ["regex_expressions", "unicode_expressions"] } tokio = { version = "^1.35", features = ["full", "rt", "tracing"] } itertools = "0.10.2" cubeclient = { path = "../../cubesql/cubeclient" } diff --git a/rust/cubestore/gorgias.Dockerfile b/rust/cubestore/gorgias.Dockerfile index deab688b7741c..f346dce584701 100644 --- a/rust/cubestore/gorgias.Dockerfile +++ b/rust/cubestore/gorgias.Dockerfile @@ -28,7 +28,7 @@ RUN [ "$WITH_AVX2" -eq "1" ] && export RUSTFLAGS="-C target-feature=+avx2"; \ cargo build --release -p cubestore -FROM cubejs/cubestore:v0.35.79 +FROM cubejs/cubestore:v0.35.80 COPY --from=builder /build/cubestore/target/release/cubestored .