@databricks/sql 1.7.0 → 1.8.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.js +27 -1
- package/dist/DBSQLClient.js.map +1 -1
- package/dist/DBSQLOperation/index.js +2 -2
- package/dist/DBSQLOperation/index.js.map +1 -1
- package/dist/DBSQLSession.js +1 -1
- package/dist/DBSQLSession.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.d.ts +9 -4
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.js +85 -36
- package/dist/connection/auth/DatabricksOAuth/OAuthManager.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthScope.d.ts +2 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthScope.js +1 -0
- package/dist/connection/auth/DatabricksOAuth/OAuthScope.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthToken.d.ts +4 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthToken.js +5 -1
- package/dist/connection/auth/DatabricksOAuth/OAuthToken.js.map +1 -1
- package/dist/connection/auth/DatabricksOAuth/index.d.ts +2 -2
- package/dist/connection/auth/DatabricksOAuth/index.js +26 -4
- package/dist/connection/auth/DatabricksOAuth/index.js.map +1 -1
- package/dist/connection/connections/HttpConnection.d.ts +3 -1
- package/dist/connection/connections/HttpConnection.js +8 -2
- package/dist/connection/connections/HttpConnection.js.map +1 -1
- package/dist/connection/connections/HttpRetryPolicy.d.ts +11 -0
- package/dist/connection/connections/HttpRetryPolicy.js +97 -0
- package/dist/connection/connections/HttpRetryPolicy.js.map +1 -0
- package/dist/connection/connections/ThriftHttpConnection.d.ts +3 -0
- package/dist/connection/connections/ThriftHttpConnection.js +6 -1
- package/dist/connection/connections/ThriftHttpConnection.js.map +1 -1
- package/dist/connection/contracts/IConnectionProvider.d.ts +3 -1
- package/dist/connection/contracts/IRetryPolicy.d.ts +11 -0
- package/dist/connection/contracts/IRetryPolicy.js +3 -0
- package/dist/connection/contracts/IRetryPolicy.js.map +1 -0
- package/dist/contracts/IClientContext.d.ts +1 -0
- package/dist/contracts/IDBSQLClient.d.ts +1 -0
- package/dist/errors/RetryError.d.ts +9 -0
- package/dist/errors/RetryError.js +21 -0
- package/dist/errors/RetryError.js.map +1 -0
- package/dist/hive/Commands/BaseCommand.d.ts +0 -1
- package/dist/hive/Commands/BaseCommand.js +33 -41
- package/dist/hive/Commands/BaseCommand.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/polyfills.d.ts +1 -0
- package/dist/polyfills.js +48 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/result/ArrowResultHandler.d.ts +2 -2
- package/dist/result/ArrowResultHandler.js +9 -4
- package/dist/result/ArrowResultHandler.js.map +1 -1
- package/dist/result/CloudFetchResultHandler.d.ts +2 -2
- package/dist/result/CloudFetchResultHandler.js +12 -5
- package/dist/result/CloudFetchResultHandler.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -3
|
@@ -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) {
|
|
@@ -8,12 +31,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.OAuthFlow = void 0;
|
|
15
36
|
const OAuthPersistence_1 = require("./OAuthPersistence");
|
|
16
|
-
const OAuthManager_1 =
|
|
37
|
+
const OAuthManager_1 = __importStar(require("./OAuthManager"));
|
|
38
|
+
Object.defineProperty(exports, "OAuthFlow", { enumerable: true, get: function () { return OAuthManager_1.OAuthFlow; } });
|
|
17
39
|
const OAuthScope_1 = require("./OAuthScope");
|
|
18
40
|
class DatabricksOAuth {
|
|
19
41
|
constructor(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/connection/auth/DatabricksOAuth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/connection/auth/DatabricksOAuth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yDAA6E;AAC7E,+DAA8E;AAIrE,0FAJmC,wBAAS,OAInC;AAHlB,6CAA+D;AAW/D,MAAqB,eAAe;IASlC,YAAY,OAA+B;QAF1B,uBAAkB,GAAG,IAAI,wCAAqB,EAAE,CAAC;QAGhE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,sBAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAEY,YAAY;;;YACvB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;YAE/C,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,WAAW,mCAAI,IAAI,CAAC,kBAAkB,CAAC;YAExE,IAAI,KAAK,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,CAAC,KAAK,EAAE;gBACV,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,+BAAkB,CAAC,CAAC;aACnE;YAED,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACrD,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAEvC,uCACK,OAAO,KACV,aAAa,EAAE,UAAU,KAAK,CAAC,WAAW,EAAE,IAC5C;;KACH;CACF;AAjCD,kCAiCC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import http from 'http';
|
|
3
|
-
import { HeadersInit } from 'node-fetch';
|
|
3
|
+
import { HeadersInit, Response } from 'node-fetch';
|
|
4
4
|
import IConnectionProvider from '../contracts/IConnectionProvider';
|
|
5
5
|
import IConnectionOptions from '../contracts/IConnectionOptions';
|
|
6
6
|
import IClientContext from '../../contracts/IClientContext';
|
|
7
|
+
import IRetryPolicy from '../contracts/IRetryPolicy';
|
|
7
8
|
export default class HttpConnection implements IConnectionProvider {
|
|
8
9
|
private readonly options;
|
|
9
10
|
private readonly context;
|
|
@@ -18,4 +19,5 @@ export default class HttpConnection implements IConnectionProvider {
|
|
|
18
19
|
private createHttpsAgent;
|
|
19
20
|
private createProxyAgent;
|
|
20
21
|
getThriftConnection(): Promise<any>;
|
|
22
|
+
getRetryPolicy(): Promise<IRetryPolicy<Response>>;
|
|
21
23
|
}
|
|
@@ -17,6 +17,7 @@ const https_1 = __importDefault(require("https"));
|
|
|
17
17
|
const http_1 = __importDefault(require("http"));
|
|
18
18
|
const proxy_agent_1 = require("proxy-agent");
|
|
19
19
|
const ThriftHttpConnection_1 = __importDefault(require("./ThriftHttpConnection"));
|
|
20
|
+
const HttpRetryPolicy_1 = __importDefault(require("./HttpRetryPolicy"));
|
|
20
21
|
class HttpConnection {
|
|
21
22
|
constructor(options, context) {
|
|
22
23
|
this.headers = {};
|
|
@@ -44,11 +45,10 @@ class HttpConnection {
|
|
|
44
45
|
getAgentDefaultOptions() {
|
|
45
46
|
var _a;
|
|
46
47
|
const clientConfig = this.context.getConfig();
|
|
47
|
-
const cloudFetchExtraSocketsCount = clientConfig.useCloudFetch ? clientConfig.cloudFetchConcurrentDownloads : 0;
|
|
48
48
|
return {
|
|
49
49
|
keepAlive: true,
|
|
50
|
-
maxSockets: 5 + cloudFetchExtraSocketsCount,
|
|
51
50
|
keepAliveMsecs: 10000,
|
|
51
|
+
maxSockets: Infinity,
|
|
52
52
|
timeout: (_a = this.options.socketTimeout) !== null && _a !== void 0 ? _a : clientConfig.socketTimeout,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -80,6 +80,7 @@ class HttpConnection {
|
|
|
80
80
|
url: `${options.https ? 'https' : 'http'}://${options.host}:${options.port}${(_a = options.path) !== null && _a !== void 0 ? _a : '/'}`,
|
|
81
81
|
transport: thrift_1.default.TBufferedTransport,
|
|
82
82
|
protocol: thrift_1.default.TBinaryProtocol,
|
|
83
|
+
getRetryPolicy: () => this.getRetryPolicy(),
|
|
83
84
|
}, {
|
|
84
85
|
agent,
|
|
85
86
|
timeout: (_b = options.socketTimeout) !== null && _b !== void 0 ? _b : clientConfig.socketTimeout,
|
|
@@ -89,6 +90,11 @@ class HttpConnection {
|
|
|
89
90
|
return this.connection;
|
|
90
91
|
});
|
|
91
92
|
}
|
|
93
|
+
getRetryPolicy() {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
return new HttpRetryPolicy_1.default(this.context);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
92
98
|
}
|
|
93
99
|
exports.default = HttpConnection;
|
|
94
100
|
//# sourceMappingURL=HttpConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpConnection.js","sourceRoot":"","sources":["../../../lib/connection/connections/HttpConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,kDAA0B;AAC1B,gDAAwB;AAExB,6CAAyC;AAMzC,kFAA0D;AAE1D,MAAqB,cAAc;IAWjC,YAAY,OAA2B,EAAE,OAAuB;QANxD,YAAO,GAAgB,EAAE,CAAC;QAOhC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,UAAU,CAAC,OAAoB;;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,MAAA,IAAI,CAAC,UAAU,0CAAE,UAAU,iCACtB,IAAI,CAAC,OAAO,CAAC,OAAO,GACpB,IAAI,CAAC,OAAO,EACf,CAAC;IACL,CAAC;IAEY,QAAQ;;YACnB,IAAI,CAAC,IAAI,CAAC,KA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F,OAAO,CAAC,OAAO,GACf,IAAI,CAAC,OAAO,CAChB;iBACF,CACF,CAAC;aACH;YAED,OAAO,IAAI,CAAC,UAAU,CAAC;;KACxB;IAEY,cAAc;;YACzB,OAAO,IAAI,yBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;KAAA;CACF;AA/GD,iCA+GC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Response } from 'node-fetch';
|
|
2
|
+
import IRetryPolicy, { ShouldRetryResult, RetryableOperation } from '../contracts/IRetryPolicy';
|
|
3
|
+
import IClientContext from '../../contracts/IClientContext';
|
|
4
|
+
export default class HttpRetryPolicy implements IRetryPolicy<Response> {
|
|
5
|
+
private context;
|
|
6
|
+
private readonly startTime;
|
|
7
|
+
private attempt;
|
|
8
|
+
constructor(context: IClientContext);
|
|
9
|
+
shouldRetry(response: Response): Promise<ShouldRetryResult>;
|
|
10
|
+
invokeWithRetry(operation: RetryableOperation<Response>): Promise<Response>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const RetryError_1 = __importStar(require("../../errors/RetryError"));
|
|
36
|
+
function getRetryDelay(attempt, config) {
|
|
37
|
+
const scale = Math.max(1, Math.pow(1.5, (attempt - 1))); // ensure scale >= 1
|
|
38
|
+
return Math.min(config.retryDelayMin * scale, config.retryDelayMax);
|
|
39
|
+
}
|
|
40
|
+
function delay(milliseconds) {
|
|
41
|
+
return new Promise((resolve) => {
|
|
42
|
+
setTimeout(() => resolve(), milliseconds);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
class HttpRetryPolicy {
|
|
46
|
+
constructor(context) {
|
|
47
|
+
this.context = context;
|
|
48
|
+
this.startTime = Date.now();
|
|
49
|
+
this.attempt = 0;
|
|
50
|
+
}
|
|
51
|
+
shouldRetry(response) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
switch (response.status) {
|
|
55
|
+
// On these status codes it's safe to retry the request. However,
|
|
56
|
+
// both error codes mean that server is overwhelmed or even down.
|
|
57
|
+
// Therefore, we need to add some delay between attempts so
|
|
58
|
+
// server can recover and more likely handle next request
|
|
59
|
+
case 429: // Too Many Requests
|
|
60
|
+
case 503: // Service Unavailable
|
|
61
|
+
this.attempt += 1;
|
|
62
|
+
const clientConfig = this.context.getConfig();
|
|
63
|
+
// Delay interval depends on current attempt - the more attempts we do
|
|
64
|
+
// the longer the interval will be
|
|
65
|
+
// TODO: Respect `Retry-After` header (PECO-729)
|
|
66
|
+
const retryDelay = getRetryDelay(this.attempt, clientConfig);
|
|
67
|
+
const attemptsExceeded = this.attempt >= clientConfig.retryMaxAttempts;
|
|
68
|
+
if (attemptsExceeded) {
|
|
69
|
+
throw new RetryError_1.default(RetryError_1.RetryErrorCode.AttemptsExceeded, response);
|
|
70
|
+
}
|
|
71
|
+
const timeoutExceeded = Date.now() - this.startTime + retryDelay >= clientConfig.retriesTimeout;
|
|
72
|
+
if (timeoutExceeded) {
|
|
73
|
+
throw new RetryError_1.default(RetryError_1.RetryErrorCode.TimeoutExceeded, response);
|
|
74
|
+
}
|
|
75
|
+
return { shouldRetry: true, retryAfter: retryDelay };
|
|
76
|
+
// TODO: Here we should handle other error types (see PECO-730)
|
|
77
|
+
// no default
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { shouldRetry: false };
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
invokeWithRetry(operation) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
for (;;) {
|
|
86
|
+
const response = yield operation(); // eslint-disable-line no-await-in-loop
|
|
87
|
+
const status = yield this.shouldRetry(response); // eslint-disable-line no-await-in-loop
|
|
88
|
+
if (!status.shouldRetry) {
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
yield delay(status.retryAfter); // eslint-disable-line no-await-in-loop
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.default = HttpRetryPolicy;
|
|
97
|
+
//# sourceMappingURL=HttpRetryPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpRetryPolicy.js","sourceRoot":"","sources":["../../../lib/connection/connections/HttpRetryPolicy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sEAAqE;AAErE,SAAS,aAAa,CAAC,OAAe,EAAE,MAAoB;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAA,GAAG,EAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,oBAAoB;IACrE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,GAAG,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,KAAK,CAAC,YAAoB;IACjC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAqB,eAAe;IAOlC,YAAY,OAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,CAAC;IAEY,WAAW,CAAC,QAAkB;;YACzC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;gBAChB,QAAQ,QAAQ,CAAC,MAAM,EAAE;oBACvB,iEAAiE;oBACjE,iEAAiE;oBACjE,2DAA2D;oBAC3D,yDAAyD;oBACzD,KAAK,GAAG,CAAC,CAAC,oBAAoB;oBAC9B,KAAK,GAA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C"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { EventEmitter } from 'events';
|
|
9
9
|
import { TBufferedTransport, Thrift, TProtocol, TProtocolConstructor } from 'thrift';
|
|
10
10
|
import { RequestInit, HeadersInit, Response } from 'node-fetch';
|
|
11
|
+
import IRetryPolicy from '../contracts/IRetryPolicy';
|
|
11
12
|
export declare class THTTPException extends Thrift.TApplicationException {
|
|
12
13
|
readonly statusCode: unknown;
|
|
13
14
|
readonly response: Response;
|
|
@@ -18,6 +19,7 @@ interface ThriftHttpConnectionOptions {
|
|
|
18
19
|
url: string;
|
|
19
20
|
transport?: TTransportType;
|
|
20
21
|
protocol?: TProtocolConstructor;
|
|
22
|
+
getRetryPolicy(): Promise<IRetryPolicy<Response>>;
|
|
21
23
|
}
|
|
22
24
|
type ThriftClient = {
|
|
23
25
|
_reqs: Record<number, (error: unknown, response?: unknown) => void>;
|
|
@@ -29,6 +31,7 @@ export default class ThriftHttpConnection extends EventEmitter {
|
|
|
29
31
|
private config;
|
|
30
32
|
private readonly transport;
|
|
31
33
|
private readonly protocol;
|
|
34
|
+
private readonly getRetryPolicy;
|
|
32
35
|
client?: ThriftClient;
|
|
33
36
|
constructor(options: ThriftHttpConnectionOptions, config?: RequestInit);
|
|
34
37
|
setHeaders(headers: HeadersInit): void;
|
|
@@ -53,13 +53,18 @@ class ThriftHttpConnection extends events_1.EventEmitter {
|
|
|
53
53
|
this.config = config;
|
|
54
54
|
this.transport = (_a = options.transport) !== null && _a !== void 0 ? _a : thrift_1.TBufferedTransport;
|
|
55
55
|
this.protocol = (_b = options.protocol) !== null && _b !== void 0 ? _b : thrift_1.TBinaryProtocol;
|
|
56
|
+
this.getRetryPolicy = options.getRetryPolicy;
|
|
56
57
|
}
|
|
57
58
|
setHeaders(headers) {
|
|
58
59
|
this.config = Object.assign(Object.assign({}, this.config), { headers });
|
|
59
60
|
}
|
|
60
61
|
write(data, seqId) {
|
|
61
62
|
const requestConfig = Object.assign(Object.assign({}, this.config), { method: 'POST', headers: Object.assign(Object.assign({}, this.config.headers), { Connection: 'keep-alive', 'Content-Length': `${data.length}`, 'Content-Type': 'application/x-thrift' }), body: data });
|
|
62
|
-
|
|
63
|
+
this.getRetryPolicy()
|
|
64
|
+
.then((retryPolicy) => {
|
|
65
|
+
const makeRequest = () => (0, node_fetch_1.default)(this.url, requestConfig);
|
|
66
|
+
return retryPolicy.invokeWithRetry(makeRequest);
|
|
67
|
+
})
|
|
63
68
|
.then((response) => {
|
|
64
69
|
if (response.status !== 200) {
|
|
65
70
|
throw new THTTPException(response);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThriftHttpConnection.js","sourceRoot":"","sources":["../../../lib/connection/connections/ThriftHttpConnection.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,mCAAsC;AACtC,mCAAkH;AAClH,yDAAmF;AACnF,wEAAwE;AACxE,2HAAgG;
|
|
1
|
+
{"version":3,"file":"ThriftHttpConnection.js","sourceRoot":"","sources":["../../../lib/connection/connections/ThriftHttpConnection.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,mCAAsC;AACtC,mCAAkH;AAClH,yDAAmF;AACnF,wEAAwE;AACxE,2HAAgG;AAGhG,MAAa,cAAe,SAAQ,eAAM,CAAC,qBAAqB;IAK9D,YAAY,QAAkB;QAC5B,KAAK,CACH,eAAM,CAAC,yBAAyB,CAAC,cAAc,EAC/C,oDAAoD,QAAQ,CAAC,MAAM,EAAE,CACtE,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAbD,wCAaC;AAuBD,MAAqB,oBAAqB,SAAQ,qBAAY;IAgB5D,YAAY,OAAoC,EAAE,SAAsB,EAAE;;QACxE,KAAK,EAAE,CAAC;QACR,I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
|
3
|
-
import { HeadersInit } from 'node-fetch';
|
|
3
|
+
import { HeadersInit, Response } from 'node-fetch';
|
|
4
|
+
import IRetryPolicy from './IRetryPolicy';
|
|
4
5
|
export default interface IConnectionProvider {
|
|
5
6
|
getThriftConnection(): Promise<any>;
|
|
6
7
|
getAgent(): Promise<http.Agent>;
|
|
7
8
|
setHeaders(headers: HeadersInit): void;
|
|
9
|
+
getRetryPolicy(): Promise<IRetryPolicy<Response>>;
|
|
8
10
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ShouldRetryResult = {
|
|
2
|
+
shouldRetry: false;
|
|
3
|
+
} | {
|
|
4
|
+
shouldRetry: true;
|
|
5
|
+
retryAfter: number;
|
|
6
|
+
};
|
|
7
|
+
export type RetryableOperation<R> = () => Promise<R>;
|
|
8
|
+
export default interface IRetryPolicy<R> {
|
|
9
|
+
shouldRetry(response: R): Promise<ShouldRetryResult>;
|
|
10
|
+
invokeWithRetry(operation: RetryableOperation<R>): Promise<R>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRetryPolicy.js","sourceRoot":"","sources":["../../../lib/connection/contracts/IRetryPolicy.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum RetryErrorCode {
|
|
2
|
+
AttemptsExceeded = "ATTEMPTS_EXCEEDED",
|
|
3
|
+
TimeoutExceeded = "TIMEOUT_EXCEEDED"
|
|
4
|
+
}
|
|
5
|
+
export default class RetryError extends Error {
|
|
6
|
+
readonly errorCode: RetryErrorCode;
|
|
7
|
+
readonly payload: unknown;
|
|
8
|
+
constructor(errorCode: RetryErrorCode, payload?: unknown);
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RetryErrorCode = void 0;
|
|
4
|
+
var RetryErrorCode;
|
|
5
|
+
(function (RetryErrorCode) {
|
|
6
|
+
RetryErrorCode["AttemptsExceeded"] = "ATTEMPTS_EXCEEDED";
|
|
7
|
+
RetryErrorCode["TimeoutExceeded"] = "TIMEOUT_EXCEEDED";
|
|
8
|
+
})(RetryErrorCode = exports.RetryErrorCode || (exports.RetryErrorCode = {}));
|
|
9
|
+
const errorMessages = {
|
|
10
|
+
[RetryErrorCode.AttemptsExceeded]: 'Max retry count exceeded',
|
|
11
|
+
[RetryErrorCode.TimeoutExceeded]: 'Retry timeout exceeded',
|
|
12
|
+
};
|
|
13
|
+
class RetryError extends Error {
|
|
14
|
+
constructor(errorCode, payload) {
|
|
15
|
+
super(errorMessages[errorCode]);
|
|
16
|
+
this.errorCode = errorCode;
|
|
17
|
+
this.payload = payload;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = RetryError;
|
|
21
|
+
//# sourceMappingURL=RetryError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RetryError.js","sourceRoot":"","sources":["../../lib/errors/RetryError.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,wDAAsC,CAAA;IACtC,sDAAoC,CAAA;AACtC,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAED,MAAM,aAAa,GAAmC;IACpD,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,0BAA0B;IAC7D,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,wBAAwB;CAC3D,CAAC;AAEF,MAAqB,UAAW,SAAQ,KAAK;IAK3C,YAAY,SAAyB,EAAE,OAAiB;QACtD,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAVD,6BAUC"}
|
|
@@ -5,6 +5,5 @@ export default abstract class BaseCommand {
|
|
|
5
5
|
protected context: IClientContext;
|
|
6
6
|
constructor(client: TCLIService.Client, context: IClientContext);
|
|
7
7
|
protected executeCommand<Response>(request: object, command: Function | void): Promise<Response>;
|
|
8
|
-
private invokeWithErrorHandling;
|
|
9
8
|
private invokeCommand;
|
|
10
9
|
}
|
|
@@ -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) {
|
|
@@ -12,59 +35,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
36
|
};
|
|
14
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const
|
|
38
|
+
const node_fetch_1 = require("node-fetch");
|
|
16
39
|
const HiveDriverError_1 = __importDefault(require("../../errors/HiveDriverError"));
|
|
17
|
-
|
|
18
|
-
const scale = Math.max(1, Math.pow(1.5, (attempt - 1))); // ensure scale >= 1
|
|
19
|
-
return Math.min(config.retryDelayMin * scale, config.retryDelayMax);
|
|
20
|
-
}
|
|
21
|
-
function delay(milliseconds) {
|
|
22
|
-
return new Promise((resolve) => {
|
|
23
|
-
setTimeout(() => resolve(), milliseconds);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
40
|
+
const RetryError_1 = __importStar(require("../../errors/RetryError"));
|
|
26
41
|
class BaseCommand {
|
|
27
42
|
constructor(client, context) {
|
|
28
43
|
this.client = client;
|
|
29
44
|
this.context = context;
|
|
30
45
|
}
|
|
31
46
|
executeCommand(request, command) {
|
|
32
|
-
return this.invokeWithErrorHandling(request, command, { startTime: Date.now(), attempt: 0 });
|
|
33
|
-
}
|
|
34
|
-
invokeWithErrorHandling(request, command, info) {
|
|
35
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
48
|
try {
|
|
37
49
|
return yield this.invokeCommand(request, command);
|
|
38
50
|
}
|
|
39
51
|
catch (error) {
|
|
40
|
-
if (error instanceof
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case 503: // Service Unavailable
|
|
49
|
-
info.attempt += 1;
|
|
50
|
-
const clientConfig = this.context.getConfig();
|
|
51
|
-
// Delay interval depends on current attempt - the more attempts we do
|
|
52
|
-
// the longer the interval will be
|
|
53
|
-
// TODO: Respect `Retry-After` header (PECO-729)
|
|
54
|
-
const retryDelay = getRetryDelay(info.attempt, clientConfig);
|
|
55
|
-
const attemptsExceeded = info.attempt >= clientConfig.retryMaxAttempts;
|
|
56
|
-
if (attemptsExceeded) {
|
|
57
|
-
throw new HiveDriverError_1.default(`Hive driver: ${error.statusCode} when connecting to resource. Max retry count exceeded.`);
|
|
58
|
-
}
|
|
59
|
-
const timeoutExceeded = Date.now() - info.startTime + retryDelay >= clientConfig.retriesTimeout;
|
|
60
|
-
if (timeoutExceeded) {
|
|
61
|
-
throw new HiveDriverError_1.default(`Hive driver: ${error.statusCode} when connecting to resource. Retry timeout exceeded.`);
|
|
62
|
-
}
|
|
63
|
-
yield delay(retryDelay);
|
|
64
|
-
return this.invokeWithErrorHandling(request, command, info);
|
|
65
|
-
// TODO: Here we should handle other error types (see PECO-730)
|
|
66
|
-
// no default
|
|
67
|
-
}
|
|
52
|
+
if (error instanceof RetryError_1.default) {
|
|
53
|
+
const statusCode = error.payload instanceof node_fetch_1.Response ? error.payload.status : undefined;
|
|
54
|
+
switch (error.errorCode) {
|
|
55
|
+
case RetryError_1.RetryErrorCode.AttemptsExceeded:
|
|
56
|
+
throw new HiveDriverError_1.default(`Hive driver: ${statusCode !== null && statusCode !== void 0 ? statusCode : 'Error'} when connecting to resource. Max retry count exceeded.`);
|
|
57
|
+
case RetryError_1.RetryErrorCode.TimeoutExceeded:
|
|
58
|
+
throw new HiveDriverError_1.default(`Hive driver: ${statusCode !== null && statusCode !== void 0 ? statusCode : 'Error'} when connecting to resource. Retry timeout exceeded.`);
|
|
59
|
+
// no default
|
|
68
60
|
}
|
|
69
61
|
}
|
|
70
62
|
// Re-throw error we didn't handle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/BaseCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseCommand.js","sourceRoot":"","sources":["../../../lib/hive/Commands/BaseCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAsC;AAEtC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E,QAAkB,EAAE,EAAE;oBACpE,IAAI,GAAG,EAAE;wBACP,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;yBAAM;wBACL,OAAO,CAAC,QAAQ,CAAC,CAAC;qBACnB;gBACH,CAAC,CAAC,CAAC;aACJ;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,CAAC;aACf;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAxDD,8BAwDC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LogLevel = exports.DBSQLLogger = exports.DBSQLParameterType = exports.DBSQLParameter = exports.DBSQLSession = exports.DBSQLClient = exports.utils = exports.thrift = exports.connections = exports.TProtocolExceptionType = exports.TProtocolException = exports.TApplicationExceptionType = exports.TApplicationException = exports.TException = exports.auth = void 0;
|
|
7
|
+
// Don't move this import - it should be placed before any other
|
|
8
|
+
require("./polyfills");
|
|
7
9
|
const thrift_1 = require("thrift");
|
|
8
10
|
const TCLIService_1 = __importDefault(require("../thrift/TCLIService"));
|
|
9
11
|
const TCLIService_types_1 = __importDefault(require("../thrift/TCLIService_types"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAgC;AAChC,wEAAgD;AAChD,oFAA4D;AAC5D,gEAAwC;AA+B/B,sBA/BF,qBAAW,CA+BE;AA9BpB,kEAA0C;AA8BpB,uBA9Bf,sBAAY,CA8Be;AA7BlC,qDAAsE;AA6BlC,+FA7B3B,+BAAc,OA6B2B;AAAE,mGA7B3B,mCAAkB,OA6B2B;AA5BtE,gEAAwC;AA4BgC,sBA5BjE,qBAAW,CA4BiE;AA3BnF,wGA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AAAE,gDAAkB;AAAE,wDAAsB;AAEpG,QAAA,WAAW,GAAG;IACzB,cAAc,EAAd,wBAAc;CACf,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,WAAW,EAAX,qBAAW;IACX,iBAAiB,EAAjB,2BAAiB;CAClB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,cAAc,EAAd,sBAAc;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function at<T>(this: Array<T>, index: number): T | undefined;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable import/prefer-default-export */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.at = void 0;
|
|
5
|
+
// `Array.at` / `TypedArray.at` is supported only since Nodejs@16.6.0
|
|
6
|
+
// These methods are massively used by `apache-arrow@13`, but we have
|
|
7
|
+
// to use this version because older ones contain some other nasty bugs
|
|
8
|
+
// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tointegerorinfinity
|
|
9
|
+
function toIntegerOrInfinity(value) {
|
|
10
|
+
const result = Number(value);
|
|
11
|
+
// Return `0` for NaN; return `+Infinity` / `-Infinity` as is
|
|
12
|
+
if (!Number.isFinite(result)) {
|
|
13
|
+
return Number.isNaN(result) ? 0 : result;
|
|
14
|
+
}
|
|
15
|
+
return Math.trunc(result);
|
|
16
|
+
}
|
|
17
|
+
// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tolength
|
|
18
|
+
function toLength(value) {
|
|
19
|
+
const result = toIntegerOrInfinity(value);
|
|
20
|
+
return result > 0 ? Math.min(result, Number.MAX_SAFE_INTEGER) : 0;
|
|
21
|
+
}
|
|
22
|
+
// https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.at
|
|
23
|
+
function at(index) {
|
|
24
|
+
const length = toLength(this.length);
|
|
25
|
+
const relativeIndex = toIntegerOrInfinity(index);
|
|
26
|
+
const absoluteIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
|
27
|
+
return absoluteIndex >= 0 && absoluteIndex < length ? this[absoluteIndex] : undefined;
|
|
28
|
+
}
|
|
29
|
+
exports.at = at;
|
|
30
|
+
const ArrayConstructors = [
|
|
31
|
+
global.Array,
|
|
32
|
+
global.Int8Array,
|
|
33
|
+
global.Uint8Array,
|
|
34
|
+
global.Uint8ClampedArray,
|
|
35
|
+
global.Int16Array,
|
|
36
|
+
global.Uint16Array,
|
|
37
|
+
global.Int32Array,
|
|
38
|
+
global.Uint32Array,
|
|
39
|
+
global.Float32Array,
|
|
40
|
+
global.Float64Array,
|
|
41
|
+
global.BigInt64Array,
|
|
42
|
+
global.BigUint64Array,
|
|
43
|
+
];
|
|
44
|
+
ArrayConstructors.forEach((ArrayConstructor) => {
|
|
45
|
+
var _a;
|
|
46
|
+
ArrayConstructor.prototype.at = (_a = ArrayConstructor.prototype.at) !== null && _a !== void 0 ? _a : at;
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=polyfills.js.map
|
|
@@ -0,0 +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,CAAC,KAAK,CAAC,CAAC;IAE7B,6DAA6D;IAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;KAC1C;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAED,0EAA0E;AAC1E,SAAS,QAAQ,CAAC,KAAc;IAC9B,MAAM,MAAM,GAAG,mBA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} from '../../thrift/TCLIService_types';
|
|
4
3
|
import IClientContext from '../contracts/IClientContext';
|
|
5
4
|
import IResultsProvider, { ResultsProviderFetchNextOptions } from './IResultsProvider';
|
|
@@ -7,7 +6,8 @@ export default class ArrowResultHandler implements IResultsProvider<Array<Buffer
|
|
|
7
6
|
protected readonly context: IClientContext;
|
|
8
7
|
private readonly source;
|
|
9
8
|
private readonly arrowSchema?;
|
|
10
|
-
|
|
9
|
+
private readonly isLZ4Compressed;
|
|
10
|
+
constructor(context: IClientContext, source: IResultsProvider<TRowSet | undefined>, arrowSchema?: Buffer, isLZ4Compressed?: boolean);
|
|
11
11
|
hasMore(): Promise<boolean>;
|
|
12
12
|
fetchNext(options: ResultsProviderFetchNextOptions): Promise<Buffer[]>;
|
|
13
13
|
}
|