Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(databricks-jdbc-driver): Return NULL decimal as NULL instead of 0 #6768

Merged
merged 16 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/actions/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ set -eo pipefail
# Debug log for test containers
export DEBUG=testcontainers

echo "::group::Oracle"
yarn lerna run --concurrency 1 --stream --no-prefix smoke:oracle
echo "::endgroup::"

echo "::group::DuckDB"
# Should we create a separate job integration-duckdb? I believe not, because it works fast.
yarn lerna run --concurrency 1 --stream --no-prefix integration:duckdb
yarn lerna run --concurrency 1 --stream --no-prefix smoke:duckdb
echo "::endgroup::"

echo "::group::Oracle"
yarn lerna run --concurrency 1 --stream --no-prefix smoke:oracle
echo "::endgroup::"

echo "::group::Postgres"
yarn lerna run --concurrency 1 --stream --no-prefix smoke:postgres
echo "::endgroup::"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ jobs:
- uses: Swatinem/rust-cache@v1
with:
working-directory: ./rust/cubestore
shared-key: cubestore
key: ubuntu-20.04
- name: Build cubestore
uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -468,6 +469,7 @@ jobs:
- uses: Swatinem/rust-cache@v1
with:
working-directory: ./rust/cubestore
shared-key: cubestore
key: ubuntu-20.04
- name: Build cubestore
uses: actions-rs/cargo@v1
Expand Down
4 changes: 0 additions & 4 deletions packages/cubejs-athena-driver/test/AthenaDriver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ describe('AthenaDriver', () => {
await tests.testStream();
});

test('unload', async () => {
await tests.testUnload();
});

test('unload CSV escape symbol', async () => {
await tests.testUnloadEscapeSymbolOp1(AthenaDriver);
await tests.testUnloadEscapeSymbolOp2(AthenaDriver);
Expand Down
2 changes: 1 addition & 1 deletion packages/cubejs-jdbc-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"optionalDependencies": {
"java": "^0.12.1",
"jdbc": "^0.7.4"
"@cubejs-backend/jdbc": "^0.7.6"
},
"license": "Apache-2.0",
"eslintConfig": {
Expand Down
8 changes: 4 additions & 4 deletions packages/cubejs-jdbc-driver/src/JDBCDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import { DriverOptionsInterface, SupportedDrivers } from './supported-drivers';
import { JDBCDriverConfiguration } from './types';
import { QueryStream, nextFn, Row } from './QueryStream';

const DriverManager = require('jdbc/lib/drivermanager');
const Connection = require('jdbc/lib/connection');
const DatabaseMetaData = require('jdbc/lib/databasemetadata');
const jinst = require('jdbc/lib/jinst');
const DriverManager = require('@cubejs-backend/jdbc/lib/drivermanager');
const Connection = require('@cubejs-backend/jdbc/lib/connection');
const DatabaseMetaData = require('@cubejs-backend/jdbc/lib/databasemetadata');
const jinst = require('@cubejs-backend/jdbc/lib/jinst');
const mvn = require('node-java-maven');

let mvnPromise: Promise<void> | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@
if (!name) {
errorsReport.error(`name isn't defined for ${memberType}: ${YAML.stringify(rest)}`);
return {};
} else if (indexes) {
return { [name]: { indexes, ...rest } };

Check warning on line 254 in packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts

View check run for this annotation

Codecov / codecov/patch

packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts#L254

Added line #L254 was not covered by tests
} else {
return { [name]: rest };
}
Expand Down
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/athena.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
"querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying BigECommerce: partitioned pre-agg"
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum"
]
}
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/bigquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying ECommerce: partitioned pre-agg",
"querying ECommerce: partitioned pre-agg higher granularity",
"querying BigECommerce: partitioned pre-agg"
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum"
]
}
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/clickhouse.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying ECommerce: partitioned pre-agg",
"querying ECommerce: partitioned pre-agg higher granularity",
"querying BigECommerce: partitioned pre-agg"
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum"
]
}
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/mssql.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"querying Products: dimensions -- doesn't work wo ordering",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
"querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test"
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying BigECommerce: null sum"
]
}
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/mysql.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying ECommerce: partitioned pre-agg",
"querying ECommerce: partitioned pre-agg higher granularity",
"querying BigECommerce: partitioned pre-agg"
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum"
]
}
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/postgres.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying ECommerce: partitioned pre-agg",
"querying ECommerce: partitioned pre-agg higher granularity",
"querying BigECommerce: partitioned pre-agg"
"querying BigECommerce: partitioned pre-agg",
"querying BigECommerce: null sum"
]
}
3 changes: 2 additions & 1 deletion packages/cubejs-testing-drivers/fixtures/snowflake.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"querying Products: dimensions -- doesn't work wo ordering",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- rounding in athena",
"querying ECommerce: total sales, total profit by month + order (date) + total -- doesn't work with the BigQuery",
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test"
"querying ECommerce: total quantity, avg discount, total sales, total profit by product + order + total -- noisy test",
"querying BigECommerce: null sum"
]
}
14 changes: 14 additions & 0 deletions packages/cubejs-testing-drivers/src/tests/testQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1359,5 +1359,19 @@ export function testQueries(type: string): void {
});
expect(response.rawData()).toMatchSnapshot();
});

execute('querying BigECommerce: null sum', async () => {
const response = await client.load({
measures: [
'BigECommerce.totalSales',
],
filters: [{
member: 'BigECommerce.id',
operator: 'equals',
values: ['8958']
}]
});
expect(response.rawData()).toMatchSnapshot();
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -1997,6 +1997,14 @@ Array [
]
`;

exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying BigECommerce: null sum 1`] = `
Array [
Object {
"BigECommerce.totalSales": null,
},
]
`;

exports[`Queries with the @cubejs-backend/databricks-jdbc-driver querying Customers: dimensions 1`] = `
Array [
Object {
Expand Down
9 changes: 1 addition & 8 deletions packages/cubejs-testing-shared/src/db/oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ export class OracleDBRunner extends DbRunnerAbstract {

const container = new GenericContainer(`gvenzl/oracle-xe:${version}`)
.withEnv('ORACLE_PASSWORD', 'test')
.withHealthCheck({
test: 'healthcheck.sh',
interval: 2 * 1000,
timeout: 5 * 1000,
retries: 5,
startPeriod: (isCI() ? 45 : 15) * 1000
})
.withWaitStrategy(Wait.forHealthCheck())
.withWaitStrategy(Wait.forLogMessage('DATABASE IS READY TO USE'))
.withExposedPorts(1521);

if (options.volumes) {
Expand Down
4 changes: 4 additions & 0 deletions packages/cubejs-testing/test/smoke-oracle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ describe('oracle', () => {

beforeAll(async () => {
db = await OracleDBRunner.startContainer({});

const stream = await db.logs();
stream.pipe(process.stdout);

birdbox = await getBirdbox(
'oracle',
{
Expand Down
96 changes: 77 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3861,6 +3861,11 @@
style-mod "^4.0.0"
w3c-keyname "^2.2.4"

"@colors/[email protected]":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==

"@csstools/convert-colors@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7"
Expand All @@ -3881,6 +3886,17 @@
resolved "https://registry.yarnpkg.com/@cubejs-backend/dotenv/-/dotenv-9.0.2.tgz#c3679091b702f0fd38de120c5a63943fcdc0dcbf"
integrity sha512-yC1juhXEjM7K97KfXubDm7WGipd4Lpxe+AT8XeTRE9meRULrKlw0wtE2E8AQkGOfTBn+P1SCkePQ/BzIbOh1VA==

"@cubejs-backend/jdbc@^0.7.6":
version "0.7.6"
resolved "https://registry.yarnpkg.com/@cubejs-backend/jdbc/-/jdbc-0.7.6.tgz#b41ab040d3bf34db0e36979b6490ab76377408b6"
integrity sha512-Ngs1tlFsoxpsFcWSDK/WsQMX7F6erGw1MfbyphYWBJnTbZVsa3mkDObeHgzOSvCDhDYlFB4W0hDiJE+SR0loug==
dependencies:
async "3.2.4"
java "^0.12.2"
lodash "4.17.21"
uuid "9.0.0"
winston "3.8.2"

"@cubejs-backend/[email protected]":
version "0.33.20"
resolved "https://registry.yarnpkg.com/@cubejs-backend/shared/-/shared-0.33.20.tgz#3d9fa60041599cca9fe4c04df05daa4b8ab8675f"
Expand Down Expand Up @@ -7272,6 +7288,11 @@
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.1.tgz#8f80dd965ad81f3e1bc26d6f5c727e132721ff40"
integrity sha512-Y0K95ThC3esLEYD6ZuqNek29lNX2EM1qxV8y2FTLUB0ff5wWrk7az+mLrnNFUnaXcgKye22+sFBRXOgpPILZNg==

"@types/triple-beam@^1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.2.tgz#38ecb64f01aa0d02b7c8f4222d7c38af6316fef8"
integrity sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==

"@types/tunnel@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@types/tunnel/-/tunnel-0.0.3.tgz#f109e730b072b3136347561fc558c9358bb8c6e9"
Expand Down Expand Up @@ -9088,6 +9109,11 @@ [email protected]:
dependencies:
lodash "^4.17.10"

[email protected], async@^3.2.1, async@^3.2.3:
version "3.2.4"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c"
integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==

async@^0.9.0:
version "0.9.2"
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"
Expand All @@ -9100,16 +9126,11 @@ async@^2.6.2, async@^2.6.3:
dependencies:
lodash "^4.17.14"

async@^3.1.0, async@^3.2.0, async@~3.2.0:
async@^3.1.0, async@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.2.tgz#2eb7671034bb2194d45d30e31e24ec7e7f9670cd"
integrity sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==

async@^3.2.1, async@^3.2.3:
version "3.2.4"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c"
integrity sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==

asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
Expand Down Expand Up @@ -17459,7 +17480,7 @@ iterm2-version@^4.1.0:
app-path "^3.2.0"
plist "^3.0.1"

java@^0.12.1:
java@^0.12.1, java@^0.12.2:
version "0.12.2"
resolved "https://registry.yarnpkg.com/java/-/java-0.12.2.tgz#fe4ace8eb76c9b5c486af3d3cda14b372f0d1d51"
integrity sha512-+Pp+jG5EKo3PYRo7V91FNaTnspli+BuXvAVM0QYKHRdr2e0oP1Lo3Lm8lVjnWq95MEuN+Hzyl2QBgYpdhQu/+g==
Expand All @@ -17475,17 +17496,6 @@ javascript-stringify@^2.0.1:
resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79"
integrity sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==

jdbc@^0.7.4:
version "0.7.6"
resolved "https://registry.yarnpkg.com/jdbc/-/jdbc-0.7.6.tgz#bf1fcafc73ae39ec21974a54cd13c12cd0ce23d7"
integrity sha512-0zUYiJ5lHstJxXDNZOrW3YUTdsf0htW3Xik6/0tDCku68tqcwjPeQWWbnHg3QHmyAGnpVlWSKrYyPCnSXvDB5w==
dependencies:
async "~3.2.0"
java "^0.12.1"
lodash "4.17.21"
uuid "^8.3.2"
winston "^3.3.3"

jest-changed-files@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039"
Expand Down Expand Up @@ -19471,6 +19481,18 @@ logform@^2.2.0:
safe-stable-stringify "^1.1.0"
triple-beam "^1.3.0"

logform@^2.3.2, logform@^2.4.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/logform/-/logform-2.5.1.tgz#44c77c34becd71b3a42a3970c77929e52c6ed48b"
integrity sha512-9FyqAm9o9NKKfiAKfZoYo9bGXXuwMkxQiQttkT4YjjVtQVIQtK6LmVtlxmCaFswo6N4AfEkHqZTV0taDtPotNg==
dependencies:
"@colors/colors" "1.5.0"
"@types/triple-beam" "^1.3.2"
fecha "^4.2.0"
ms "^2.1.1"
safe-stable-stringify "^2.3.1"
triple-beam "^1.3.0"

loglevel@^1.6.8:
version "1.8.0"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.0.tgz#e7ec73a57e1e7b419cb6c6ac06bf050b67356114"
Expand Down Expand Up @@ -25361,6 +25383,11 @@ safe-stable-stringify@^1.1.0:
resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz#c8a220ab525cd94e60ebf47ddc404d610dc5d84a"
integrity sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==

safe-stable-stringify@^2.3.1:
version "2.4.3"
resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886"
integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==

"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@^2.1.2, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
Expand Down Expand Up @@ -28309,6 +28336,11 @@ [email protected], uuid@^8.0.0, uuid@^8.3.0, uuid@^8.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

[email protected]:
version "9.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==

uuid@^3.1.0, uuid@^3.3.2:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
Expand Down Expand Up @@ -29063,7 +29095,33 @@ winston-transport@^4.4.0:
readable-stream "^2.3.7"
triple-beam "^1.2.0"

winston@^3.1.0, winston@^3.3.3:
winston-transport@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.5.0.tgz#6e7b0dd04d393171ed5e4e4905db265f7ab384fa"
integrity sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==
dependencies:
logform "^2.3.2"
readable-stream "^3.6.0"
triple-beam "^1.3.0"

[email protected]:
version "3.8.2"
resolved "https://registry.yarnpkg.com/winston/-/winston-3.8.2.tgz#56e16b34022eb4cff2638196d9646d7430fdad50"
integrity sha512-MsE1gRx1m5jdTTO9Ld/vND4krP2To+lgDoMEHGGa4HIlAUyXJtfc7CxQcGXVyz2IBpw5hbFkj2b/AtUdQwyRew==
dependencies:
"@colors/colors" "1.5.0"
"@dabh/diagnostics" "^2.0.2"
async "^3.2.3"
is-stream "^2.0.0"
logform "^2.4.0"
one-time "^1.0.0"
readable-stream "^3.4.0"
safe-stable-stringify "^2.3.1"
stack-trace "0.0.x"
triple-beam "^1.3.0"
winston-transport "^4.5.0"

winston@^3.1.0:
version "3.3.3"
resolved "https://registry.yarnpkg.com/winston/-/winston-3.3.3.tgz#ae6172042cafb29786afa3d09c8ff833ab7c9170"
integrity sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==
Expand Down
Loading