@databricks/sql 1.2.1 → 1.4.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/dist/DBSQLClient.d.ts +8 -6
- package/dist/DBSQLClient.js +98 -59
- package/dist/DBSQLClient.js.map +1 -1
- package/dist/DBSQLOperation/OperationStatusHelper.d.ts +1 -1
- package/dist/DBSQLOperation/OperationStatusHelper.js +29 -6
- package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -1
- package/dist/DBSQLOperation/SchemaHelper.d.ts +1 -0
- package/dist/DBSQLOperation/SchemaHelper.js +20 -7
- package/dist/DBSQLOperation/SchemaHelper.js.map +1 -1
- package/dist/DBSQLOperation/index.d.ts +9 -2
- package/dist/DBSQLOperation/index.js +86 -10
- package/dist/DBSQLOperation/index.js.map +1 -1
- package/dist/DBSQLSession.d.ts +10 -1
- package/dist/DBSQLSession.js +72 -14
- package/dist/DBSQLSession.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.d.ts +24 -0
- package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js +165 -0
- package/dist/connection/auth/DatabricksOAuth/AuthorizationCode.js.map +1 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.d.ts +47 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.js +169 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.js.map +1 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.d.ts +10 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.js +29 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthPersistence.js.map +1 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthScope.d.ts +7 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthScope.js +11 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthScope.js.map +1 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthToken.d.ts +10 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthToken.js +32 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthToken.js.map +1 -0
- package/dist/connection/auth/DatabricksOAuth/index.d.ts +21 -0
- package/dist/connection/auth/DatabricksOAuth/index.js +41 -0
- package/dist/connection/auth/DatabricksOAuth/index.js.map +1 -0
- package/dist/connection/auth/PlainHttpAuthentication.d.ts +11 -11
- package/dist/connection/auth/PlainHttpAuthentication.js +15 -7
- package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
- package/dist/connection/connections/HttpConnection.d.ts +1 -2
- package/dist/connection/connections/HttpConnection.js +24 -14
- package/dist/connection/connections/HttpConnection.js.map +1 -1
- package/dist/connection/contracts/IAuthentication.d.ts +2 -2
- package/dist/connection/contracts/IConnectionOptions.d.ts +3 -1
- package/dist/connection/contracts/IConnectionProvider.d.ts +1 -2
- package/dist/contracts/IDBSQLClient.d.ts +17 -3
- package/dist/contracts/IDBSQLSession.d.ts +1 -0
- package/dist/errors/OperationStateError.d.ts +10 -2
- package/dist/errors/OperationStateError.js +19 -2
- package/dist/errors/OperationStateError.js.map +1 -1
- package/dist/globalConfig.d.ts +7 -0
- package/dist/globalConfig.js +7 -0
- package/dist/globalConfig.js.map +1 -1
- package/dist/hive/Commands/BaseCommand.d.ts +3 -1
- package/dist/hive/Commands/BaseCommand.js +66 -4
- package/dist/hive/Commands/BaseCommand.js.map +1 -1
- package/dist/hive/HiveDriver.d.ts +3 -2
- package/dist/hive/HiveDriver.js +116 -44
- package/dist/hive/HiveDriver.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js +8 -0
- package/dist/result/ArrowResult.d.ts +3 -2
- package/dist/result/ArrowResult.js +38 -17
- package/dist/result/ArrowResult.js.map +1 -1
- package/dist/result/CloudFetchResult.d.ts +13 -0
- package/dist/result/CloudFetchResult.js +69 -0
- package/dist/result/CloudFetchResult.js.map +1 -0
- package/dist/result/IOperationResult.d.ts +2 -1
- package/dist/result/JsonResult.d.ts +2 -1
- package/dist/result/JsonResult.js +24 -8
- package/dist/result/JsonResult.js.map +1 -1
- package/dist/utils/CloseableCollection.d.ts +10 -0
- package/dist/utils/CloseableCollection.js +40 -0
- package/dist/utils/CloseableCollection.js.map +1 -0
- package/dist/utils/areHeadersEqual.d.ts +2 -0
- package/dist/utils/areHeadersEqual.js +49 -0
- package/dist/utils/areHeadersEqual.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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -2
- package/thrift/TCLIService.d.ts +60 -0
- package/thrift/TCLIService_types.d.ts +206 -14
- package/thrift/TCLIService_types.js +2334 -291
- package/dist/connection/auth/NoSaslAuthentication.d.ts +0 -5
- package/dist/connection/auth/NoSaslAuthentication.js +0 -14
- package/dist/connection/auth/NoSaslAuthentication.js.map +0 -1
- package/dist/connection/auth/helpers/SaslPackageFactory.d.ts +0 -11
- package/dist/connection/auth/helpers/SaslPackageFactory.js +0 -20
- package/dist/connection/auth/helpers/SaslPackageFactory.js.map +0 -1
- package/dist/connection/contracts/ITransport.d.ts +0 -6
- package/dist/connection/contracts/ITransport.js +0 -3
- package/dist/connection/contracts/ITransport.js.map +0 -1
- package/dist/connection/transports/HttpTransport.d.ts +0 -8
- package/dist/connection/transports/HttpTransport.js +0 -18
- package/dist/connection/transports/HttpTransport.js.map +0 -1
- package/dist/connection/types/AuthOptions.d.ts +0 -4
- package/dist/connection/types/AuthOptions.js +0 -3
- package/dist/connection/types/AuthOptions.js.map +0 -1
package/dist/DBSQLClient.d.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import
|
|
4
|
-
import IDBSQLClient, { ConnectionOptions, OpenSessionRequest, ClientOptions } from './contracts/IDBSQLClient';
|
|
3
|
+
import IDBSQLClient, { ClientOptions, ConnectionOptions, OpenSessionRequest } from './contracts/IDBSQLClient';
|
|
5
4
|
import IDBSQLSession from './contracts/IDBSQLSession';
|
|
6
5
|
import IAuthentication from './connection/contracts/IAuthentication';
|
|
7
6
|
export default class DBSQLClient extends EventEmitter implements IDBSQLClient {
|
|
8
7
|
private client;
|
|
9
|
-
private connection;
|
|
10
|
-
private connectionProvider;
|
|
11
8
|
private authProvider;
|
|
9
|
+
private connectionOptions;
|
|
10
|
+
private additionalHeaders;
|
|
12
11
|
private readonly logger;
|
|
13
12
|
private readonly thrift;
|
|
13
|
+
private sessions;
|
|
14
14
|
constructor(options?: ClientOptions);
|
|
15
15
|
private getConnectionOptions;
|
|
16
|
+
private getAuthProvider;
|
|
16
17
|
/**
|
|
17
18
|
* Connects DBSQLClient to endpoint
|
|
18
19
|
* @public
|
|
19
20
|
* @param options - host, path, and token are required
|
|
20
|
-
* @param authProvider - Optional custom authentication provider
|
|
21
|
+
* @param authProvider - [DEPRECATED - use `authType: 'custom'] Optional custom authentication provider
|
|
21
22
|
* @returns Session object that can be used to execute statements
|
|
22
23
|
* @example
|
|
23
24
|
* const session = client.connect({host, path, token});
|
|
@@ -33,6 +34,7 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient {
|
|
|
33
34
|
* const session = await client.openSession();
|
|
34
35
|
*/
|
|
35
36
|
openSession(request?: OpenSessionRequest): Promise<IDBSQLSession>;
|
|
36
|
-
getClient
|
|
37
|
+
private getClient;
|
|
38
|
+
private createConnection;
|
|
37
39
|
close(): Promise<void>;
|
|
38
40
|
}
|
package/dist/DBSQLClient.js
CHANGED
|
@@ -30,14 +30,15 @@ const TCLIService_types_1 = require("../thrift/TCLIService_types");
|
|
|
30
30
|
const HiveDriver_1 = __importDefault(require("./hive/HiveDriver"));
|
|
31
31
|
const Types_1 = require("./hive/Types");
|
|
32
32
|
const DBSQLSession_1 = __importDefault(require("./DBSQLSession"));
|
|
33
|
-
const NoSaslAuthentication_1 = __importDefault(require("./connection/auth/NoSaslAuthentication"));
|
|
34
33
|
const HttpConnection_1 = __importDefault(require("./connection/connections/HttpConnection"));
|
|
35
34
|
const Status_1 = __importDefault(require("./dto/Status"));
|
|
36
35
|
const HiveDriverError_1 = __importDefault(require("./errors/HiveDriverError"));
|
|
37
36
|
const utils_1 = require("./utils");
|
|
38
37
|
const PlainHttpAuthentication_1 = __importDefault(require("./connection/auth/PlainHttpAuthentication"));
|
|
38
|
+
const DatabricksOAuth_1 = __importDefault(require("./connection/auth/DatabricksOAuth"));
|
|
39
39
|
const IDBSQLLogger_1 = require("./contracts/IDBSQLLogger");
|
|
40
40
|
const DBSQLLogger_1 = __importDefault(require("./DBSQLLogger"));
|
|
41
|
+
const CloseableCollection_1 = __importDefault(require("./utils/CloseableCollection"));
|
|
41
42
|
function prependSlash(str) {
|
|
42
43
|
if (str.length > 0 && str.charAt(0) !== '/') {
|
|
43
44
|
return `/${str}`;
|
|
@@ -58,45 +59,113 @@ function getInitialNamespaceOptions(catalogName, schemaName) {
|
|
|
58
59
|
class DBSQLClient extends events_1.EventEmitter {
|
|
59
60
|
constructor(options) {
|
|
60
61
|
super();
|
|
62
|
+
this.client = null;
|
|
63
|
+
this.authProvider = null;
|
|
64
|
+
this.connectionOptions = null;
|
|
65
|
+
this.additionalHeaders = {};
|
|
61
66
|
this.thrift = thrift_1.default;
|
|
62
|
-
this.
|
|
63
|
-
this.authProvider = new NoSaslAuthentication_1.default();
|
|
67
|
+
this.sessions = new CloseableCollection_1.default();
|
|
64
68
|
this.logger = (options === null || options === void 0 ? void 0 : options.logger) || new DBSQLLogger_1.default();
|
|
65
|
-
this.client = null;
|
|
66
|
-
this.connection = null;
|
|
67
69
|
this.logger.log(IDBSQLLogger_1.LogLevel.info, 'Created DBSQLClient');
|
|
68
70
|
}
|
|
69
|
-
getConnectionOptions(options) {
|
|
70
|
-
const { host, port, path,
|
|
71
|
+
getConnectionOptions(options, headers) {
|
|
72
|
+
const { host, port, path, clientId, authType,
|
|
73
|
+
// @ts-expect-error TS2339: Property 'token' does not exist on type 'ConnectionOptions'
|
|
74
|
+
token,
|
|
75
|
+
// @ts-expect-error TS2339: Property 'persistence' does not exist on type 'ConnectionOptions'
|
|
76
|
+
persistence,
|
|
77
|
+
// @ts-expect-error TS2339: Property 'provider' does not exist on type 'ConnectionOptions'
|
|
78
|
+
provider } = options, otherOptions = __rest(options, ["host", "port", "path", "clientId", "authType", "token", "persistence", "provider"]);
|
|
71
79
|
return {
|
|
72
80
|
host,
|
|
73
81
|
port: port || 443,
|
|
74
|
-
options: Object.assign({ path: prependSlash(path), https: true }, otherOptions),
|
|
82
|
+
options: Object.assign(Object.assign({ path: prependSlash(path), https: true }, otherOptions), { headers: Object.assign(Object.assign({}, headers), { 'User-Agent': (0, utils_1.buildUserAgentString)(options.clientId) }) }),
|
|
75
83
|
};
|
|
76
84
|
}
|
|
85
|
+
getAuthProvider(options, authProvider) {
|
|
86
|
+
if (authProvider) {
|
|
87
|
+
return authProvider;
|
|
88
|
+
}
|
|
89
|
+
switch (options.authType) {
|
|
90
|
+
case undefined:
|
|
91
|
+
case 'access-token':
|
|
92
|
+
return new PlainHttpAuthentication_1.default({
|
|
93
|
+
username: 'token',
|
|
94
|
+
password: options.token,
|
|
95
|
+
});
|
|
96
|
+
case 'databricks-oauth':
|
|
97
|
+
return new DatabricksOAuth_1.default({
|
|
98
|
+
host: options.host,
|
|
99
|
+
logger: this.logger,
|
|
100
|
+
persistence: options.persistence,
|
|
101
|
+
azureTenantId: options.azureTenantId,
|
|
102
|
+
});
|
|
103
|
+
case 'custom':
|
|
104
|
+
return options.provider;
|
|
105
|
+
// no default
|
|
106
|
+
}
|
|
107
|
+
}
|
|
77
108
|
/**
|
|
78
109
|
* Connects DBSQLClient to endpoint
|
|
79
110
|
* @public
|
|
80
111
|
* @param options - host, path, and token are required
|
|
81
|
-
* @param authProvider - Optional custom authentication provider
|
|
112
|
+
* @param authProvider - [DEPRECATED - use `authType: 'custom'] Optional custom authentication provider
|
|
82
113
|
* @returns Session object that can be used to execute statements
|
|
83
114
|
* @example
|
|
84
115
|
* const session = client.connect({host, path, token});
|
|
85
116
|
*/
|
|
86
117
|
connect(options, authProvider) {
|
|
87
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
this.authProvider =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
119
|
+
this.authProvider = this.getAuthProvider(options, authProvider);
|
|
120
|
+
this.connectionOptions = options;
|
|
121
|
+
return this;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Starts new session
|
|
126
|
+
* @public
|
|
127
|
+
* @param request - Can be instantiated with initialSchema, empty by default
|
|
128
|
+
* @returns Session object that can be used to execute statements
|
|
129
|
+
* @throws {StatusError}
|
|
130
|
+
* @example
|
|
131
|
+
* const session = await client.openSession();
|
|
132
|
+
*/
|
|
133
|
+
openSession(request = {}) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
const driver = new HiveDriver_1.default(() => this.getClient());
|
|
136
|
+
const response = yield driver.openSession(Object.assign({ client_protocol_i64: new Types_1.Int64(TCLIService_types_1.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V6) }, getInitialNamespaceOptions(request.initialCatalog, request.initialSchema)));
|
|
137
|
+
Status_1.default.assert(response.status);
|
|
138
|
+
const session = new DBSQLSession_1.default(driver, (0, utils_1.definedOrError)(response.sessionHandle), {
|
|
139
|
+
logger: this.logger,
|
|
140
|
+
});
|
|
141
|
+
this.sessions.add(session);
|
|
142
|
+
return session;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
getClient() {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
if (!this.connectionOptions || !this.authProvider) {
|
|
148
|
+
throw new HiveDriverError_1.default('DBSQLClient: not connected');
|
|
149
|
+
}
|
|
150
|
+
const authHeaders = yield this.authProvider.authenticate();
|
|
151
|
+
// When auth headers change - recreate client. Thrift library does not provide API for updating
|
|
152
|
+
// changed options, therefore we have to recreate both connection and client to apply new headers
|
|
153
|
+
if (!this.client || !(0, utils_1.areHeadersEqual)(this.additionalHeaders, authHeaders)) {
|
|
154
|
+
this.logger.log(IDBSQLLogger_1.LogLevel.info, 'DBSQLClient: initializing thrift client');
|
|
155
|
+
this.additionalHeaders = authHeaders;
|
|
156
|
+
const connectionOptions = this.getConnectionOptions(this.connectionOptions, this.additionalHeaders);
|
|
157
|
+
const connection = yield this.createConnection(connectionOptions);
|
|
158
|
+
this.client = this.thrift.createClient(TCLIService_1.default, connection.getConnection());
|
|
159
|
+
}
|
|
160
|
+
return this.client;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
createConnection(options) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
const connectionProvider = new HttpConnection_1.default();
|
|
166
|
+
const connection = yield connectionProvider.connect(options);
|
|
167
|
+
const thriftConnection = connection.getConnection();
|
|
168
|
+
thriftConnection.on('error', (error) => {
|
|
100
169
|
// Error.stack already contains error type and message, so log stack if available,
|
|
101
170
|
// otherwise fall back to just error type + message
|
|
102
171
|
this.logger.log(IDBSQLLogger_1.LogLevel.error, error.stack || `${error.name}: ${error.message}`);
|
|
@@ -108,57 +177,27 @@ class DBSQLClient extends events_1.EventEmitter {
|
|
|
108
177
|
// Since we already logged it few lines above, just suppress this behaviour
|
|
109
178
|
}
|
|
110
179
|
});
|
|
111
|
-
|
|
180
|
+
thriftConnection.on('reconnecting', (params) => {
|
|
112
181
|
this.logger.log(IDBSQLLogger_1.LogLevel.debug, `Reconnecting, params: ${JSON.stringify(params)}`);
|
|
113
182
|
this.emit('reconnecting', params);
|
|
114
183
|
});
|
|
115
|
-
|
|
184
|
+
thriftConnection.on('close', () => {
|
|
116
185
|
this.logger.log(IDBSQLLogger_1.LogLevel.debug, 'Closing connection.');
|
|
117
186
|
this.emit('close');
|
|
118
187
|
});
|
|
119
|
-
|
|
188
|
+
thriftConnection.on('timeout', () => {
|
|
120
189
|
this.logger.log(IDBSQLLogger_1.LogLevel.debug, 'Connection timed out.');
|
|
121
190
|
this.emit('timeout');
|
|
122
191
|
});
|
|
123
|
-
return
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Starts new session
|
|
128
|
-
* @public
|
|
129
|
-
* @param request - Can be instantiated with initialSchema, empty by default
|
|
130
|
-
* @returns Session object that can be used to execute statements
|
|
131
|
-
* @throws {StatusError}
|
|
132
|
-
* @example
|
|
133
|
-
* const session = await client.openSession();
|
|
134
|
-
*/
|
|
135
|
-
openSession(request = {}) {
|
|
136
|
-
var _a;
|
|
137
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
if (!((_a = this.connection) === null || _a === void 0 ? void 0 : _a.isConnected())) {
|
|
139
|
-
throw new HiveDriverError_1.default('DBSQLClient: connection is lost');
|
|
140
|
-
}
|
|
141
|
-
const driver = new HiveDriver_1.default(this.getClient());
|
|
142
|
-
const response = yield driver.openSession(Object.assign({ client_protocol_i64: new Types_1.Int64(TCLIService_types_1.TProtocolVersion.SPARK_CLI_SERVICE_PROTOCOL_V6) }, getInitialNamespaceOptions(request.initialCatalog, request.initialSchema)));
|
|
143
|
-
Status_1.default.assert(response.status);
|
|
144
|
-
return new DBSQLSession_1.default(driver, (0, utils_1.definedOrError)(response.sessionHandle), this.logger);
|
|
192
|
+
return connection;
|
|
145
193
|
});
|
|
146
194
|
}
|
|
147
|
-
getClient() {
|
|
148
|
-
if (!this.client) {
|
|
149
|
-
throw new HiveDriverError_1.default('DBSQLClient: client is not initialized');
|
|
150
|
-
}
|
|
151
|
-
return this.client;
|
|
152
|
-
}
|
|
153
195
|
close() {
|
|
154
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
this.connection = null;
|
|
161
|
-
}
|
|
197
|
+
yield this.sessions.closeAll();
|
|
198
|
+
this.client = null;
|
|
199
|
+
this.authProvider = null;
|
|
200
|
+
this.connectionOptions = null;
|
|
162
201
|
});
|
|
163
202
|
}
|
|
164
203
|
}
|
package/dist/DBSQLClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DBSQLClient.js","sourceRoot":"","sources":["../lib/DBSQLClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"DBSQLClient.js","sourceRoot":"","sources":["../lib/DBSQLClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA6C;AAE7C,mCAAsC;AACtC,wEAAgD;AAChD,mEAA+D;AAE/D,mEAA2C;AAC3C,wCAAqC;AACrC,kEAA0C;AAG1C,6FAAqE;AAErE,0DAAkC;AAClC,+EAAuD;AACvD,mCAAgF;AAChF,wGAAgF;AAChF,wFAAgE;AAChE,2DAAkE;AAClE,gEAAwC;AACxC,sFAA8D;AAE9D,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAC3C,OAAO,IAAI,GAAG,EAAE,CAAC;KAClB;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,0BAA0B,CAAC,WAAoB,EAAE,UAAmB;IAC3E,IAAI,CAAC,WAAW,IAAI,CAAC,UAAU,EAAE;QAC/B,OAAO,EAAE,CAAC;KACX;IAED,OAAO;QACL,gBAAgB,EAAE;YAChB,WAAW;YACX,UAAU;SACX;KACF,CAAC;AACJ,CAAC;AAED,MAAqB,WAAY,SAAQ,qBAAY;IAenD,YAAY,OAAuB;QACjC,KAAK,EAAE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,CAAC;QAChC,CAAC;KAAA;CACF;AAnLD,8BAmLC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TGetOperationStatusResp, TOperationHandle } from '../../thrift/TCLIService_types';
|
|
2
2
|
import HiveDriver from '../hive/HiveDriver';
|
|
3
3
|
import { WaitUntilReadyOptions } from '../contracts/IOperation';
|
|
4
4
|
export default class OperationStatusHelper {
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -14,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
38
|
const TCLIService_types_1 = require("../../thrift/TCLIService_types");
|
|
16
39
|
const Status_1 = __importDefault(require("../dto/Status"));
|
|
17
|
-
const OperationStateError_1 =
|
|
40
|
+
const OperationStateError_1 = __importStar(require("../errors/OperationStateError"));
|
|
18
41
|
function delay(ms) {
|
|
19
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
43
|
return new Promise((resolve) => {
|
|
@@ -85,16 +108,16 @@ class OperationStatusHelper {
|
|
|
85
108
|
case TCLIService_types_1.TOperationState.FINISHED_STATE:
|
|
86
109
|
return true;
|
|
87
110
|
case TCLIService_types_1.TOperationState.CANCELED_STATE:
|
|
88
|
-
throw new OperationStateError_1.default(
|
|
111
|
+
throw new OperationStateError_1.default(OperationStateError_1.OperationStateErrorCode.Canceled, response);
|
|
89
112
|
case TCLIService_types_1.TOperationState.CLOSED_STATE:
|
|
90
|
-
throw new OperationStateError_1.default(
|
|
113
|
+
throw new OperationStateError_1.default(OperationStateError_1.OperationStateErrorCode.Closed, response);
|
|
91
114
|
case TCLIService_types_1.TOperationState.ERROR_STATE:
|
|
92
|
-
throw new OperationStateError_1.default(
|
|
115
|
+
throw new OperationStateError_1.default(OperationStateError_1.OperationStateErrorCode.Error, response);
|
|
93
116
|
case TCLIService_types_1.TOperationState.TIMEDOUT_STATE:
|
|
94
|
-
throw new OperationStateError_1.default(
|
|
117
|
+
throw new OperationStateError_1.default(OperationStateError_1.OperationStateErrorCode.Timeout, response);
|
|
95
118
|
case TCLIService_types_1.TOperationState.UKNOWN_STATE:
|
|
96
119
|
default:
|
|
97
|
-
throw new OperationStateError_1.default(
|
|
120
|
+
throw new OperationStateError_1.default(OperationStateError_1.OperationStateErrorCode.Unknown, response);
|
|
98
121
|
}
|
|
99
122
|
});
|
|
100
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationStatusHelper.js","sourceRoot":"","sources":["../../lib/DBSQLOperation/OperationStatusHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationStatusHelper.js","sourceRoot":"","sources":["../../lib/DBSQLOperation/OperationStatusHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAA4G;AAE5G,2DAAmC;AAEnC,qFAA6F;AAE7F,SAAe,KAAK,CAAC,EAAW;;QAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,CAAC;YACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAED,MAAqB,qBAAqB;IAaxC,YAAY,MAAkB,EAAE,eAAiC,EAAE,eAAyC;QARpG,UAAK,GAAW,mCAAe,CAAC,iBAAiB,CAAC;QAMnD,iBAAY,GAAY,KAAK,CAAC;QAGnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC;QAEjD,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,8BAA8B,CAAC,eAAe,CAAC,CAAC;SACtD;IACH,CAAC;IAEO,YAAY,CAAC,QAAiC;QACpD,QAAQ,QAAQ,CAAC,cAAc,EAAE;YAC/B,KAAK,mCAAe,CAAC,iBAAiB,CAAC;YACvC,KAAK,mCAAe,CAAC,aAAa,CAAC;YACnC,KAAK,mCAAe,CAAC,aAAa;gBAChC,OAAO,IAAI,CAAC;YACd;gBACE,OAAO,KAAK,CAAC;SAChB;IACH,CAAC;IAEO,8BAA8B,CAAC,QAAiC;;QACtE,gBAAM,CAAC,MAAM,CAAC,QAAQ,CA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CAAC;gBACf,KAAK,mCAAe,CAAC,cAAc;oBACjC,OAAO,IAAI,CAAC;gBACd,KAAK,mCAAe,CAAC,cAAc;oBACjC,MAAM,IAAI,6BAAmB,CAAC,6CAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAC5E,KAAK,mCAAe,CAAC,YAAY;oBAC/B,MAAM,IAAI,6BAAmB,CAAC,6CAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAC1E,KAAK,mCAAe,CAAC,WAAW;oBAC9B,MAAM,IAAI,6BAAmB,CAAC,6CAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;gBACzE,KAAK,mCAAe,CAAC,cAAc;oBACjC,MAAM,IAAI,6BAAmB,CAAC,6CAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBAC3E,KAAK,mCAAe,CAAC,YAAY,CAAC;gBAClC;oBACE,MAAM,IAAI,6BAAmB,CAAC,6CAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;aAC5E;QACH,CAAC;KAAA;IAEY,cAAc,CAAC,OAA+B;;YACzD,IAAI,IAAI,CAAC,KAAK,KAAK,mCAAe,CAAC,cAAc,EAAE;gBACjD,OAAO;aACR;YACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,yCAAyC;gBAC3D,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;aACrC;QACH,CAAC;KAAA;CACF;AAvGD,wCAuGC"}
|
|
@@ -5,6 +5,7 @@ export default class SchemaHelper {
|
|
|
5
5
|
private readonly driver;
|
|
6
6
|
private readonly operationHandle;
|
|
7
7
|
private metadata?;
|
|
8
|
+
private resultHandler?;
|
|
8
9
|
constructor(driver: HiveDriver, operationHandle: TOperationHandle, metadata?: TGetResultSetMetadataResp);
|
|
9
10
|
private fetchMetadata;
|
|
10
11
|
fetch(): Promise<import("../../thrift/TCLIService_types").TTableSchema>;
|
|
@@ -16,6 +16,7 @@ const TCLIService_types_1 = require("../../thrift/TCLIService_types");
|
|
|
16
16
|
const Status_1 = __importDefault(require("../dto/Status"));
|
|
17
17
|
const JsonResult_1 = __importDefault(require("../result/JsonResult"));
|
|
18
18
|
const ArrowResult_1 = __importDefault(require("../result/ArrowResult"));
|
|
19
|
+
const CloudFetchResult_1 = __importDefault(require("../result/CloudFetchResult"));
|
|
19
20
|
const HiveDriverError_1 = __importDefault(require("../errors/HiveDriverError"));
|
|
20
21
|
const utils_1 = require("../utils");
|
|
21
22
|
class SchemaHelper {
|
|
@@ -46,14 +47,26 @@ class SchemaHelper {
|
|
|
46
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
48
|
const metadata = yield this.fetchMetadata();
|
|
48
49
|
const resultFormat = (0, utils_1.definedOrError)(metadata.resultFormat);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
if (!this.resultHandler) {
|
|
51
|
+
switch (resultFormat) {
|
|
52
|
+
case TCLIService_types_1.TSparkRowSetType.COLUMN_BASED_SET:
|
|
53
|
+
this.resultHandler = new JsonResult_1.default(metadata.schema);
|
|
54
|
+
break;
|
|
55
|
+
case TCLIService_types_1.TSparkRowSetType.ARROW_BASED_SET:
|
|
56
|
+
this.resultHandler = new ArrowResult_1.default(metadata.schema, metadata.arrowSchema);
|
|
57
|
+
break;
|
|
58
|
+
case TCLIService_types_1.TSparkRowSetType.URL_BASED_SET:
|
|
59
|
+
this.resultHandler = new CloudFetchResult_1.default(metadata.schema);
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
this.resultHandler = undefined;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
56
65
|
}
|
|
66
|
+
if (!this.resultHandler) {
|
|
67
|
+
throw new HiveDriverError_1.default(`Unsupported result format: ${TCLIService_types_1.TSparkRowSetType[resultFormat]}`);
|
|
68
|
+
}
|
|
69
|
+
return this.resultHandler;
|
|
57
70
|
});
|
|
58
71
|
}
|
|
59
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaHelper.js","sourceRoot":"","sources":["../../lib/DBSQLOperation/SchemaHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA+G;AAE/G,2DAAmC;AAEnC,sEAA8C;AAC9C,wEAAgD;AAChD,gFAAwD;AACxD,oCAA0C;AAE1C,MAAqB,YAAY;
|
|
1
|
+
{"version":3,"file":"SchemaHelper.js","sourceRoot":"","sources":["../../lib/DBSQLOperation/SchemaHelper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sEAA+G;AAE/G,2DAAmC;AAEnC,sEAA8C;AAC9C,wEAAgD;AAChD,kFAA0D;AAC1D,gFAAwD;AACxD,oCAA0C;AAE1C,MAAqB,YAAY;IAS/B,YAAY,MAAkB,EAAE,eAAiC,EAAE,QAAoC;QACrG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEa,aAAa;;YACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;oBACtD,eAAe,EAAE,IAAI,CAAC,eAAe;iBACtC,CAAC,CAAC;gBACH,gBAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;aAC1B;YAED,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;KAAA;IAEY,KAAK;;YAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAC5C,OAAO,IAAA,sBAAc,EAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;KAAA;IAEY,gBAAgB;;YAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAC5C,MAAM,YAAY,GAAG,IAAA,sBAAc,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAE3D,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;gBACvB,QAAQ,YAAY,EAAE;oBACpB,KAAK,oCAAgB,CAAC,gBAAgB;wBACpC,IAAI,CAAC,aAAa,GAAG,IAAI,oBAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;wBACrD,MAAM;oBACR,KAAK,oCAAgB,CAAC,eAAe;wBACnC,IAAI,CAAC,aAAa,GAAG,IAAI,qBAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;wBAC5E,MAAM;oBACR,KAAK,oCAAgB,CAAC,aAAa;wBACjC,IAAI,CAAC,aAAa,GAAG,IAAI,0BAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;wBAC3D,MAAM;oBACR;wBACE,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;wBAC/B,MAAM;iBACT;aACF;YAED,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;gBACvB,MAAM,IAAI,yBAAe,CAAC,8BAA8B,oCAAgB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;aAC3F;YAED,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;KAAA;CACF;AA3DD,+BA2DC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import IOperation, { FetchOptions,
|
|
1
|
+
import IOperation, { FetchOptions, FinishedOptions, GetSchemaOptions } from '../contracts/IOperation';
|
|
2
2
|
import HiveDriver from '../hive/HiveDriver';
|
|
3
3
|
import { TGetOperationStatusResp, TOperationHandle, TTableSchema, TSparkDirectResults } from '../../thrift/TCLIService_types';
|
|
4
4
|
import Status from '../dto/Status';
|
|
5
5
|
import IDBSQLLogger from '../contracts/IDBSQLLogger';
|
|
6
|
+
interface DBSQLOperationConstructorOptions {
|
|
7
|
+
logger: IDBSQLLogger;
|
|
8
|
+
}
|
|
6
9
|
export default class DBSQLOperation implements IOperation {
|
|
7
10
|
private readonly driver;
|
|
8
11
|
private readonly operationHandle;
|
|
9
12
|
private readonly logger;
|
|
13
|
+
onClose?: () => void;
|
|
10
14
|
private readonly _status;
|
|
11
15
|
private readonly _schema;
|
|
12
16
|
private readonly _data;
|
|
13
17
|
private readonly _completeOperation;
|
|
14
|
-
constructor(driver: HiveDriver, operationHandle: TOperationHandle, logger:
|
|
18
|
+
constructor(driver: HiveDriver, operationHandle: TOperationHandle, { logger }: DBSQLOperationConstructorOptions, directResults?: TSparkDirectResults);
|
|
15
19
|
getId(): string;
|
|
16
20
|
/**
|
|
17
21
|
* Fetches all data
|
|
@@ -52,4 +56,7 @@ export default class DBSQLOperation implements IOperation {
|
|
|
52
56
|
finished(options?: FinishedOptions): Promise<void>;
|
|
53
57
|
hasMoreRows(): Promise<boolean>;
|
|
54
58
|
getSchema(options?: GetSchemaOptions): Promise<TTableSchema | null>;
|
|
59
|
+
private failIfClosed;
|
|
60
|
+
private waitUntilReady;
|
|
55
61
|
}
|
|
62
|
+
export {};
|