Skip to content

Commit

Permalink
update the test case for issue 101 (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-dl authored Mar 23, 2023
1 parent 8a1ff81 commit e281fa1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
32 changes: 17 additions & 15 deletions test/integration/testArrayBind.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/*
* Copyright (c) 2015-2019 Snowflake Computing Inc. All rights reserved.
*/
const snowflake = require('./../../lib/snowflake');
var async = require('async');
var assert = require('assert');
var testUtil = require('./testUtil');
const connOption = require('./connectionOptions');
var connOption = require('./connectionOptions');
const { error } = require('winston');

const DATABASE_NAME = connOption.valid.database;
Expand All @@ -13,7 +14,7 @@ const WAREHOUSE_NAME = connOption.valid.warehouse;

describe('Test Array Bind', function ()
{
this.timeout(200000);
this.timeout(300000);
var connection;
var createABTable = `create or replace table ${DATABASE_NAME}.${SCHEMA_NAME}.testAB(colA string, colB number, colC date, colD time, colE TIMESTAMP_NTZ, colF TIMESTAMP_TZ)`;
var insertAB = `insert into ${DATABASE_NAME}.${SCHEMA_NAME}.testAB values(?, ?, ?, ?, ?, ?)`;
Expand All @@ -28,7 +29,8 @@ describe('Test Array Bind', function ()

before(function (done)
{
connection = testUtil.createConnection();
connOption.valid.arrayBindingThreshold = 3;
connection = snowflake.createConnection(connOption.valid);
testUtil.connect(connection, function ()
{
connection.execute({
Expand Down Expand Up @@ -65,7 +67,7 @@ describe('Test Array Bind', function ()
function(callback)
{
var arrBind = [];
var count = 100000;
var count = 100;
for(var i = 0; i<count; i++)
{
arrBind.push(['string'+i, i, "2020-05-11", "12:35:41.3333333", "2022-04-01 23:59:59", "2022-07-08 12:05:30.9999999"]);
Expand Down Expand Up @@ -94,7 +96,7 @@ describe('Test Array Bind', function ()
function(callback)
{
var arrBind = [];
var count = 10;
var count = 2;
for(var i = 0; i<count; i++)
{
arrBind.push(['string'+i, i, "2020-05-11", "12:35:41.3333333", "2022-04-01 23:59:59", "2022-07-08 12:05:30.9999999"]);
Expand Down Expand Up @@ -170,7 +172,7 @@ describe('Test Array Bind', function ()
function(callback)
{
var arrBind = [];
var count = 100000;
var count = 100;
for(var i = 0; i<count; i++)
{
arrBind.push([null, i, "2020-05-11", "12:35:41.3333333", "2022-04-01 23:59:59", "2022-07-08 12:05:30.9999999"]);
Expand Down Expand Up @@ -199,7 +201,7 @@ describe('Test Array Bind', function ()
function(callback)
{
var arrBind = [];
var count = 10;
var count = 2;
for(var i = 0; i<count; i++)
{
arrBind.push(['string'+i, i, "2020-05-11", "12:35:41.3333333", "2022-04-01 23:59:59", "2022-07-08 12:05:30.9999999"]);
Expand Down Expand Up @@ -269,7 +271,7 @@ describe('Test Array Bind', function ()
function (callback)
{
var arrBind = [];
var count = 15000;
var count = 100;
for(var i = 0; i<count; i++)
{
arrBind.push(["some-data-for-stuff1","some-data-for-stuff2"]);
Expand Down Expand Up @@ -307,7 +309,7 @@ describe('Test Array Bind', function ()
function (callback)
{
var arrBind = [];
var count = 70000;
var count = 100;
for(var i = 0; i<count; i++)
{
arrBind.push(["some-data-for-stuff1"]);
Expand Down Expand Up @@ -348,42 +350,42 @@ describe('Test Array Bind', function ()
[
"5489",
"SAMPLE",
"{\"user\":.........}",
"{\"user\":{\"SSS\":\"KKKK003\",\"email\":\"THE\"}",
"2018-11-02T04:14:56.000000Z",
null
],
[
"5490",
"SAMPLE",
"{\"user\":.........}",
"{\"user\":{\"SSS\":\"LLL108\",\"email\":\"Jenn\"}",
"2018-11-02T04:14:56.000000Z",
null
],
[
"5491",
"SAMPLE",
"{\"user\":.......}",
"{\"user\":{\"SSS\":\"LLL108\",\"email\":\"Jennif\"}",
"2018-11-02T04:14:56.000000Z",
null
],
[
"5492",
"SAMPLE",
"{\"user\":.....}",
"{\"user\":{\"SSS\":\"LLL108\",\"email\":\"Je\"}",
"2018-11-02T04:14:56.000000Z",
null
],
[
"5493",
"SAMPLE",
"{\"user\":.......}",
"{\"user\":{\"SSS\":\"LLL108\",\"email\":\"Jenn\"}",
"2018-11-02T04:14:56.000000Z",
null
],
[
"5494",
"SAMPLE",
"{\"user\":.....}",
"{\"user\":{\"SSS\":\"LLL108\",\"email\":\"Jennifer@xxx.com\"}",
"2018-11-02T04:14:56.000000Z",
null
]
Expand Down
35 changes: 18 additions & 17 deletions test/integration/testArrayBindCustomerTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const sourceRowCount = 30000;

describe('Test Concurrent Execution', function ()
{
this.timeout(300000);
var connection;
var createTable = 'create or replace TABLE EVENTS_TEMP (ORGANIZATION_ID VARCHAR(16777216),' +
'APP_ID VARCHAR(16777216), OCCURREDAT VARCHAR(16777216), SHOP_ID VARCHAR(16777216),' +
Expand Down Expand Up @@ -44,23 +45,23 @@ describe('Test Concurrent Execution', function ()

it('testArrayBindCustomerTable', function (done)
{
var arrBind = [];
var count = 1000000;
for(var i = 0; i<count; i++)
{
arrBind.push(['string'+i, 'appid', "occuredat", "shopid", "type", "id", 10.9, "charge amount currency code",
'chargeid','chargename','chargetest','chargebillingon', 'reason', 'description', 99.99, 'appcredit amount currency code',
'appcreditid','appcreditname','appcredittest','appname','shopmyshopifyoumin','shopname','appapikey']);
}
var insertStatement = connection.execute({
sqlText: insertWithQmark,
binds: arrBind,
complete: function (err, stmt) {
testUtil.checkError(err);
assert.strictEqual(stmt.getNumUpdatedRows(), count);
var arrBind = [];
var count = 400000;
for(var i = 0; i<count; i++)
{
arrBind.push(['string'+i, 'appid', "occuredat", "shopid", "type", "id", 10.9, "charge amount currency code",
'chargeid','chargename','chargetest','chargebillingon', 'reason', 'description', 99.99, 'appcredit amount currency code',
'appcreditid','appcreditname','appcredittest','appname','shopmyshopifyoumin','shopname','appapikey']);
}

var insertStatement = connection.execute({
sqlText: insertWithQmark,
binds: arrBind,
complete: function (err, stmt) {
testUtil.checkError(err);
assert.strictEqual(stmt.getNumUpdatedRows(), count);
done();
}
});
}
});
});
});
2 changes: 1 addition & 1 deletion test/integration/testStreamRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ describe('Test Stream Rows API', function ()
it('testLargeResultSet', function (done) {
// The test should finish in around 3 min
this.timeout(180000);
var expectedRowCount = 10000000;
var expectedRowCount = 5000000;
connection.execute({
sqlText: 'select randstr(10, random()) from table(generator(rowcount=>' + expectedRowCount + '))',
streamResult: true,
Expand Down

0 comments on commit e281fa1

Please sign in to comment.