Skip to content

Commit 38eea67

Browse files
committed
[SEA-NodeJS] add TIMESTAMP_NTZ / TIMESTAMP_LTZ bound-param types
Consolidates the last net-new bit of the superseded #408: two SEA-path DBSQLParameterType variants for binding timezone-explicit timestamps. The type name flows through the existing param codec (toSparkParameter → sqlType), which the kernel accepts — validated live (SELECT ? with TIMESTAMP_NTZ/LTZ returns the bound values). On the Thrift backend they degrade to a plain TIMESTAMP bind. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent 147006f commit 38eea67

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

lib/DBSQLParameter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ export enum DBSQLParameterType {
88
STRING = 'STRING',
99
DATE = 'DATE',
1010
TIMESTAMP = 'TIMESTAMP',
11+
// Timezone-explicit timestamp variants. A bare `Date` value defaults to
12+
// `TIMESTAMP`; set one of these explicitly to bind a TIMESTAMP_NTZ (no
13+
// timezone, wall-clock) or TIMESTAMP_LTZ (local timezone) parameter. These
14+
// are SEA-path types the kernel param codec accepts; the Thrift wire only
15+
// has `TIMESTAMP`, so on the Thrift backend they degrade to a plain
16+
// TIMESTAMP bind.
17+
TIMESTAMP_NTZ = 'TIMESTAMP_NTZ',
18+
TIMESTAMP_LTZ = 'TIMESTAMP_LTZ',
1119
FLOAT = 'FLOAT',
1220
DECIMAL = 'DECIMAL',
1321
DOUBLE = 'DOUBLE',

tests/unit/sea/positionalParams.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ describe('SeaPositionalParams.buildSeaPositionalParams', () => {
9090
{ sqlType: 'TIMESTAMP', value: '2024-01-15 10:30:00' },
9191
]);
9292
});
93+
94+
it('honours explicit TIMESTAMP_NTZ / TIMESTAMP_LTZ types (kernel param codec)', () => {
95+
expect(
96+
buildSeaPositionalParams([
97+
new DBSQLParameter({ type: DBSQLParameterType.TIMESTAMP_NTZ, value: '2024-01-15 10:30:00' }),
98+
new DBSQLParameter({ type: DBSQLParameterType.TIMESTAMP_LTZ, value: '2024-01-15 10:30:00' }),
99+
]),
100+
).to.deep.equal([
101+
{ sqlType: 'TIMESTAMP_NTZ', value: '2024-01-15 10:30:00' },
102+
{ sqlType: 'TIMESTAMP_LTZ', value: '2024-01-15 10:30:00' },
103+
]);
104+
});
93105
});
94106

95107
describe('SeaPositionalParams.buildSeaNamedParams', () => {

0 commit comments

Comments
 (0)