@databricks/sql 1.8.3 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -8
- package/dist/DBSQLClient.d.ts +8 -5
- package/dist/DBSQLClient.js +70 -82
- package/dist/DBSQLClient.js.map +1 -1
- package/dist/DBSQLLogger.js +2 -13
- package/dist/DBSQLLogger.js.map +1 -1
- package/dist/DBSQLOperation.d.ts +7 -2
- package/dist/DBSQLOperation.js +227 -237
- package/dist/DBSQLOperation.js.map +1 -1
- package/dist/DBSQLSession.d.ts +3 -1
- package/dist/DBSQLSession.js +284 -220
- package/dist/DBSQLSession.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.d.ts +7 -2
- package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js +91 -104
- package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.js +114 -134
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.js +4 -17
- package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/index.d.ts +3 -2
- package/dist/connection/auth/DatabricksOAuth/index.js +19 -22
- package/dist/connection/auth/DatabricksOAuth/index.js.map +1 -1
- package/dist/connection/auth/PlainHttpAuthentication.js +5 -13
- package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
- package/dist/connection/connections/HttpConnection.d.ts +1 -1
- package/dist/connection/connections/HttpConnection.js +49 -47
- package/dist/connection/connections/HttpConnection.js.map +1 -1
- package/dist/connection/connections/HttpRetryPolicy.d.ts +1 -1
- package/dist/connection/connections/HttpRetryPolicy.js +28 -41
- package/dist/connection/connections/HttpRetryPolicy.js.map +1 -1
- package/dist/connection/connections/NullRetryPolicy.js +5 -18
- package/dist/connection/connections/NullRetryPolicy.js.map +1 -1
- package/dist/connection/connections/ThriftHttpConnection.js +22 -20
- package/dist/connection/connections/ThriftHttpConnection.js.map +1 -1
- package/dist/connection/contracts/IConnectionProvider.d.ts +1 -1
- package/dist/contracts/IClientContext.d.ts +4 -2
- package/dist/contracts/IDBSQLSession.d.ts +21 -13
- package/dist/contracts/IOperation.d.ts +23 -0
- package/dist/contracts/IThriftClient.d.ts +8 -0
- package/dist/contracts/IThriftClient.js +3 -0
- package/dist/contracts/IThriftClient.js.map +1 -0
- package/dist/dto/InfoValue.d.ts +1 -2
- package/dist/hive/Commands/BaseCommand.d.ts +3 -4
- package/dist/hive/Commands/BaseCommand.js +22 -33
- package/dist/hive/Commands/BaseCommand.js.map +1 -1
- package/dist/hive/Commands/CancelDelegationTokenCommand.d.ts +4 -1
- package/dist/hive/Commands/CancelDelegationTokenCommand.js.map +1 -1
- package/dist/hive/Commands/CancelOperationCommand.d.ts +4 -1
- package/dist/hive/Commands/CancelOperationCommand.js.map +1 -1
- package/dist/hive/Commands/CloseOperationCommand.d.ts +4 -1
- package/dist/hive/Commands/CloseOperationCommand.js.map +1 -1
- package/dist/hive/Commands/CloseSessionCommand.d.ts +4 -1
- package/dist/hive/Commands/CloseSessionCommand.js.map +1 -1
- package/dist/hive/Commands/ExecuteStatementCommand.d.ts +4 -1
- package/dist/hive/Commands/ExecuteStatementCommand.js.map +1 -1
- package/dist/hive/Commands/FetchResultsCommand.d.ts +4 -1
- package/dist/hive/Commands/FetchResultsCommand.js.map +1 -1
- package/dist/hive/Commands/GetCatalogsCommand.d.ts +4 -1
- package/dist/hive/Commands/GetCatalogsCommand.js.map +1 -1
- package/dist/hive/Commands/GetColumnsCommand.d.ts +4 -1
- package/dist/hive/Commands/GetColumnsCommand.js.map +1 -1
- package/dist/hive/Commands/GetCrossReferenceCommand.d.ts +4 -1
- package/dist/hive/Commands/GetCrossReferenceCommand.js.map +1 -1
- package/dist/hive/Commands/GetDelegationTokenCommand.d.ts +4 -1
- package/dist/hive/Commands/GetDelegationTokenCommand.js.map +1 -1
- package/dist/hive/Commands/GetFunctionsCommand.d.ts +4 -1
- package/dist/hive/Commands/GetFunctionsCommand.js.map +1 -1
- package/dist/hive/Commands/GetInfoCommand.d.ts +4 -1
- package/dist/hive/Commands/GetInfoCommand.js.map +1 -1
- package/dist/hive/Commands/GetOperationStatusCommand.d.ts +4 -1
- package/dist/hive/Commands/GetOperationStatusCommand.js.map +1 -1
- package/dist/hive/Commands/GetPrimaryKeysCommand.d.ts +4 -1
- package/dist/hive/Commands/GetPrimaryKeysCommand.js.map +1 -1
- package/dist/hive/Commands/GetResultSetMetadataCommand.d.ts +4 -1
- package/dist/hive/Commands/GetResultSetMetadataCommand.js.map +1 -1
- package/dist/hive/Commands/GetSchemasCommand.d.ts +4 -1
- package/dist/hive/Commands/GetSchemasCommand.js.map +1 -1
- package/dist/hive/Commands/GetTableTypesCommand.d.ts +4 -1
- package/dist/hive/Commands/GetTableTypesCommand.js.map +1 -1
- package/dist/hive/Commands/GetTablesCommand.d.ts +4 -1
- package/dist/hive/Commands/GetTablesCommand.js.map +1 -1
- package/dist/hive/Commands/GetTypeInfoCommand.d.ts +4 -1
- package/dist/hive/Commands/GetTypeInfoCommand.js.map +1 -1
- package/dist/hive/Commands/OpenSessionCommand.d.ts +4 -1
- package/dist/hive/Commands/OpenSessionCommand.js.map +1 -1
- package/dist/hive/Commands/RenewDelegationTokenCommand.d.ts +4 -1
- package/dist/hive/Commands/RenewDelegationTokenCommand.js.map +1 -1
- package/dist/hive/HiveDriver.js +104 -155
- package/dist/hive/HiveDriver.js.map +1 -1
- package/dist/polyfills.d.ts +1 -1
- package/dist/polyfills.js +3 -2
- package/dist/polyfills.js.map +1 -1
- package/dist/result/ArrowResultConverter.d.ts +1 -1
- package/dist/result/ArrowResultConverter.js +69 -84
- package/dist/result/ArrowResultConverter.js.map +1 -1
- package/dist/result/ArrowResultHandler.d.ts +1 -1
- package/dist/result/ArrowResultHandler.js +33 -42
- package/dist/result/ArrowResultHandler.js.map +1 -1
- package/dist/result/CloudFetchResultHandler.d.ts +1 -1
- package/dist/result/CloudFetchResultHandler.js +53 -66
- package/dist/result/CloudFetchResultHandler.js.map +1 -1
- package/dist/result/JsonResultHandler.d.ts +0 -1
- package/dist/result/JsonResultHandler.js +14 -41
- package/dist/result/JsonResultHandler.js.map +1 -1
- package/dist/result/ResultSlicer.js +40 -53
- package/dist/result/ResultSlicer.js.map +1 -1
- package/dist/result/RowSetProvider.d.ts +4 -0
- package/dist/result/RowSetProvider.js +42 -59
- package/dist/result/RowSetProvider.js.map +1 -1
- package/dist/result/utils.d.ts +2 -1
- package/dist/result/utils.js +9 -1
- package/dist/result/utils.js.map +1 -1
- package/dist/utils/CloseableCollection.js +7 -18
- package/dist/utils/CloseableCollection.js.map +1 -1
- package/dist/utils/OperationIterator.d.ts +23 -0
- package/dist/utils/OperationIterator.js +71 -0
- package/dist/utils/OperationIterator.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lz4.d.ts +3 -0
- package/dist/utils/lz4.js +15 -0
- package/dist/utils/lz4.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -8
- package/thrift/TCLIService.d.ts +0 -42
- package/dist/hive/Types/index.d.ts +0 -18
- package/dist/hive/Types/index.js +0 -25
- package/dist/hive/Types/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetTablesCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/GetTablesCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAkF;
|
|
1
|
+
{"version":3,"file":"GetTablesCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/GetTablesCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAkF;AAKlF,MAAqB,gBAAiB,SAAQ,qBAAmB;IAC/D,OAAO,CAAC,IAAmB;QACzB,MAAM,OAAO,GAAG,IAAI,iCAAa,CAAC,IAAI,CAAC,CAAC;QAExC,OAAO,IAAI,CAAC,cAAc,CAAiB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7E,CAAC;CACF;AAND,mCAMC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import BaseCommand from './BaseCommand';
|
|
2
2
|
import { TGetTypeInfoReq, TGetTypeInfoResp } from '../../../thrift/TCLIService_types';
|
|
3
|
-
|
|
3
|
+
import IThriftClient from '../../contracts/IThriftClient';
|
|
4
|
+
type Client = Pick<IThriftClient, 'GetTypeInfo'>;
|
|
5
|
+
export default class GetTypeInfoCommand extends BaseCommand<Client> {
|
|
4
6
|
execute(data: TGetTypeInfoReq): Promise<TGetTypeInfoResp>;
|
|
5
7
|
}
|
|
8
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetTypeInfoCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/GetTypeInfoCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAsF;
|
|
1
|
+
{"version":3,"file":"GetTypeInfoCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/GetTypeInfoCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAsF;AAKtF,MAAqB,kBAAmB,SAAQ,qBAAmB;IACjE,OAAO,CAAC,IAAqB;QAC3B,MAAM,OAAO,GAAG,IAAI,mCAAe,CAAC,IAAI,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC,cAAc,CAAmB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACjF,CAAC;CACF;AAND,qCAMC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import BaseCommand from './BaseCommand';
|
|
2
2
|
import { TOpenSessionReq, TOpenSessionResp } from '../../../thrift/TCLIService_types';
|
|
3
|
+
import IThriftClient from '../../contracts/IThriftClient';
|
|
4
|
+
type Client = Pick<IThriftClient, 'OpenSession'>;
|
|
3
5
|
/**
|
|
4
6
|
* For auth mechanism GSSAPI the host and service should be provided when session is opened.
|
|
5
7
|
*
|
|
@@ -9,6 +11,7 @@ import { TOpenSessionReq, TOpenSessionResp } from '../../../thrift/TCLIService_t
|
|
|
9
11
|
* [key: string]: any;
|
|
10
12
|
* }
|
|
11
13
|
*/
|
|
12
|
-
export default class OpenSessionCommand extends BaseCommand {
|
|
14
|
+
export default class OpenSessionCommand extends BaseCommand<Client> {
|
|
13
15
|
execute(openSessionRequest: TOpenSessionReq): Promise<TOpenSessionResp>;
|
|
14
16
|
}
|
|
17
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenSessionCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/OpenSessionCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAsF;
|
|
1
|
+
{"version":3,"file":"OpenSessionCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/OpenSessionCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAsF;AAKtF;;;;;;;;GAQG;AACH,MAAqB,kBAAmB,SAAQ,qBAAmB;IACjE,OAAO,CAAC,kBAAmC;QACzC,MAAM,OAAO,GAAG,IAAI,mCAAe,CAAC,kBAAkB,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC,cAAc,CAAmB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACjF,CAAC;CACF;AAND,qCAMC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import BaseCommand from './BaseCommand';
|
|
2
2
|
import { TRenewDelegationTokenReq, TRenewDelegationTokenResp } from '../../../thrift/TCLIService_types';
|
|
3
|
-
|
|
3
|
+
import IThriftClient from '../../contracts/IThriftClient';
|
|
4
|
+
type Client = Pick<IThriftClient, 'RenewDelegationToken'>;
|
|
5
|
+
export default class RenewDelegationTokenCommand extends BaseCommand<Client> {
|
|
4
6
|
execute(data: TRenewDelegationTokenReq): Promise<TRenewDelegationTokenResp>;
|
|
5
7
|
}
|
|
8
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenewDelegationTokenCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/RenewDelegationTokenCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAwG;
|
|
1
|
+
{"version":3,"file":"RenewDelegationTokenCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/RenewDelegationTokenCommand.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,yEAAwG;AAKxG,MAAqB,2BAA4B,SAAQ,qBAAmB;IAC1E,OAAO,CAAC,IAA8B;QACpC,MAAM,OAAO,GAAG,IAAI,4CAAwB,CAAC,IAAI,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC,cAAc,CAA4B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACnG,CAAC;CACF;AAND,8CAMC"}
|
package/dist/hive/HiveDriver.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -37,152 +28,110 @@ class HiveDriver {
|
|
|
37
28
|
constructor(options) {
|
|
38
29
|
this.context = options.context;
|
|
39
30
|
}
|
|
40
|
-
openSession(request) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
getOperationStatus(request) {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const client = yield this.context.getClient();
|
|
148
|
-
const command = new GetOperationStatusCommand_1.default(client, this.context);
|
|
149
|
-
return command.execute(request);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
cancelOperation(request) {
|
|
153
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
const client = yield this.context.getClient();
|
|
155
|
-
const command = new CancelOperationCommand_1.default(client, this.context);
|
|
156
|
-
return command.execute(request);
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
closeOperation(request) {
|
|
160
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
const client = yield this.context.getClient();
|
|
162
|
-
const command = new CloseOperationCommand_1.default(client, this.context);
|
|
163
|
-
return command.execute(request);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
getDelegationToken(request) {
|
|
167
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
const client = yield this.context.getClient();
|
|
169
|
-
const command = new GetDelegationTokenCommand_1.default(client, this.context);
|
|
170
|
-
return command.execute(request);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
cancelDelegationToken(request) {
|
|
174
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
const client = yield this.context.getClient();
|
|
176
|
-
const command = new CancelDelegationTokenCommand_1.default(client, this.context);
|
|
177
|
-
return command.execute(request);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
renewDelegationToken(request) {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
const client = yield this.context.getClient();
|
|
183
|
-
const command = new RenewDelegationTokenCommand_1.default(client, this.context);
|
|
184
|
-
return command.execute(request);
|
|
185
|
-
});
|
|
31
|
+
async openSession(request) {
|
|
32
|
+
const client = await this.context.getClient();
|
|
33
|
+
const action = new OpenSessionCommand_1.default(client, this.context);
|
|
34
|
+
return action.execute(request);
|
|
35
|
+
}
|
|
36
|
+
async closeSession(request) {
|
|
37
|
+
const client = await this.context.getClient();
|
|
38
|
+
const command = new CloseSessionCommand_1.default(client, this.context);
|
|
39
|
+
return command.execute(request);
|
|
40
|
+
}
|
|
41
|
+
async executeStatement(request) {
|
|
42
|
+
const client = await this.context.getClient();
|
|
43
|
+
const command = new ExecuteStatementCommand_1.default(client, this.context);
|
|
44
|
+
return command.execute(request);
|
|
45
|
+
}
|
|
46
|
+
async getResultSetMetadata(request) {
|
|
47
|
+
const client = await this.context.getClient();
|
|
48
|
+
const command = new GetResultSetMetadataCommand_1.default(client, this.context);
|
|
49
|
+
return command.execute(request);
|
|
50
|
+
}
|
|
51
|
+
async fetchResults(request) {
|
|
52
|
+
const client = await this.context.getClient();
|
|
53
|
+
const command = new FetchResultsCommand_1.default(client, this.context);
|
|
54
|
+
return command.execute(request);
|
|
55
|
+
}
|
|
56
|
+
async getInfo(request) {
|
|
57
|
+
const client = await this.context.getClient();
|
|
58
|
+
const command = new GetInfoCommand_1.default(client, this.context);
|
|
59
|
+
return command.execute(request);
|
|
60
|
+
}
|
|
61
|
+
async getTypeInfo(request) {
|
|
62
|
+
const client = await this.context.getClient();
|
|
63
|
+
const command = new GetTypeInfoCommand_1.default(client, this.context);
|
|
64
|
+
return command.execute(request);
|
|
65
|
+
}
|
|
66
|
+
async getCatalogs(request) {
|
|
67
|
+
const client = await this.context.getClient();
|
|
68
|
+
const command = new GetCatalogsCommand_1.default(client, this.context);
|
|
69
|
+
return command.execute(request);
|
|
70
|
+
}
|
|
71
|
+
async getSchemas(request) {
|
|
72
|
+
const client = await this.context.getClient();
|
|
73
|
+
const command = new GetSchemasCommand_1.default(client, this.context);
|
|
74
|
+
return command.execute(request);
|
|
75
|
+
}
|
|
76
|
+
async getTables(request) {
|
|
77
|
+
const client = await this.context.getClient();
|
|
78
|
+
const command = new GetTablesCommand_1.default(client, this.context);
|
|
79
|
+
return command.execute(request);
|
|
80
|
+
}
|
|
81
|
+
async getTableTypes(request) {
|
|
82
|
+
const client = await this.context.getClient();
|
|
83
|
+
const command = new GetTableTypesCommand_1.default(client, this.context);
|
|
84
|
+
return command.execute(request);
|
|
85
|
+
}
|
|
86
|
+
async getColumns(request) {
|
|
87
|
+
const client = await this.context.getClient();
|
|
88
|
+
const command = new GetColumnsCommand_1.default(client, this.context);
|
|
89
|
+
return command.execute(request);
|
|
90
|
+
}
|
|
91
|
+
async getFunctions(request) {
|
|
92
|
+
const client = await this.context.getClient();
|
|
93
|
+
const command = new GetFunctionsCommand_1.default(client, this.context);
|
|
94
|
+
return command.execute(request);
|
|
95
|
+
}
|
|
96
|
+
async getPrimaryKeys(request) {
|
|
97
|
+
const client = await this.context.getClient();
|
|
98
|
+
const command = new GetPrimaryKeysCommand_1.default(client, this.context);
|
|
99
|
+
return command.execute(request);
|
|
100
|
+
}
|
|
101
|
+
async getCrossReference(request) {
|
|
102
|
+
const client = await this.context.getClient();
|
|
103
|
+
const command = new GetCrossReferenceCommand_1.default(client, this.context);
|
|
104
|
+
return command.execute(request);
|
|
105
|
+
}
|
|
106
|
+
async getOperationStatus(request) {
|
|
107
|
+
const client = await this.context.getClient();
|
|
108
|
+
const command = new GetOperationStatusCommand_1.default(client, this.context);
|
|
109
|
+
return command.execute(request);
|
|
110
|
+
}
|
|
111
|
+
async cancelOperation(request) {
|
|
112
|
+
const client = await this.context.getClient();
|
|
113
|
+
const command = new CancelOperationCommand_1.default(client, this.context);
|
|
114
|
+
return command.execute(request);
|
|
115
|
+
}
|
|
116
|
+
async closeOperation(request) {
|
|
117
|
+
const client = await this.context.getClient();
|
|
118
|
+
const command = new CloseOperationCommand_1.default(client, this.context);
|
|
119
|
+
return command.execute(request);
|
|
120
|
+
}
|
|
121
|
+
async getDelegationToken(request) {
|
|
122
|
+
const client = await this.context.getClient();
|
|
123
|
+
const command = new GetDelegationTokenCommand_1.default(client, this.context);
|
|
124
|
+
return command.execute(request);
|
|
125
|
+
}
|
|
126
|
+
async cancelDelegationToken(request) {
|
|
127
|
+
const client = await this.context.getClient();
|
|
128
|
+
const command = new CancelDelegationTokenCommand_1.default(client, this.context);
|
|
129
|
+
return command.execute(request);
|
|
130
|
+
}
|
|
131
|
+
async renewDelegationToken(request) {
|
|
132
|
+
const client = await this.context.getClient();
|
|
133
|
+
const command = new RenewDelegationTokenCommand_1.default(client, this.context);
|
|
134
|
+
return command.execute(request);
|
|
186
135
|
}
|
|
187
136
|
}
|
|
188
137
|
exports.default = HiveDriver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HiveDriver.js","sourceRoot":"","sources":["../../lib/hive/HiveDriver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HiveDriver.js","sourceRoot":"","sources":["../../lib/hive/HiveDriver.ts"],"names":[],"mappings":";;;;;AAuBA,uFAA+D;AAC/D,yFAAiE;AACjE,iGAAyE;AACzE,yGAAiF;AACjF,yFAAiE;AACjE,+EAAuD;AACvD,uFAA+D;AAC/D,uFAA+D;AAC/D,qFAA6D;AAC7D,mFAA2D;AAC3D,2FAAmE;AACnE,qFAA6D;AAC7D,yFAAiE;AACjE,6FAAqE;AACrE,mGAA2E;AAC3E,qGAA6E;AAC7E,+FAAuE;AACvE,6FAAqE;AACrE,qGAA6E;AAC7E,2GAAmF;AACnF,yGAAiF;AAQjF,MAAqB,UAAU;IAG7B,YAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAwB;QACxC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAA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AAqB,CAAC,OAAkC;QAC5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,sCAA4B,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACvE,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,OAAiC;QAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,qCAA2B,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACF;AApID,6BAoIC"}
|
package/dist/polyfills.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function at<T>(this:
|
|
1
|
+
export declare function at<T>(this: ArrayLike<T>, index: unknown): T | undefined;
|
package/dist/polyfills.js
CHANGED
|
@@ -42,7 +42,8 @@ const ArrayConstructors = [
|
|
|
42
42
|
global.BigUint64Array,
|
|
43
43
|
];
|
|
44
44
|
ArrayConstructors.forEach((ArrayConstructor) => {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
if (typeof ArrayConstructor.prototype.at !== 'function') {
|
|
46
|
+
ArrayConstructor.prototype.at = at;
|
|
47
|
+
}
|
|
47
48
|
});
|
|
48
49
|
//# sourceMappingURL=polyfills.js.map
|
package/dist/polyfills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../lib/polyfills.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;AAEjD,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AAEvE,qFAAqF;AACrF,SAAS,mBAAmB,CAAC,KAAc;IACzC,MAAM,MAAM,GAAG,MAAM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GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,oFAAoF;AACpF,SAAgB,EAAE,CAAwB,KAAc;IACtD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,GAAG,aAAa,CAAC;IAClF,OAAO,aAAa,IAAI,CAAC,IAAI,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC;AALD,gBAKC;AAED,MAAM,iBAAiB,GAAG;IACxB,MAAM,CAAC,KAAK;IACZ,MAAM,CAAC,SAAS;IAChB,MAAM,CAAC,UAAU;IACjB,MAAM,CAAC,iBAAiB;IACxB,MAAM,CAAC,UAAU;IACjB,MAAM,CAAC,WAAW;IAClB,MAAM,CAAC,UAAU;IACjB,MAAM,CAAC,WAAW;IAClB,MAAM,CAAC,YAAY;IACnB,MAAM,CAAC,YAAY;IACnB,MAAM,CAAC,aAAa;IACpB,MAAM,CAAC,cAAc;CACtB,CAAC;AAEF,iBAAiB,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE;IAC7C,IAAI,OAAO,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,UAAU,EAAE;QACvD,gBAAgB,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;KACpC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import IClientContext from '../contracts/IClientContext';
|
|
|
3
3
|
import IResultsProvider, { ResultsProviderFetchNextOptions } from './IResultsProvider';
|
|
4
4
|
import { ArrowBatch } from './utils';
|
|
5
5
|
export default class ArrowResultConverter implements IResultsProvider<Array<any>> {
|
|
6
|
-
|
|
6
|
+
private readonly context;
|
|
7
7
|
private readonly source;
|
|
8
8
|
private readonly schema;
|
|
9
9
|
private recordBatchReader?;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const buffer_1 = require("buffer");
|
|
13
4
|
const apache_arrow_1 = require("apache-arrow");
|
|
@@ -21,92 +12,86 @@ class ArrowResultConverter {
|
|
|
21
12
|
this.source = source;
|
|
22
13
|
this.schema = (0, utils_1.getSchemaColumns)(schema);
|
|
23
14
|
}
|
|
24
|
-
hasMore() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return this.source.hasMore();
|
|
33
|
-
});
|
|
15
|
+
async hasMore() {
|
|
16
|
+
if (this.schema.length === 0) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (this.prefetchedRecordBatch) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return this.source.hasMore();
|
|
34
23
|
}
|
|
35
|
-
fetchNext(options) {
|
|
36
|
-
|
|
37
|
-
if (this.schema.length === 0) {
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
// It's not possible to know if iterator has more items until trying to get the next item.
|
|
41
|
-
// So each time we read one batch ahead and store it, but process the batch prefetched on
|
|
42
|
-
// a previous `fetchNext` call. Because we actually already have the next item - it's easy
|
|
43
|
-
// to tell if the subsequent `fetchNext` will be able to read anything, and `hasMore` logic
|
|
44
|
-
// becomes trivial
|
|
45
|
-
// This prefetch handles a first call to `fetchNext`, when all the internal fields are not initialized yet.
|
|
46
|
-
// On subsequent calls to `fetchNext` it will do nothing
|
|
47
|
-
yield this.prefetch(options);
|
|
48
|
-
if (this.prefetchedRecordBatch) {
|
|
49
|
-
// Consume a record batch fetched during previous call to `fetchNext`
|
|
50
|
-
const table = new apache_arrow_1.Table(this.prefetchedRecordBatch);
|
|
51
|
-
this.prefetchedRecordBatch = undefined;
|
|
52
|
-
// Get table rows, but not more than remaining count
|
|
53
|
-
const arrowRows = table.toArray().slice(0, this.remainingRows);
|
|
54
|
-
const result = this.getRows(table.schema, arrowRows);
|
|
55
|
-
// Reduce remaining rows count by a count of rows we just processed.
|
|
56
|
-
// If the remaining count reached zero - we're done with current arrow
|
|
57
|
-
// batch, so discard the batch reader
|
|
58
|
-
this.remainingRows -= result.length;
|
|
59
|
-
if (this.remainingRows === 0) {
|
|
60
|
-
this.recordBatchReader = undefined;
|
|
61
|
-
}
|
|
62
|
-
// Prefetch the next record batch
|
|
63
|
-
yield this.prefetch(options);
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
24
|
+
async fetchNext(options) {
|
|
25
|
+
if (this.schema.length === 0) {
|
|
66
26
|
return [];
|
|
67
|
-
}
|
|
27
|
+
}
|
|
28
|
+
// It's not possible to know if iterator has more items until trying to get the next item.
|
|
29
|
+
// So each time we read one batch ahead and store it, but process the batch prefetched on
|
|
30
|
+
// a previous `fetchNext` call. Because we actually already have the next item - it's easy
|
|
31
|
+
// to tell if the subsequent `fetchNext` will be able to read anything, and `hasMore` logic
|
|
32
|
+
// becomes trivial
|
|
33
|
+
// This prefetch handles a first call to `fetchNext`, when all the internal fields are not initialized yet.
|
|
34
|
+
// On subsequent calls to `fetchNext` it will do nothing
|
|
35
|
+
await this.prefetch(options);
|
|
36
|
+
if (this.prefetchedRecordBatch) {
|
|
37
|
+
// Consume a record batch fetched during previous call to `fetchNext`
|
|
38
|
+
const table = new apache_arrow_1.Table(this.prefetchedRecordBatch);
|
|
39
|
+
this.prefetchedRecordBatch = undefined;
|
|
40
|
+
// Get table rows, but not more than remaining count
|
|
41
|
+
const arrowRows = table.toArray().slice(0, this.remainingRows);
|
|
42
|
+
const result = this.getRows(table.schema, arrowRows);
|
|
43
|
+
// Reduce remaining rows count by a count of rows we just processed.
|
|
44
|
+
// If the remaining count reached zero - we're done with current arrow
|
|
45
|
+
// batch, so discard the batch reader
|
|
46
|
+
this.remainingRows -= result.length;
|
|
47
|
+
if (this.remainingRows === 0) {
|
|
48
|
+
this.recordBatchReader = undefined;
|
|
49
|
+
}
|
|
50
|
+
// Prefetch the next record batch
|
|
51
|
+
await this.prefetch(options);
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
return [];
|
|
68
55
|
}
|
|
69
56
|
// This method tries to read one more record batch and store it in `prefetchedRecordBatch` field.
|
|
70
57
|
// If `prefetchedRecordBatch` is already non-empty - the method does nothing.
|
|
71
58
|
// This method pulls the next item from source if needed, initializes a record batch reader and
|
|
72
59
|
// gets the next item from it - until either reaches end of data or finds a non-empty record batch
|
|
73
|
-
prefetch(options) {
|
|
60
|
+
async prefetch(options) {
|
|
74
61
|
var _a, _b;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const arrowBatch = yield this.source.fetchNext(options); // eslint-disable-line no-await-in-loop
|
|
87
|
-
if (arrowBatch.batches.length > 0 && arrowBatch.rowCount > 0) {
|
|
88
|
-
const reader = apache_arrow_1.RecordBatchReader.from(arrowBatch.batches);
|
|
89
|
-
this.recordBatchReader = reader[Symbol.iterator]();
|
|
90
|
-
this.remainingRows = arrowBatch.rowCount;
|
|
91
|
-
}
|
|
62
|
+
// This loop will be executed until a next non-empty record batch is retrieved
|
|
63
|
+
// Another implicit loop condition (end of data) is checked in the loop body
|
|
64
|
+
while (!this.prefetchedRecordBatch) {
|
|
65
|
+
// First, try to fetch next item from source and initialize record batch reader.
|
|
66
|
+
// If source has no more data - exit prematurely
|
|
67
|
+
if (!this.recordBatchReader) {
|
|
68
|
+
const sourceHasMore = await this.source.hasMore(); // eslint-disable-line no-await-in-loop
|
|
69
|
+
if (!sourceHasMore) {
|
|
70
|
+
return;
|
|
92
71
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (item.done || item.value === undefined) {
|
|
99
|
-
this.recordBatchReader = undefined;
|
|
72
|
+
const arrowBatch = await this.source.fetchNext(options); // eslint-disable-line no-await-in-loop
|
|
73
|
+
if (arrowBatch.batches.length > 0 && arrowBatch.rowCount > 0) {
|
|
74
|
+
const reader = apache_arrow_1.RecordBatchReader.from(arrowBatch.batches);
|
|
75
|
+
this.recordBatchReader = reader[Symbol.iterator]();
|
|
76
|
+
this.remainingRows = arrowBatch.rowCount;
|
|
100
77
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
78
|
+
}
|
|
79
|
+
// Try to get a next item from current record batch reader. The reader may be unavailable at this point -
|
|
80
|
+
// in this case we fall back to a "done" state, and the `while` loop will do one more iteration attempting
|
|
81
|
+
// to create a new reader. Eventually it will either succeed or reach end of source. This scenario also
|
|
82
|
+
// handles readers which are already empty
|
|
83
|
+
const item = (_b = (_a = this.recordBatchReader) === null || _a === void 0 ? void 0 : _a.next()) !== null && _b !== void 0 ? _b : { done: true, value: undefined };
|
|
84
|
+
if (item.done || item.value === undefined) {
|
|
85
|
+
this.recordBatchReader = undefined;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// Skip empty batches
|
|
89
|
+
// eslint-disable-next-line no-lonely-if
|
|
90
|
+
if (item.value.numRows > 0) {
|
|
91
|
+
this.prefetchedRecordBatch = item.value;
|
|
107
92
|
}
|
|
108
93
|
}
|
|
109
|
-
}
|
|
94
|
+
}
|
|
110
95
|
}
|
|
111
96
|
getRows(schema, rows) {
|
|
112
97
|
return rows.map((row) => {
|
|
@@ -158,7 +143,7 @@ class ArrowResultConverter {
|
|
|
158
143
|
if (value instanceof Object && value[isArrowBigNumSymbol]) {
|
|
159
144
|
const result = bigNumToBigInt(value);
|
|
160
145
|
if (apache_arrow_1.DataType.isDecimal(valueType)) {
|
|
161
|
-
return Number(result) /
|
|
146
|
+
return Number(result) / 10 ** valueType.scale;
|
|
162
147
|
}
|
|
163
148
|
return result;
|
|
164
149
|
}
|