@databricks/sql 0.1.8-beta.1 → 1.0.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/CHANGELOG.md +45 -1
- package/NOTICE +35 -0
- package/README.md +41 -20
- package/dist/DBSQLClient.d.ts +34 -39
- package/dist/DBSQLClient.js +137 -98
- package/dist/DBSQLClient.js.map +1 -1
- package/dist/DBSQLLogger.d.ts +12 -0
- package/dist/DBSQLLogger.js +43 -0
- package/dist/DBSQLLogger.js.map +1 -0
- package/dist/DBSQLOperation/CompleteOperationHelper.d.ts +13 -0
- package/dist/DBSQLOperation/CompleteOperationHelper.js +61 -0
- package/dist/DBSQLOperation/CompleteOperationHelper.js.map +1 -0
- package/dist/DBSQLOperation/FetchResultsHelper.d.ts +14 -0
- package/dist/DBSQLOperation/FetchResultsHelper.js +79 -0
- package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -0
- package/dist/DBSQLOperation/OperationStatusHelper.d.ts +17 -0
- package/dist/DBSQLOperation/OperationStatusHelper.js +115 -0
- package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -0
- package/dist/DBSQLOperation/SchemaHelper.d.ts +10 -0
- package/dist/DBSQLOperation/SchemaHelper.js +39 -0
- package/dist/DBSQLOperation/SchemaHelper.js.map +1 -0
- package/dist/DBSQLOperation/getResult.d.ts +2 -0
- package/dist/DBSQLOperation/getResult.js +19 -0
- package/dist/DBSQLOperation/getResult.js.map +1 -0
- package/dist/DBSQLOperation/index.d.ts +55 -0
- package/dist/DBSQLOperation/index.js +139 -0
- package/dist/DBSQLOperation/index.js.map +1 -0
- package/dist/DBSQLSession.d.ts +99 -0
- package/dist/DBSQLSession.js +187 -0
- package/dist/DBSQLSession.js.map +1 -0
- package/dist/connection/auth/NoSaslAuthentication.d.ts +2 -2
- package/dist/connection/auth/NoSaslAuthentication.js +9 -9
- package/dist/connection/auth/NoSaslAuthentication.js.map +1 -1
- package/dist/connection/auth/PlainHttpAuthentication.d.ts +2 -2
- package/dist/connection/auth/PlainHttpAuthentication.js +9 -21
- package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -1
- package/dist/connection/auth/helpers/SaslPackageFactory.js +5 -9
- package/dist/connection/auth/helpers/SaslPackageFactory.js.map +1 -1
- package/dist/connection/connections/HttpConnection.d.ts +4 -4
- package/dist/connection/connections/HttpConnection.js +42 -47
- package/dist/connection/connections/HttpConnection.js.map +1 -1
- package/dist/connection/contracts/IAuthentication.d.ts +1 -1
- package/dist/connection/transports/HttpTransport.d.ts +1 -1
- package/dist/connection/transports/HttpTransport.js +16 -31
- package/dist/connection/transports/HttpTransport.js.map +1 -1
- package/dist/contracts/IDBSQLClient.d.ts +21 -0
- package/dist/contracts/{IHiveClient.js → IDBSQLClient.js} +1 -1
- package/dist/contracts/IDBSQLClient.js.map +1 -0
- package/dist/contracts/IDBSQLLogger.d.ts +13 -0
- package/dist/contracts/IDBSQLLogger.js +11 -0
- package/dist/contracts/IDBSQLLogger.js.map +1 -0
- package/dist/contracts/{IHiveSession.d.ts → IDBSQLSession.d.ts} +59 -45
- package/dist/contracts/{IHiveSession.js → IDBSQLSession.js} +1 -1
- package/dist/contracts/IDBSQLSession.js.map +1 -0
- package/dist/contracts/IOperation.d.ts +26 -23
- package/dist/dto/InfoValue.d.ts +5 -3
- package/dist/dto/InfoValue.js +11 -14
- package/dist/dto/InfoValue.js.map +1 -1
- package/dist/dto/Status.js +9 -10
- package/dist/dto/Status.js.map +1 -1
- package/dist/errors/AuthenticationError.d.ts +1 -1
- package/dist/errors/AuthenticationError.js +3 -23
- package/dist/errors/AuthenticationError.js.map +1 -1
- package/dist/errors/HiveDriverError.js +2 -22
- package/dist/errors/HiveDriverError.js.map +1 -1
- package/dist/errors/OperationStateError.d.ts +4 -4
- package/dist/errors/OperationStateError.js +6 -24
- package/dist/errors/OperationStateError.js.map +1 -1
- package/dist/errors/StatusError.d.ts +2 -2
- package/dist/errors/StatusError.js +3 -4
- package/dist/errors/StatusError.js.map +1 -1
- package/dist/factory/StatusFactory.d.ts +2 -4
- package/dist/factory/StatusFactory.js +16 -21
- package/dist/factory/StatusFactory.js.map +1 -1
- package/dist/hive/Commands/BaseCommand.d.ts +3 -4
- package/dist/hive/Commands/BaseCommand.js +10 -12
- package/dist/hive/Commands/BaseCommand.js.map +1 -1
- package/dist/hive/Commands/CancelDelegationTokenCommand.d.ts +3 -10
- package/dist/hive/Commands/CancelDelegationTokenCommand.js +7 -26
- package/dist/hive/Commands/CancelDelegationTokenCommand.js.map +1 -1
- package/dist/hive/Commands/CancelOperationCommand.d.ts +3 -9
- package/dist/hive/Commands/CancelOperationCommand.js +7 -26
- package/dist/hive/Commands/CancelOperationCommand.js.map +1 -1
- package/dist/hive/Commands/CloseOperationCommand.d.ts +3 -9
- package/dist/hive/Commands/CloseOperationCommand.js +7 -26
- package/dist/hive/Commands/CloseOperationCommand.js.map +1 -1
- package/dist/hive/Commands/CloseSessionCommand.d.ts +3 -9
- package/dist/hive/Commands/CloseSessionCommand.js +7 -26
- package/dist/hive/Commands/CloseSessionCommand.js.map +1 -1
- package/dist/hive/Commands/ExecuteStatementCommand.d.ts +3 -15
- package/dist/hive/Commands/ExecuteStatementCommand.js +7 -26
- package/dist/hive/Commands/ExecuteStatementCommand.js.map +1 -1
- package/dist/hive/Commands/FetchResultsCommand.d.ts +4 -16
- package/dist/hive/Commands/FetchResultsCommand.js +10 -26
- package/dist/hive/Commands/FetchResultsCommand.js.map +1 -1
- package/dist/hive/Commands/GetCatalogsCommand.d.ts +3 -10
- package/dist/hive/Commands/GetCatalogsCommand.js +7 -26
- package/dist/hive/Commands/GetCatalogsCommand.js.map +1 -1
- package/dist/hive/Commands/GetColumnsCommand.d.ts +3 -14
- package/dist/hive/Commands/GetColumnsCommand.js +7 -26
- package/dist/hive/Commands/GetColumnsCommand.js.map +1 -1
- package/dist/hive/Commands/GetCrossReferenceCommand.d.ts +3 -16
- package/dist/hive/Commands/GetCrossReferenceCommand.js +7 -26
- package/dist/hive/Commands/GetCrossReferenceCommand.js.map +1 -1
- package/dist/hive/Commands/GetDelegationTokenCommand.d.ts +3 -12
- package/dist/hive/Commands/GetDelegationTokenCommand.js +7 -26
- package/dist/hive/Commands/GetDelegationTokenCommand.js.map +1 -1
- package/dist/hive/Commands/GetFunctionsCommand.d.ts +3 -13
- package/dist/hive/Commands/GetFunctionsCommand.js +7 -26
- package/dist/hive/Commands/GetFunctionsCommand.js.map +1 -1
- package/dist/hive/Commands/GetInfoCommand.d.ts +3 -14
- package/dist/hive/Commands/GetInfoCommand.js +7 -26
- package/dist/hive/Commands/GetInfoCommand.js.map +1 -1
- package/dist/hive/Commands/GetOperationStatusCommand.d.ts +3 -21
- package/dist/hive/Commands/GetOperationStatusCommand.js +7 -26
- package/dist/hive/Commands/GetOperationStatusCommand.js.map +1 -1
- package/dist/hive/Commands/GetPrimaryKeysCommand.d.ts +3 -13
- package/dist/hive/Commands/GetPrimaryKeysCommand.js +7 -26
- package/dist/hive/Commands/GetPrimaryKeysCommand.js.map +1 -1
- package/dist/hive/Commands/GetResultSetMetadataCommand.d.ts +3 -10
- package/dist/hive/Commands/GetResultSetMetadataCommand.js +7 -26
- package/dist/hive/Commands/GetResultSetMetadataCommand.js.map +1 -1
- package/dist/hive/Commands/GetSchemasCommand.d.ts +3 -12
- package/dist/hive/Commands/GetSchemasCommand.js +7 -26
- package/dist/hive/Commands/GetSchemasCommand.js.map +1 -1
- package/dist/hive/Commands/GetTableTypesCommand.d.ts +3 -10
- package/dist/hive/Commands/GetTableTypesCommand.js +7 -26
- package/dist/hive/Commands/GetTableTypesCommand.js.map +1 -1
- package/dist/hive/Commands/GetTablesCommand.d.ts +3 -14
- package/dist/hive/Commands/GetTablesCommand.js +7 -26
- package/dist/hive/Commands/GetTablesCommand.js.map +1 -1
- package/dist/hive/Commands/GetTypeInfoCommand.d.ts +3 -10
- package/dist/hive/Commands/GetTypeInfoCommand.js +7 -26
- package/dist/hive/Commands/GetTypeInfoCommand.js.map +1 -1
- package/dist/hive/Commands/OpenSessionCommand.d.ts +9 -28
- package/dist/hive/Commands/OpenSessionCommand.js +16 -26
- package/dist/hive/Commands/OpenSessionCommand.js.map +1 -1
- package/dist/hive/Commands/RenewDelegationTokenCommand.d.ts +3 -10
- package/dist/hive/Commands/RenewDelegationTokenCommand.js +7 -26
- package/dist/hive/Commands/RenewDelegationTokenCommand.js.map +1 -1
- package/dist/hive/HiveDriver.d.ts +24 -49
- package/dist/hive/HiveDriver.js +87 -99
- package/dist/hive/HiveDriver.js.map +1 -1
- package/dist/hive/Types/index.d.ts +7 -218
- package/dist/hive/Types/index.js +11 -2
- package/dist/hive/Types/index.js.map +1 -1
- package/dist/index.d.ts +16 -16
- package/dist/index.js +19 -51
- package/dist/index.js.map +1 -1
- package/dist/result/IOperationResult.d.ts +0 -2
- package/dist/result/JsonResult.d.ts +5 -8
- package/dist/result/JsonResult.js +81 -99
- package/dist/result/JsonResult.js.map +1 -1
- package/dist/result/NullResult.d.ts +1 -3
- package/dist/result/NullResult.js +4 -8
- package/dist/result/NullResult.js.map +1 -1
- package/dist/utils/buildUserAgentString.d.ts +1 -0
- package/dist/utils/buildUserAgentString.js +25 -0
- package/dist/utils/buildUserAgentString.js.map +1 -0
- package/dist/utils/definedOrError.d.ts +1 -0
- package/dist/utils/definedOrError.js +10 -0
- package/dist/utils/definedOrError.js.map +1 -0
- package/dist/utils/formatProgress.d.ts +9 -0
- package/dist/utils/formatProgress.js +24 -0
- package/dist/utils/formatProgress.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +37 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +28 -7
- package/thrift/TCLIService.d.ts +196 -0
- package/thrift/{gen-nodejs/TCLIService.js → TCLIService.js} +1 -397
- package/thrift/TCLIService_types.d.ts +947 -0
- package/thrift/{gen-nodejs/TCLIService_types.js → TCLIService_types.js} +2830 -516
- package/.gitattributes +0 -32
- package/CONTRIBUTING.md +0 -55
- package/dist/HiveClient.d.ts +0 -35
- package/dist/HiveClient.js +0 -156
- package/dist/HiveClient.js.map +0 -1
- package/dist/HiveOperation.d.ts +0 -65
- package/dist/HiveOperation.js +0 -190
- package/dist/HiveOperation.js.map +0 -1
- package/dist/HiveSession.d.ts +0 -30
- package/dist/HiveSession.js +0 -197
- package/dist/HiveSession.js.map +0 -1
- package/dist/contracts/IHiveClient.d.ts +0 -10
- package/dist/contracts/IHiveClient.js.map +0 -1
- package/dist/contracts/IHiveSession.js.map +0 -1
- package/dist/hive/Commands/GetQueryIdCommand.d.ts +0 -11
- package/dist/hive/Commands/GetQueryIdCommand.js +0 -34
- package/dist/hive/Commands/GetQueryIdCommand.js.map +0 -1
- package/dist/hive/Commands/SetClientInfoCommand.d.ts +0 -12
- package/dist/hive/Commands/SetClientInfoCommand.js +0 -34
- package/dist/hive/Commands/SetClientInfoCommand.js.map +0 -1
- package/dist/utils/GetResult.d.ts +0 -16
- package/dist/utils/GetResult.js +0 -38
- package/dist/utils/GetResult.js.map +0 -1
- package/dist/utils/HiveUtils.d.ts +0 -11
- package/dist/utils/HiveUtils.js +0 -39
- package/dist/utils/HiveUtils.js.map +0 -1
- package/dist/utils/ProgressUpdateTransformer.d.ts +0 -8
- package/dist/utils/ProgressUpdateTransformer.js +0 -33
- package/dist/utils/ProgressUpdateTransformer.js.map +0 -1
- package/dist/utils/WaitUntilReady.d.ts +0 -16
- package/dist/utils/WaitUntilReady.js +0 -120
- package/dist/utils/WaitUntilReady.js.map +0 -1
- package/docs/readme.md +0 -227
- package/docs/troubleshooting.md +0 -84
- package/examples/data_types.js +0 -173
- package/examples/repl +0 -106
- package/examples/session.js +0 -55
- package/examples/usage.js +0 -18
- package/nyc.config.js +0 -8
- package/tests/e2e/data_types.test.js +0 -353
- package/tests/e2e/utils/config.js +0 -20
- package/tests/e2e/utils/logger.js +0 -22
- package/tests/unit/HiveClient.test.js +0 -153
- package/tests/unit/HiveOperation.test.js +0 -340
- package/tests/unit/HiveSession.test.js +0 -146
- package/tests/unit/connection/auth/PlainHttpAuthentication.test.js +0 -44
- package/tests/unit/connection/connections/HttpConnection.test.js +0 -141
- package/tests/unit/dto/InfoValue.test.js +0 -50
- package/tests/unit/factory/StatusFactory.test.js +0 -62
- package/tests/unit/hive/HiveDriver.test.js +0 -115
- package/tests/unit/hive/commands/CancelDelegationTokenCommand.test.js +0 -43
- package/tests/unit/hive/commands/CancelOperationCommand.test.js +0 -45
- package/tests/unit/hive/commands/CloseOperationCommand.test.js +0 -45
- package/tests/unit/hive/commands/CloseSessionCommand.test.js +0 -38
- package/tests/unit/hive/commands/ExecuteStatementCommand.test.js +0 -54
- package/tests/unit/hive/commands/FetchResultsCommand.test.js +0 -59
- package/tests/unit/hive/commands/GetCatalogsCommand.test.js +0 -50
- package/tests/unit/hive/commands/GetColumnsCommand.test.js +0 -50
- package/tests/unit/hive/commands/GetCrossReferenceCommand.test.js +0 -56
- package/tests/unit/hive/commands/GetDelegationTokenCommand.test.js +0 -45
- package/tests/unit/hive/commands/GetFunctionsCommand.test.js +0 -50
- package/tests/unit/hive/commands/GetInfoCommand.test.js +0 -51
- package/tests/unit/hive/commands/GetOperationStatusCommand.test.js +0 -63
- package/tests/unit/hive/commands/GetPrimaryKeysCommand.test.js +0 -50
- package/tests/unit/hive/commands/GetQueryIdCommand.test.js +0 -42
- package/tests/unit/hive/commands/GetResultSetMetadataCommand.test.js +0 -54
- package/tests/unit/hive/commands/GetSchemasCommand.test.js +0 -52
- package/tests/unit/hive/commands/GetTableTypesCommand.test.js +0 -50
- package/tests/unit/hive/commands/GetTablesCommand.test.js +0 -54
- package/tests/unit/hive/commands/GetTypeInfoCommand.test.js +0 -50
- package/tests/unit/hive/commands/OpenSessionCommand.test.js +0 -43
- package/tests/unit/hive/commands/RenewDelegationTokenCommand.test.js +0 -43
- package/tests/unit/hive/commands/SetClientInfoCommand.test.js +0 -45
- package/tests/unit/result/JsonResult.test.js +0 -295
- package/tests/unit/utils/GetResult.test.js +0 -30
- package/tests/unit/utils/HiveUtils.test.js +0 -60
- package/tests/unit/utils/ProgressUpdateTransformer.test.js +0 -28
- package/tests/unit/utils/WaitUntilReady.test.js +0 -105
- package/thrift/TCLIService.thrift +0 -1299
- package/tsconfig.json +0 -13
package/.gitattributes
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Set the default behavior, in case users don't have core.autocrlf set
|
|
2
|
-
* text=auto
|
|
3
|
-
|
|
4
|
-
# Files that should always be normalized and converted to native line
|
|
5
|
-
# endings on checkout.
|
|
6
|
-
|
|
7
|
-
*.js text
|
|
8
|
-
*.json text
|
|
9
|
-
*.yml text
|
|
10
|
-
*.xml text
|
|
11
|
-
*.ts text
|
|
12
|
-
*.md text
|
|
13
|
-
*.sh text eol=lf
|
|
14
|
-
*.conf text
|
|
15
|
-
*.thrift text
|
|
16
|
-
*.properties text
|
|
17
|
-
LICENSE text
|
|
18
|
-
Makefile text
|
|
19
|
-
Dockerfile* text
|
|
20
|
-
|
|
21
|
-
# Files that are truly binary and should not be modified
|
|
22
|
-
*.pem binary
|
|
23
|
-
*.crt binary
|
|
24
|
-
*.key binary
|
|
25
|
-
*.jks binary
|
|
26
|
-
*.p12 binary
|
|
27
|
-
|
|
28
|
-
# Exclude files from exporting
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
.gitattributes export-ignore
|
|
32
|
-
.gitignore export-ignore
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
To contribute to this repository fork it and send pull request.
|
|
4
|
-
|
|
5
|
-
## Project structure
|
|
6
|
-
|
|
7
|
-
- *lib/* - source code written on TypeScript
|
|
8
|
-
- *dist/* - compiled source code and must not be changed manually
|
|
9
|
-
- *tests/unit/* - unit tests
|
|
10
|
-
- *tests/e2e/* - end-to-end tests
|
|
11
|
-
- *index.js* - entry point of the driver
|
|
12
|
-
|
|
13
|
-
## Run the project
|
|
14
|
-
|
|
15
|
-
Hot compiling of TypeScript
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run watch
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Build the project
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm run build
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Tests:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm run test
|
|
31
|
-
|
|
32
|
-
npm run e2e
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Commit messages
|
|
36
|
-
|
|
37
|
-
Please follow the [Angular commit style][angular-commit-style].
|
|
38
|
-
|
|
39
|
-
To make it easy, just run the command
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm run commit
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Pull Request Process
|
|
46
|
-
|
|
47
|
-
1. Update the README.md or similar documentation with details of changes you
|
|
48
|
-
wish to make, if applicable.
|
|
49
|
-
2. Add any appropriate tests.
|
|
50
|
-
3. Make your code or other changes.
|
|
51
|
-
4. Review guidelines such as
|
|
52
|
-
[How to write the perfect pull request][github-perfect-pr], thanks!
|
|
53
|
-
|
|
54
|
-
[angular-commit-style]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits
|
|
55
|
-
[github-perfect-pr]: https://blog.github.com/2015-01-21-how-to-write-the-perfect-pull-request/
|
package/dist/HiveClient.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ThriftClient, TCLIServiceTypes } from './hive/Types/';
|
|
3
|
-
import IHiveClient from './contracts/IHiveClient';
|
|
4
|
-
import { OpenSessionRequest } from './hive/Commands/OpenSessionCommand';
|
|
5
|
-
import IHiveSession from './contracts/IHiveSession';
|
|
6
|
-
import IConnectionProvider from './connection/contracts/IConnectionProvider';
|
|
7
|
-
import IAuthentication from './connection/contracts/IAuthentication';
|
|
8
|
-
import IConnectionOptions from './connection/contracts/IConnectionOptions';
|
|
9
|
-
import { EventEmitter } from 'events';
|
|
10
|
-
export default class HiveClient extends EventEmitter implements IHiveClient {
|
|
11
|
-
private TCLIService;
|
|
12
|
-
private TCLIService_types;
|
|
13
|
-
private client;
|
|
14
|
-
private connection;
|
|
15
|
-
private statusFactory;
|
|
16
|
-
private connectionProvider;
|
|
17
|
-
private authProvider;
|
|
18
|
-
private thrift;
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param TCLIService generated from TCLIService.thrift (https://github.com/apache/hive/blob/master/service-rpc/if/TCLIService.thrift)
|
|
22
|
-
* @param TCLIService_types object generated from TCLIService.thrift
|
|
23
|
-
*/
|
|
24
|
-
constructor(TCLIService: object, TCLIService_types: TCLIServiceTypes);
|
|
25
|
-
connect(options: IConnectionOptions, connectionProvider?: IConnectionProvider, authProvider?: IAuthentication): Promise<HiveClient>;
|
|
26
|
-
/**
|
|
27
|
-
* Starts new session
|
|
28
|
-
*
|
|
29
|
-
* @param request
|
|
30
|
-
* @throws {StatusError}
|
|
31
|
-
*/
|
|
32
|
-
openSession(request: OpenSessionRequest): Promise<IHiveSession>;
|
|
33
|
-
getClient(): ThriftClient;
|
|
34
|
-
close(): void;
|
|
35
|
-
}
|
package/dist/HiveClient.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
var thrift = require('thrift');
|
|
58
|
-
var HiveDriver_1 = __importDefault(require("./hive/HiveDriver"));
|
|
59
|
-
var HiveSession_1 = __importDefault(require("./HiveSession"));
|
|
60
|
-
var NoSaslAuthentication_1 = __importDefault(require("./connection/auth/NoSaslAuthentication"));
|
|
61
|
-
var HttpConnection_1 = __importDefault(require("./connection/connections/HttpConnection"));
|
|
62
|
-
var events_1 = require("events");
|
|
63
|
-
var StatusFactory_1 = __importDefault(require("./factory/StatusFactory"));
|
|
64
|
-
var HiveDriverError_1 = __importDefault(require("./errors/HiveDriverError"));
|
|
65
|
-
var HiveClient = /** @class */ (function (_super) {
|
|
66
|
-
__extends(HiveClient, _super);
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @param TCLIService generated from TCLIService.thrift (https://github.com/apache/hive/blob/master/service-rpc/if/TCLIService.thrift)
|
|
70
|
-
* @param TCLIService_types object generated from TCLIService.thrift
|
|
71
|
-
*/
|
|
72
|
-
function HiveClient(TCLIService, TCLIService_types) {
|
|
73
|
-
var _this = _super.call(this) || this;
|
|
74
|
-
_this.thrift = thrift;
|
|
75
|
-
_this.TCLIService = TCLIService;
|
|
76
|
-
_this.TCLIService_types = TCLIService_types;
|
|
77
|
-
_this.connectionProvider = new HttpConnection_1.default();
|
|
78
|
-
_this.authProvider = new NoSaslAuthentication_1.default();
|
|
79
|
-
_this.statusFactory = new StatusFactory_1.default(TCLIService_types);
|
|
80
|
-
_this.client = null;
|
|
81
|
-
_this.connection = null;
|
|
82
|
-
return _this;
|
|
83
|
-
}
|
|
84
|
-
HiveClient.prototype.connect = function (options, connectionProvider, authProvider) {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var _a;
|
|
87
|
-
var _this = this;
|
|
88
|
-
return __generator(this, function (_b) {
|
|
89
|
-
switch (_b.label) {
|
|
90
|
-
case 0:
|
|
91
|
-
if (connectionProvider) {
|
|
92
|
-
this.connectionProvider = connectionProvider;
|
|
93
|
-
}
|
|
94
|
-
if (authProvider) {
|
|
95
|
-
this.authProvider = authProvider;
|
|
96
|
-
}
|
|
97
|
-
_a = this;
|
|
98
|
-
return [4 /*yield*/, this.connectionProvider.connect(options, this.authProvider)];
|
|
99
|
-
case 1:
|
|
100
|
-
_a.connection = _b.sent();
|
|
101
|
-
this.client = this.thrift.createClient(this.TCLIService, this.connection.getConnection());
|
|
102
|
-
this.connection.getConnection().on('error', function (error) {
|
|
103
|
-
_this.emit('error', error);
|
|
104
|
-
});
|
|
105
|
-
this.connection.getConnection().on('reconnecting', function (params) {
|
|
106
|
-
_this.emit('reconnecting', params);
|
|
107
|
-
});
|
|
108
|
-
this.connection.getConnection().on('close', function () {
|
|
109
|
-
_this.emit('close');
|
|
110
|
-
});
|
|
111
|
-
this.connection.getConnection().on('timeout', function () {
|
|
112
|
-
_this.emit('timeout');
|
|
113
|
-
});
|
|
114
|
-
return [2 /*return*/, this];
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Starts new session
|
|
121
|
-
*
|
|
122
|
-
* @param request
|
|
123
|
-
* @throws {StatusError}
|
|
124
|
-
*/
|
|
125
|
-
HiveClient.prototype.openSession = function (request) {
|
|
126
|
-
var _this = this;
|
|
127
|
-
var _a;
|
|
128
|
-
if (!((_a = this.connection) === null || _a === void 0 ? void 0 : _a.isConnected())) {
|
|
129
|
-
return Promise.reject(new HiveDriverError_1.default('HiveClient: connection is lost'));
|
|
130
|
-
}
|
|
131
|
-
var driver = new HiveDriver_1.default(this.TCLIService_types, this.getClient());
|
|
132
|
-
return driver.openSession(request).then(function (response) {
|
|
133
|
-
_this.statusFactory.create(response.status);
|
|
134
|
-
var session = new HiveSession_1.default(driver, response.sessionHandle, _this.TCLIService_types);
|
|
135
|
-
return session;
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
HiveClient.prototype.getClient = function () {
|
|
139
|
-
if (!this.client) {
|
|
140
|
-
throw new HiveDriverError_1.default('HiveClient: client is not initialized');
|
|
141
|
-
}
|
|
142
|
-
return this.client;
|
|
143
|
-
};
|
|
144
|
-
HiveClient.prototype.close = function () {
|
|
145
|
-
if (!this.connection) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
var thriftConnection = this.connection.getConnection();
|
|
149
|
-
if (typeof thriftConnection.end === 'function') {
|
|
150
|
-
this.connection.getConnection().end();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
return HiveClient;
|
|
154
|
-
}(events_1.EventEmitter));
|
|
155
|
-
exports.default = HiveClient;
|
|
156
|
-
//# sourceMappingURL=HiveClient.js.map
|
package/dist/HiveClient.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HiveClient.js","sourceRoot":"","sources":["../lib/HiveClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAC,iBAAiB,CACzB,CAAC;YAEF,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,8BAAS,GAAT;QACI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,MAAM,IAAI,yBAAe,CAAC,uCAAuC,CAAC,CAAC;SACtE;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,0BAAK,GAAL;QACI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,OAAO;SACV;QAED,IAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAA;QAExD,IAAI,OAAO,gBAAgB,CAAC,GAAG,KAAK,UAAU,EAAE;YAC5C,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,CAAC;SACzC;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AArHD,CAAwC,qBAAY,GAqHnD"}
|
package/dist/HiveOperation.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import IOperation from "./contracts/IOperation";
|
|
2
|
-
import HiveDriver from "./hive/HiveDriver";
|
|
3
|
-
import { OperationHandle, TCLIServiceTypes, TableSchema, RowSet } from "./hive/Types";
|
|
4
|
-
import Status from "./dto/Status";
|
|
5
|
-
import { GetOperationStatusResponse } from "./hive/Commands/GetOperationStatusCommand";
|
|
6
|
-
export default class HiveOperation implements IOperation {
|
|
7
|
-
private driver;
|
|
8
|
-
private operationHandle;
|
|
9
|
-
private TCLIService_type;
|
|
10
|
-
private schema;
|
|
11
|
-
private data;
|
|
12
|
-
private statusFactory;
|
|
13
|
-
private maxRows;
|
|
14
|
-
private fetchType;
|
|
15
|
-
private _hasMoreRows;
|
|
16
|
-
private state;
|
|
17
|
-
private hasResultSet;
|
|
18
|
-
constructor(driver: HiveDriver, operationHandle: OperationHandle, TCLIService_type: TCLIServiceTypes);
|
|
19
|
-
/**
|
|
20
|
-
* Fetches result and schema from operation
|
|
21
|
-
* @throws {StatusError}
|
|
22
|
-
*/
|
|
23
|
-
fetch(): Promise<Status>;
|
|
24
|
-
/**
|
|
25
|
-
* Requests operation status
|
|
26
|
-
* @param progress
|
|
27
|
-
* @throws {StatusError}
|
|
28
|
-
*/
|
|
29
|
-
status(progress?: boolean): Promise<GetOperationStatusResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* Cancels operation
|
|
32
|
-
* @throws {StatusError}
|
|
33
|
-
*/
|
|
34
|
-
cancel(): Promise<Status>;
|
|
35
|
-
/**
|
|
36
|
-
* Closes operation
|
|
37
|
-
* @throws {StatusError}
|
|
38
|
-
*/
|
|
39
|
-
close(): Promise<Status>;
|
|
40
|
-
finished(): boolean;
|
|
41
|
-
hasMoreRows(): boolean;
|
|
42
|
-
setMaxRows(maxRows: number): void;
|
|
43
|
-
setFetchType(fetchType: number): void;
|
|
44
|
-
getSchema(): TableSchema | null;
|
|
45
|
-
getData(): Array<RowSet>;
|
|
46
|
-
getQueryId(): Promise<string>;
|
|
47
|
-
/**
|
|
48
|
-
* Resets `this.data` buffer.
|
|
49
|
-
* Needs to be called when working with massive data.
|
|
50
|
-
*/
|
|
51
|
-
flush(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves schema
|
|
54
|
-
* @throws {StatusError}
|
|
55
|
-
*/
|
|
56
|
-
private initializeSchema;
|
|
57
|
-
private firstFetch;
|
|
58
|
-
private nextFetch;
|
|
59
|
-
/**
|
|
60
|
-
* @param response
|
|
61
|
-
* @throws {StatusError}
|
|
62
|
-
*/
|
|
63
|
-
private processFetchResponse;
|
|
64
|
-
private checkIfOperationHasMoreRows;
|
|
65
|
-
}
|
package/dist/HiveOperation.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var Types_1 = require("./hive/Types");
|
|
7
|
-
var StatusFactory_1 = __importDefault(require("./factory/StatusFactory"));
|
|
8
|
-
var HiveOperation = /** @class */ (function () {
|
|
9
|
-
function HiveOperation(driver, operationHandle, TCLIService_type) {
|
|
10
|
-
this.maxRows = 100;
|
|
11
|
-
this.fetchType = 0;
|
|
12
|
-
this._hasMoreRows = false;
|
|
13
|
-
this.hasResultSet = false;
|
|
14
|
-
this.driver = driver;
|
|
15
|
-
this.operationHandle = operationHandle;
|
|
16
|
-
this.hasResultSet = operationHandle.hasResultSet;
|
|
17
|
-
this.TCLIService_type = TCLIService_type;
|
|
18
|
-
this.statusFactory = new StatusFactory_1.default(TCLIService_type);
|
|
19
|
-
this.state = TCLIService_type.TOperationState.INITIALIZED_STATE;
|
|
20
|
-
this.schema = null;
|
|
21
|
-
this.data = [];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Fetches result and schema from operation
|
|
25
|
-
* @throws {StatusError}
|
|
26
|
-
*/
|
|
27
|
-
HiveOperation.prototype.fetch = function () {
|
|
28
|
-
var _this = this;
|
|
29
|
-
if (!this.hasResultSet) {
|
|
30
|
-
return Promise.resolve(this.statusFactory.create({
|
|
31
|
-
statusCode: this.TCLIService_type.TStatusCode.SUCCESS_STATUS
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
if (!this.finished()) {
|
|
35
|
-
return Promise.resolve(this.statusFactory.create({
|
|
36
|
-
statusCode: this.TCLIService_type.TStatusCode.STILL_EXECUTING_STATUS
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
if (this.schema === null) {
|
|
40
|
-
return this.initializeSchema().then(function (schema) {
|
|
41
|
-
_this.schema = schema;
|
|
42
|
-
return _this.firstFetch();
|
|
43
|
-
}).then(function (response) { return _this.processFetchResponse(response); });
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return this.nextFetch().then(function (response) { return _this.processFetchResponse(response); });
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Requests operation status
|
|
51
|
-
* @param progress
|
|
52
|
-
* @throws {StatusError}
|
|
53
|
-
*/
|
|
54
|
-
HiveOperation.prototype.status = function (progress) {
|
|
55
|
-
var _this = this;
|
|
56
|
-
if (progress === void 0) { progress = false; }
|
|
57
|
-
return this.driver.getOperationStatus({
|
|
58
|
-
operationHandle: this.operationHandle,
|
|
59
|
-
getProgressUpdate: progress
|
|
60
|
-
}).then(function (response) {
|
|
61
|
-
var _a;
|
|
62
|
-
_this.statusFactory.create(response.status);
|
|
63
|
-
_this.state = (_a = response.operationState) !== null && _a !== void 0 ? _a : _this.state;
|
|
64
|
-
if (typeof response.hasResultSet === 'boolean') {
|
|
65
|
-
_this.hasResultSet = response.hasResultSet;
|
|
66
|
-
}
|
|
67
|
-
return response;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Cancels operation
|
|
72
|
-
* @throws {StatusError}
|
|
73
|
-
*/
|
|
74
|
-
HiveOperation.prototype.cancel = function () {
|
|
75
|
-
var _this = this;
|
|
76
|
-
return this.driver.cancelOperation({
|
|
77
|
-
operationHandle: this.operationHandle
|
|
78
|
-
}).then(function (response) {
|
|
79
|
-
return _this.statusFactory.create(response.status);
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Closes operation
|
|
84
|
-
* @throws {StatusError}
|
|
85
|
-
*/
|
|
86
|
-
HiveOperation.prototype.close = function () {
|
|
87
|
-
var _this = this;
|
|
88
|
-
return this.driver.closeOperation({
|
|
89
|
-
operationHandle: this.operationHandle
|
|
90
|
-
}).then(function (response) {
|
|
91
|
-
return _this.statusFactory.create(response.status);
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
HiveOperation.prototype.finished = function () {
|
|
95
|
-
return this.state === this.TCLIService_type.TOperationState.FINISHED_STATE;
|
|
96
|
-
};
|
|
97
|
-
HiveOperation.prototype.hasMoreRows = function () {
|
|
98
|
-
return this._hasMoreRows;
|
|
99
|
-
};
|
|
100
|
-
HiveOperation.prototype.setMaxRows = function (maxRows) {
|
|
101
|
-
this.maxRows = maxRows;
|
|
102
|
-
};
|
|
103
|
-
HiveOperation.prototype.setFetchType = function (fetchType) {
|
|
104
|
-
this.fetchType = fetchType;
|
|
105
|
-
};
|
|
106
|
-
HiveOperation.prototype.getSchema = function () {
|
|
107
|
-
return this.schema;
|
|
108
|
-
};
|
|
109
|
-
HiveOperation.prototype.getData = function () {
|
|
110
|
-
return this.data;
|
|
111
|
-
};
|
|
112
|
-
HiveOperation.prototype.getQueryId = function () {
|
|
113
|
-
return this.driver.getQueryId({
|
|
114
|
-
operationHandle: this.operationHandle
|
|
115
|
-
}).then(function (response) {
|
|
116
|
-
return response.queryId;
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Resets `this.data` buffer.
|
|
121
|
-
* Needs to be called when working with massive data.
|
|
122
|
-
*/
|
|
123
|
-
HiveOperation.prototype.flush = function () {
|
|
124
|
-
this.data = [];
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Retrieves schema
|
|
128
|
-
* @throws {StatusError}
|
|
129
|
-
*/
|
|
130
|
-
HiveOperation.prototype.initializeSchema = function () {
|
|
131
|
-
var _this = this;
|
|
132
|
-
return this.driver.getResultSetMetadata({
|
|
133
|
-
operationHandle: this.operationHandle
|
|
134
|
-
}).then(function (schema) {
|
|
135
|
-
_this.statusFactory.create(schema.status);
|
|
136
|
-
return schema.schema;
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
HiveOperation.prototype.firstFetch = function () {
|
|
140
|
-
return this.driver.fetchResults({
|
|
141
|
-
operationHandle: this.operationHandle,
|
|
142
|
-
orientation: this.TCLIService_type.TFetchOrientation.FETCH_FIRST,
|
|
143
|
-
maxRows: this.maxRows,
|
|
144
|
-
fetchType: this.fetchType,
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
HiveOperation.prototype.nextFetch = function () {
|
|
148
|
-
return this.driver.fetchResults({
|
|
149
|
-
operationHandle: this.operationHandle,
|
|
150
|
-
orientation: this.TCLIService_type.TFetchOrientation.FETCH_NEXT,
|
|
151
|
-
maxRows: this.maxRows,
|
|
152
|
-
fetchType: this.fetchType,
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* @param response
|
|
157
|
-
* @throws {StatusError}
|
|
158
|
-
*/
|
|
159
|
-
HiveOperation.prototype.processFetchResponse = function (response) {
|
|
160
|
-
var status = this.statusFactory.create(response.status);
|
|
161
|
-
this._hasMoreRows = this.checkIfOperationHasMoreRows(response);
|
|
162
|
-
if (response.results) {
|
|
163
|
-
this.data.push(response.results);
|
|
164
|
-
}
|
|
165
|
-
return status;
|
|
166
|
-
};
|
|
167
|
-
HiveOperation.prototype.checkIfOperationHasMoreRows = function (response) {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
if (response.hasMoreRows) {
|
|
170
|
-
return true;
|
|
171
|
-
}
|
|
172
|
-
var columns = ((_a = response.results) === null || _a === void 0 ? void 0 : _a.columns) || [];
|
|
173
|
-
if (!columns.length) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
var column = columns[0];
|
|
177
|
-
var columnValue = column[Types_1.ColumnCode.binaryVal]
|
|
178
|
-
|| column[Types_1.ColumnCode.boolVal]
|
|
179
|
-
|| column[Types_1.ColumnCode.byteVal]
|
|
180
|
-
|| column[Types_1.ColumnCode.doubleVal]
|
|
181
|
-
|| column[Types_1.ColumnCode.i16Val]
|
|
182
|
-
|| column[Types_1.ColumnCode.i32Val]
|
|
183
|
-
|| column[Types_1.ColumnCode.i64Val]
|
|
184
|
-
|| column[Types_1.ColumnCode.stringVal];
|
|
185
|
-
return ((_b = columnValue === null || columnValue === void 0 ? void 0 : columnValue.values) === null || _b === void 0 ? void 0 : _b.length) > 0;
|
|
186
|
-
};
|
|
187
|
-
return HiveOperation;
|
|
188
|
-
}());
|
|
189
|
-
exports.default = HiveOperation;
|
|
190
|
-
//# sourceMappingURL=HiveOperation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HiveOperation.js","sourceRoot":"","sources":["../lib/HiveOperation.ts"],"names":[],"mappings":";;;;;AAEA,sCAA0G;AAK1G,0EAAoD;AAGpD;IAeI,uBACI,MAAkB,EAClB,eAAgC,EAChC,gBAAkC;QAV9B,YAAO,GAAW,GAAG,CAAC;QACtB,cAAS,GAAW,CAAC,CAAC;QAEtB,iBAAY,GAAY,KAAK,CAAC;QAE9B,iBAAY,GAAY,KAAK,CAAC;QAOlC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC;QACjD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,CAAC,gBAAgB,CAAC,CAAC;QACzD,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,eAAe,CAAC,iBAAiB,CAAC;QAEhE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,6BAAK,GAAL;QAAA,iBA8BC;QA7BG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACpB,OAAO,OAAO,CAAC,OAAO,CAClB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBACtB,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,cAAc;aAC/D,CAAC,CACL,CAAC;SACL;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;YAClB,OAAO,OAAO,CAAC,OAAO,CAClB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBACtB,UAAU,EAAE,IAAI,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CAAC,OAAO,CAAC,CAAC;SACpC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,mDAA2B,GAAnC,UAAoC,QAA8B;;QAC9D,IAAI,QAAQ,CAAC,WAAW,EAAE;YACtB,OAAO,IAAI,CAAC;SACf;QAED,IAAM,OAAO,GAAG,CAAA,MAAA,QAAQ,CAAC,OAAO,0CAAE,OAAO,KAAI,EAAE,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACjB,OAAO,KAAK,CAAC;SAChB;QAED,IAAM,MAAM,GAAW,OAAO,CAAC,CAAC,CAAC,CAAC;QAElC,IAAM,WAAW,GAAG,MAAM,CAAC,kBAAU,CAAC,SAAS,CAAC;eACzC,MAAM,CAAC,kBAAU,CAAC,OAAO,CAAC;eAC1B,MAAM,CAAC,kBAAU,CAAC,OAAO,CAAC;eAC1B,MAAM,CAAC,kBAAU,CAAC,SAAS,CAAC;eAC5B,MAAM,CAAC,kBAAU,CAAC,MAAM,CAAC;eACzB,MAAM,CAAC,kBAAU,CAAC,MAAM,CAAC;eACzB,MAAM,CAAC,kBAAU,CAAC,MAAM,CAAC;eACzB,MAAM,CAAC,kBAAU,CAAC,SAAS,CAAC,CAAC;QAEpC,OAAO,CAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,0CAAE,MAAM,IAAG,CAAC,CAAC;IAC3C,CAAC;IACL,oBAAC;AAAD,CAAC,AAjOD,IAiOC"}
|
package/dist/HiveSession.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import HiveDriver from "./hive/HiveDriver";
|
|
2
|
-
import IHiveSession, { ExecuteStatementOptions, SchemasRequest, TablesRequest, ColumnRequest, PrimaryKeysRequest, FunctionNameRequest, CrossReferenceRequest } from './contracts/IHiveSession';
|
|
3
|
-
import { SessionHandle, TCLIServiceTypes } from "./hive/Types";
|
|
4
|
-
import IOperation from "./contracts/IOperation";
|
|
5
|
-
import Status from "./dto/Status";
|
|
6
|
-
import InfoValue from "./dto/InfoValue";
|
|
7
|
-
export default class HiveSession implements IHiveSession {
|
|
8
|
-
private driver;
|
|
9
|
-
private sessionHandle;
|
|
10
|
-
private TCLIService_types;
|
|
11
|
-
private statusFactory;
|
|
12
|
-
constructor(driver: HiveDriver, sessionHandle: SessionHandle, TCLIService_types: TCLIServiceTypes);
|
|
13
|
-
getInfo(infoType: number): Promise<InfoValue>;
|
|
14
|
-
executeStatement(statement: string, options?: ExecuteStatementOptions): Promise<IOperation>;
|
|
15
|
-
getTypeInfo(): Promise<IOperation>;
|
|
16
|
-
getCatalogs(): Promise<IOperation>;
|
|
17
|
-
getSchemas(request: SchemasRequest): Promise<IOperation>;
|
|
18
|
-
getTables(request: TablesRequest): Promise<IOperation>;
|
|
19
|
-
getTableTypes(): Promise<IOperation>;
|
|
20
|
-
getColumns(request: ColumnRequest): Promise<IOperation>;
|
|
21
|
-
getFunctions(request: FunctionNameRequest): Promise<IOperation>;
|
|
22
|
-
getPrimaryKeys(request: PrimaryKeysRequest): Promise<IOperation>;
|
|
23
|
-
getCrossReference(request: CrossReferenceRequest): Promise<IOperation>;
|
|
24
|
-
getDelegationToken(owner: string, renewer: string): Promise<string>;
|
|
25
|
-
renewDelegationToken(token: string): Promise<Status>;
|
|
26
|
-
cancelDelegationToken(token: string): Promise<Status>;
|
|
27
|
-
close(): Promise<Status>;
|
|
28
|
-
private createOperation;
|
|
29
|
-
private assertStatus;
|
|
30
|
-
}
|