From 5fb7d82b08e597c38376ada0b8de5093766b4e8e Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Tue, 20 Jun 2023 15:48:07 +0530 Subject: [PATCH 1/8] feat: untyped data types --- src/codec.ts | 5 +- src/transaction.ts | 5 +- system-test/spanner.ts | 262 +++++++++++++++++++++++++++++++++++++++++ test/codec.ts | 4 +- test/spanner.ts | 1 - test/transaction.ts | 41 ++++--- 6 files changed, 291 insertions(+), 27 deletions(-) diff --git a/src/codec.ts b/src/codec.ts index a51320636..14e9056b2 100644 --- a/src/codec.ts +++ b/src/codec.ts @@ -597,10 +597,6 @@ function getType(value: Value): Type { return {type: 'bool'}; } - if (is.string(value)) { - return {type: 'string'}; - } - if (Buffer.isBuffer(value)) { return {type: 'bytes'}; } @@ -643,6 +639,7 @@ function getType(value: Value): Type { return {type: 'json'}; } + // String type is also returned as unspecified to allow untyped parameters return {type: 'unspecified'}; } diff --git a/src/transaction.ts b/src/transaction.ts index eee170447..b6c763d45 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -1282,7 +1282,10 @@ export class Snapshot extends EventEmitter { if (!is.empty(typeMap)) { Object.keys(typeMap).forEach(param => { const type = typeMap[param]; - paramTypes[param] = codec.createTypeObject(type); + const typeObject = codec.createTypeObject(type); + if (typeObject.code !== 'TYPE_CODE_UNSPECIFIED') { + paramTypes[param] = codec.createTypeObject(type); + } }); } diff --git a/system-test/spanner.ts b/system-test/spanner.ts index e6d0f7809..f9cbda5cf 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -275,6 +275,47 @@ describe('Spanner', () => { }); }); } + function readUntypedData(column, value, dialect, callback) { + const id = generateName('id'); + const insertData = { + Key: id, + [column]: value, + }; + + let table = googleSqlTable; + let query: ExecuteSqlRequest = { + sql: 'SELECT * FROM `' + table.name + '` WHERE ' + column + ' = @value', + params: { + value, + }, + }; + let database = DATABASE; + if (dialect === Spanner.POSTGRESQL) { + table = postgreSqlTable; + query = { + sql: 'SELECT * FROM ' + table.name + ' WHERE "' + column + '" = $1', + params: { + p1: value, + }, + }; + database = PG_DATABASE; + } + table.insert(insertData, (err, insertResp) => { + if (err) { + callback(err); + return; + } + + database.run(query, (err, rows, readResp) => { + if (err) { + callback(err); + return; + } + + callback(null, rows.shift(), insertResp, readResp); + }); + }); + } before(async () => { if (IS_EMULATOR_ENABLED) { @@ -757,6 +798,27 @@ describe('Spanner', () => { done(); }); }); + + it('GOOGLE_STANDARD_SQL should read untyped int64 values', done => { + readUntypedData( + 'IntValue', + '5', + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().IntValue, 5); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped int64 values', done => { + readUntypedData('IntValue', '5', Spanner.POSTGRESQL, (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().IntValue, 5); + done(); + }); + }); }); describe('float64s', () => { @@ -905,6 +967,27 @@ describe('Spanner', () => { done(); }); }); + + it('GOOGLE_STANDARD_SQL should read untyped float64 values', done => { + readUntypedData( + 'FloatValue', + 5.6, + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().FloatValue, 5.6); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped float64 values', done => { + readUntypedData('FloatValue', 5.6, Spanner.POSTGRESQL, (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().FloatValue, 5.6); + done(); + }); + }); }); describe('numerics', () => { @@ -1055,6 +1138,38 @@ describe('Spanner', () => { done(); }); }); + + it('GOOGLE_STANDARD_SQL should read untyped numeric values', done => { + readUntypedData( + 'NumericValue', + '5.623', + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual( + row.toJSON().NumericValue.value, + Spanner.numeric('5.623').value + ); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped numeric values', done => { + readUntypedData( + 'NumericValue', + '5.623', + Spanner.POSTGRESQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual( + row.toJSON().NumericValue, + Spanner.pgNumeric(5.623) + ); + done(); + } + ); + }); }); describe('strings', () => { @@ -1156,6 +1271,32 @@ describe('Spanner', () => { } ); }); + + it('GOOGLE_STANDARD_SQL should read untyped string values', done => { + readUntypedData( + 'StringValue', + 'hello', + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().StringValue, 'hello'); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped string values', done => { + readUntypedData( + 'StringValue', + 'hello', + Spanner.POSTGRESQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().StringValue, 'hello'); + done(); + } + ); + }); }); describe('bytes', () => { @@ -1257,6 +1398,32 @@ describe('Spanner', () => { done(); }); }); + + it('GOOGLE_STANDARD_SQL should read untyped bytes values', done => { + readUntypedData( + 'BytesValue', + Buffer.from('b'), + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().BytesValue, Buffer.from('b')); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped bytes values', done => { + readUntypedData( + 'BytesValue', + Buffer.from('b'), + Spanner.POSTGRESQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().BytesValue, Buffer.from('b')); + done(); + } + ); + }); }); describe('jsons', () => { @@ -1319,6 +1486,23 @@ describe('Spanner', () => { } ); }); + + it('GOOGLE_STANDARD_SQL should read untyped json values', done => { + const value = { + key1: 'value1', + key2: 'value2', + }; + readUntypedData( + 'JsonValue', + value, + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().JsonValue, value); + done(); + } + ); + }); }); describe('timestamps', () => { @@ -1435,6 +1619,40 @@ describe('Spanner', () => { done(); }); }); + + it('GOOGLE_STANDARD_SQL should read untyped timestamp values', done => { + readUntypedData( + 'TimestampValue', + '2014-09-27T12:30:00.45Z', + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + const time = row.toJSON().TimestampValue.getTime(); + assert.strictEqual( + time, + Spanner.timestamp('2014-09-27T12:30:00.45Z').getTime() + ); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped timestamp values', done => { + readUntypedData( + 'TimestampValue', + '2014-09-27T12:30:00.45Z', + Spanner.POSTGRESQL, + (err, row) => { + assert.ifError(err); + const time = row.toJSON().TimestampValue.getTime(); + assert.strictEqual( + time, + Spanner.timestamp('2014-09-27T12:30:00.45Z').getTime() + ); + done(); + } + ); + }); }); describe('dates', () => { @@ -1541,6 +1759,38 @@ describe('Spanner', () => { done(); }); }); + + it('GOOGLE_STANDARD_SQL should read untyped date values', done => { + readUntypedData( + 'DateValue', + '2014-09-27', + Spanner.GOOGLE_STANDARD_SQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual( + Spanner.date(row.toJSON().DateValue), + Spanner.date('2014-09-27') + ); + done(); + } + ); + }); + + it('POSTGRESQL should read untyped date values', done => { + readUntypedData( + 'DateValue', + '2014-09-27', + Spanner.POSTGRESQL, + (err, row) => { + assert.ifError(err); + assert.deepStrictEqual( + Spanner.date(row.toJSON().DateValue), + Spanner.date('2014-09-27') + ); + done(); + } + ); + }); }); describe('jsonb', () => { @@ -1600,6 +1850,18 @@ describe('Spanner', () => { } ); }); + + it('POSTGRESQL should read untyped json values', done => { + const value = Spanner.pgJsonb({ + key1: 'value1', + key2: 'value2', + }); + readUntypedData('JsonbValue', value, Spanner.POSTGRESQL, (err, row) => { + assert.ifError(err); + assert.deepStrictEqual(row.toJSON().JsonbValue, value); + done(); + }); + }); }); describe('commit timestamp', () => { diff --git a/test/codec.ts b/test/codec.ts index 66dd08dbd..a77d5cbb7 100644 --- a/test/codec.ts +++ b/test/codec.ts @@ -917,7 +917,7 @@ describe('codec', () => { }); it('should determine if the value is a string', () => { - assert.deepStrictEqual(codec.getType('abc'), {type: 'string'}); + assert.deepStrictEqual(codec.getType('abc'), {type: 'unspecified'}); }); it('should determine if the value is bytes', () => { @@ -954,7 +954,7 @@ describe('codec', () => { assert.deepStrictEqual(type, { type: 'struct', - fields: [{name: 'a', type: 'string'}], + fields: [{name: 'a', type: 'unspecified'}], }); }); diff --git a/test/spanner.ts b/test/spanner.ts index 322566389..d743bd6be 100644 --- a/test/spanner.ts +++ b/test/spanner.ts @@ -961,7 +961,6 @@ describe('Spanner with mock server', () => { assert.strictEqual(request.paramTypes!['int64'].code, 'INT64'); assert.strictEqual(request.paramTypes!['float64'].code, 'FLOAT64'); assert.strictEqual(request.paramTypes!['numeric'].code, 'NUMERIC'); - assert.strictEqual(request.paramTypes!['string'].code, 'STRING'); assert.strictEqual(request.paramTypes!['bytes'].code, 'BYTES'); assert.strictEqual(request.paramTypes!['json'].code, 'JSON'); assert.strictEqual(request.paramTypes!['date'].code, 'DATE'); diff --git a/test/transaction.ts b/test/transaction.ts index 45cd9dbf6..c29b41e0c 100644 --- a/test/transaction.ts +++ b/test/transaction.ts @@ -941,10 +941,11 @@ describe('Transaction', () => { }); it('should guess missing param types', () => { - const fakeParams = {a: 'foo', b: 3}; + const fakeParams = {a: true, b: 3}; const fakeTypes = {b: 'number'}; - const fakeMissingType = {type: 'string'}; - const expectedType = {code: google.spanner.v1.TypeCode.STRING}; + const fakeMissingType = {type: 'boolean'}; + const expectedMissingType = {code: google.spanner.v1.TypeCode.BOOL}; + const expectedKnownType = {code: google.spanner.v1.TypeCode.INT64}; sandbox .stub(codec, 'getType') @@ -953,15 +954,17 @@ describe('Transaction', () => { sandbox .stub(codec, 'createTypeObject') + .withArgs('number') + .returns(expectedKnownType as google.spanner.v1.Type) .withArgs(fakeMissingType) - .returns(expectedType as google.spanner.v1.Type); + .returns(expectedMissingType as google.spanner.v1.Type); const {paramTypes} = Snapshot.encodeParams({ params: fakeParams, types: fakeTypes, }); - assert.strictEqual(paramTypes.a, expectedType); + assert.strictEqual(paramTypes.a, expectedMissingType); }); }); }); @@ -1088,17 +1091,17 @@ describe('Transaction', () => { const OBJ_STATEMENTS = [ { - sql: 'INSERT INTO TxnTable (Key, StringValue) VALUES(@key, @str)', + sql: 'INSERT INTO TxnTable (Key, BoolValue) VALUES(@key, @bool)', params: { - key: 'k999', - str: 'abc', + key: 999, + bool: true, }, }, { - sql: 'UPDATE TxnTable t SET t.StringValue = @str WHERE t.Key = @key', + sql: 'UPDATE TxnTable t SET t.BoolValue = @bool WHERE t.Key = @key', params: { - key: 'k999', - str: 'abcd', + key: 999, + bool: false, }, }, ]; @@ -1108,26 +1111,26 @@ describe('Transaction', () => { sql: OBJ_STATEMENTS[0].sql, params: { fields: { - key: {stringValue: OBJ_STATEMENTS[0].params.key}, - str: {stringValue: OBJ_STATEMENTS[0].params.str}, + key: {stringValue: OBJ_STATEMENTS[0].params.key.toString()}, + bool: {boolValue: OBJ_STATEMENTS[0].params.bool}, }, }, paramTypes: { - key: {code: 'STRING'}, - str: {code: 'STRING'}, + key: {code: 'INT64'}, + bool: {code: 'BOOL'}, }, }, { sql: OBJ_STATEMENTS[1].sql, params: { fields: { - key: {stringValue: OBJ_STATEMENTS[1].params.key}, - str: {stringValue: OBJ_STATEMENTS[1].params.str}, + key: {stringValue: OBJ_STATEMENTS[1].params.key.toString()}, + bool: {boolValue: OBJ_STATEMENTS[1].params.bool}, }, }, paramTypes: { - key: {code: 'STRING'}, - str: {code: 'STRING'}, + key: {code: 'INT64'}, + bool: {code: 'BOOL'}, }, }, ]; From 042661ed0f6226fbf5f901bd6a23ad01651383fb Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Wed, 26 Jul 2023 07:45:59 +0530 Subject: [PATCH 2/8] change --- system-test/spanner.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/system-test/spanner.ts b/system-test/spanner.ts index 805b8d900..69e411116 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -1486,23 +1486,6 @@ describe('Spanner', () => { } ); }); - - it('GOOGLE_STANDARD_SQL should read untyped json values', done => { - const value = { - key1: 'value1', - key2: 'value2', - }; - readUntypedData( - 'JsonValue', - value, - Spanner.GOOGLE_STANDARD_SQL, - (err, row) => { - assert.ifError(err); - assert.deepStrictEqual(row.toJSON().JsonValue, value); - done(); - } - ); - }); }); describe('timestamps', () => { @@ -1850,18 +1833,6 @@ describe('Spanner', () => { } ); }); - - it('POSTGRESQL should read untyped json values', done => { - const value = Spanner.pgJsonb({ - key1: 'value1', - key2: 'value2', - }); - readUntypedData('JsonbValue', value, Spanner.POSTGRESQL, (err, row) => { - assert.ifError(err); - assert.deepStrictEqual(row.toJSON().JsonbValue, value); - done(); - }); - }); }); describe('commit timestamp', () => { From fc051b7a890a89027c85084b67e310bfe3ea7ce0 Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Wed, 26 Jul 2023 15:51:21 +0530 Subject: [PATCH 3/8] changes --- samples/dml.js | 15 +++++++++ samples/struct.js | 30 ++++++++++++++++++ system-test/spanner.ts | 71 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) diff --git a/samples/dml.js b/samples/dml.js index 4ab57147f..69b5322f7 100644 --- a/samples/dml.js +++ b/samples/dml.js @@ -288,6 +288,21 @@ function updateUsingDmlWithStruct(instanceId, databaseId, projectId) { params: { name: nameStruct, }, + types: { + name: { + type: 'struct', + fields: [ + { + name: 'FirstName', + type: 'string', + }, + { + name: 'LastName', + type: 'string', + }, + ], + }, + }, }); console.log(`Successfully updated ${rowCount} record.`); diff --git a/samples/struct.js b/samples/struct.js index a484b7ee1..3efd08127 100644 --- a/samples/struct.js +++ b/samples/struct.js @@ -111,6 +111,21 @@ async function queryDataWithStruct(instanceId, databaseId, projectId) { params: { name: nameStruct, }, + types: { + name: { + type: 'struct', + fields: [ + { + name: 'FirstName', + type: 'string', + }, + { + name: 'LastName', + type: 'string', + }, + ], + }, + }, }; // Queries rows from the Singers table @@ -250,6 +265,21 @@ async function queryStructField(instanceId, databaseId, projectId) { params: { name: nameStruct, }, + types: { + name: { + type: 'struct', + fields: [ + { + name: 'FirstName', + type: 'string', + }, + { + name: 'LastName', + type: 'string', + }, + ], + }, + }, }; // Queries rows from the Singers table diff --git a/system-test/spanner.ts b/system-test/spanner.ts index 69e411116..2582f2f2c 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -5154,6 +5154,9 @@ describe('Spanner', () => { params: { v: 'abc', }, + types: { + v: 'string', + }, }; stringQuery(done, DATABASE, query, 'abc'); }); @@ -5208,6 +5211,12 @@ describe('Spanner', () => { params: { v: values, }, + types: { + v: { + type: 'array', + child: 'string', + }, + }, }; DATABASE.run(query, (err, rows) => { @@ -5660,6 +5669,21 @@ describe('Spanner', () => { }), p4: Spanner.int(10), }, + types: { + structParam: { + type: 'struct', + fields: [ + { + name: 'userf', + type: 'string', + }, + { + name: 'threadf', + type: 'int64', + }, + ], + }, + }, }; DATABASE.run(query, (err, rows) => { @@ -5715,6 +5739,23 @@ describe('Spanner', () => { }), }), }, + types: { + structParam: { + type: 'struct', + fields: [ + { + name: 'structf', + type: 'struct', + fields: [ + { + name: 'nestedf', + type: 'string', + }, + ], + }, + ], + }, + }, }; DATABASE.run(query, (err, rows) => { @@ -5886,6 +5927,21 @@ describe('Spanner', () => { userf: 'bob', }), }, + types: { + structParam: { + type: 'struct', + fields: [ + { + name: 'userf', + type: 'string', + }, + { + name: 'threadf', + type: 'int64', + }, + ], + }, + }, }; DATABASE.run(query, (err, rows) => { @@ -5907,6 +5963,21 @@ describe('Spanner', () => { threadf: Spanner.int(1), }), }, + types: { + structParam: { + type: 'struct', + fields: [ + { + name: 'userf', + type: 'string', + }, + { + name: 'threadf', + type: 'int64', + }, + ], + }, + }, }; DATABASE.run(query, (err, rows) => { From d1e5e2f874855dcbdce625483fb2d79d52f20a68 Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Thu, 3 Aug 2023 16:06:22 +0530 Subject: [PATCH 4/8] change --- system-test/spanner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-test/spanner.ts b/system-test/spanner.ts index 2582f2f2c..d8a0659ab 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -5923,8 +5923,8 @@ describe('Spanner', () => { sql: 'SELECT @structParam=STRUCT(1, "bob")', params: { structParam: Spanner.struct({ - threadf: Spanner.int(1), userf: 'bob', + threadf: Spanner.int(1), }), }, types: { From e915c4f6e592864b4c48d1c7cfc95c4e8f53ce0f Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Thu, 3 Aug 2023 16:12:44 +0530 Subject: [PATCH 5/8] change --- system-test/spanner.ts | 70 +++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/system-test/spanner.ts b/system-test/spanner.ts index d8a0659ab..0285f74aa 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -799,7 +799,10 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped int64 values', done => { + it('GOOGLE_STANDARD_SQL should read untyped int64 values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'IntValue', '5', @@ -812,7 +815,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped int64 values', done => { + it('POSTGRESQL should read untyped int64 values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData('IntValue', '5', Spanner.POSTGRESQL, (err, row) => { assert.ifError(err); assert.deepStrictEqual(row.toJSON().IntValue, 5); @@ -968,7 +974,10 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped float64 values', done => { + it('GOOGLE_STANDARD_SQL should read untyped float64 values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'FloatValue', 5.6, @@ -981,7 +990,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped float64 values', done => { + it('POSTGRESQL should read untyped float64 values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData('FloatValue', 5.6, Spanner.POSTGRESQL, (err, row) => { assert.ifError(err); assert.deepStrictEqual(row.toJSON().FloatValue, 5.6); @@ -1139,7 +1151,10 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped numeric values', done => { + it('GOOGLE_STANDARD_SQL should read untyped numeric values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'NumericValue', '5.623', @@ -1155,7 +1170,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped numeric values', done => { + it('POSTGRESQL should read untyped numeric values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'NumericValue', '5.623', @@ -1272,7 +1290,10 @@ describe('Spanner', () => { ); }); - it('GOOGLE_STANDARD_SQL should read untyped string values', done => { + it('GOOGLE_STANDARD_SQL should read untyped string values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'StringValue', 'hello', @@ -1285,7 +1306,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped string values', done => { + it('POSTGRESQL should read untyped string values', function (done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'StringValue', 'hello', @@ -1399,7 +1423,10 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped bytes values', done => { + it('GOOGLE_STANDARD_SQL should read untyped bytes values', function (done){ + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'BytesValue', Buffer.from('b'), @@ -1412,7 +1439,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped bytes values', done => { + it('POSTGRESQL should read untyped bytes values', function(done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'BytesValue', Buffer.from('b'), @@ -1603,7 +1633,10 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped timestamp values', done => { + it('GOOGLE_STANDARD_SQL should read untyped timestamp values', function(done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'TimestampValue', '2014-09-27T12:30:00.45Z', @@ -1620,7 +1653,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped timestamp values', done => { + it('POSTGRESQL should read untyped timestamp values', function(done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'TimestampValue', '2014-09-27T12:30:00.45Z', @@ -1743,7 +1779,10 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped date values', done => { + it('GOOGLE_STANDARD_SQL should read untyped date values', function(done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'DateValue', '2014-09-27', @@ -1759,7 +1798,10 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped date values', done => { + it('POSTGRESQL should read untyped date values', function(done) { + if (IS_EMULATOR_ENABLED) { + this.skip(); + } readUntypedData( 'DateValue', '2014-09-27', From 01b8f1532583f975529c96b20da832ac6c00b0e9 Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Thu, 3 Aug 2023 16:32:14 +0530 Subject: [PATCH 6/8] change --- system-test/spanner.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system-test/spanner.ts b/system-test/spanner.ts index 0285f74aa..53b379c96 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -1423,7 +1423,7 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped bytes values', function (done){ + it('GOOGLE_STANDARD_SQL should read untyped bytes values', function (done) { if (IS_EMULATOR_ENABLED) { this.skip(); } @@ -1439,7 +1439,7 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped bytes values', function(done) { + it('POSTGRESQL should read untyped bytes values', function (done) { if (IS_EMULATOR_ENABLED) { this.skip(); } @@ -1633,7 +1633,7 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped timestamp values', function(done) { + it('GOOGLE_STANDARD_SQL should read untyped timestamp values', function (done) { if (IS_EMULATOR_ENABLED) { this.skip(); } @@ -1653,7 +1653,7 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped timestamp values', function(done) { + it('POSTGRESQL should read untyped timestamp values', function (done) { if (IS_EMULATOR_ENABLED) { this.skip(); } @@ -1779,7 +1779,7 @@ describe('Spanner', () => { }); }); - it('GOOGLE_STANDARD_SQL should read untyped date values', function(done) { + it('GOOGLE_STANDARD_SQL should read untyped date values', function (done) { if (IS_EMULATOR_ENABLED) { this.skip(); } @@ -1798,7 +1798,7 @@ describe('Spanner', () => { ); }); - it('POSTGRESQL should read untyped date values', function(done) { + it('POSTGRESQL should read untyped date values', function (done) { if (IS_EMULATOR_ENABLED) { this.skip(); } From b388bcb8e0eb738476d196af886c5e270fa217e4 Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Fri, 4 Aug 2023 16:13:29 +0530 Subject: [PATCH 7/8] Change --- system-test/spanner.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/system-test/spanner.ts b/system-test/spanner.ts index 53b379c96..7821e649f 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -5969,21 +5969,6 @@ describe('Spanner', () => { threadf: Spanner.int(1), }), }, - types: { - structParam: { - type: 'struct', - fields: [ - { - name: 'userf', - type: 'string', - }, - { - name: 'threadf', - type: 'int64', - }, - ], - }, - }, }; DATABASE.run(query, (err, rows) => { From ea8e3338104ff3ee64db147ed2c1cef50b1e9d10 Mon Sep 17 00:00:00 2001 From: Astha Mohta Date: Fri, 4 Aug 2023 16:25:12 +0530 Subject: [PATCH 8/8] change --- system-test/spanner.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/system-test/spanner.ts b/system-test/spanner.ts index 7821e649f..ab5ba7890 100644 --- a/system-test/spanner.ts +++ b/system-test/spanner.ts @@ -5965,10 +5965,25 @@ describe('Spanner', () => { sql: 'SELECT @structParam=STRUCT(1, "bob")', params: { structParam: Spanner.struct({ - userf: 'bob', threadf: Spanner.int(1), + userf: 'bob', }), }, + types: { + structParam: { + type: 'struct', + fields: [ + { + name: 'threadf', + type: 'int64', + }, + { + name: 'userf', + type: 'string', + }, + ], + }, + }, }; DATABASE.run(query, (err, rows) => {