Skip to content

Commit 5575fa9

Browse files
committed
feat(hivesession.ts): added session methods
Added getCrossReference, getDelegationToken, renewDelegationToken and cancelDelegationToken methods
1 parent c0b702d commit 5575fa9

8 files changed

Lines changed: 267 additions & 43 deletions

File tree

dist/HiveSession.d.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import HiveDriver from "./hive/HiveDriver";
2-
import IHiveSession, { ExecuteStatementOptions, SchemasRequest, TablesRequest, ColumnRequest, PrimaryKeysRequest, FunctionNameRequest } from './contracts/IHiveSession';
2+
import IHiveSession, { ExecuteStatementOptions, SchemasRequest, TablesRequest, ColumnRequest, PrimaryKeysRequest, FunctionNameRequest, CrossReferenceRequest } from './contracts/IHiveSession';
33
import { SessionHandle, TCLIServiceTypes } from "./hive/Types";
44
import IOperation from "./contracts/IOperation";
55
import Status from "./dto/Status";
@@ -10,18 +10,7 @@ export default class HiveSession implements IHiveSession {
1010
private TCLIService_types;
1111
private statusFactory;
1212
constructor(driver: HiveDriver, sessionHandle: SessionHandle, TCLIService_types: TCLIServiceTypes);
13-
/**
14-
* Returns general information about the data source
15-
*
16-
* @param infoType one of the values TCLIService_types.TGetInfoType
17-
*/
1813
getInfo(infoType: number): Promise<InfoResult>;
19-
/**
20-
* Executes DDL/DML statements
21-
*
22-
* @param statement DDL/DDL statement
23-
* @param options
24-
*/
2514
executeStatement(statement: string, options?: ExecuteStatementOptions): Promise<IOperation>;
2615
getTypeInfo(): Promise<IOperation>;
2716
getCatalogs(): Promise<IOperation>;
@@ -31,6 +20,10 @@ export default class HiveSession implements IHiveSession {
3120
getColumns(request: ColumnRequest): Promise<IOperation>;
3221
getFunctions(request: FunctionNameRequest): Promise<IOperation>;
3322
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>;
3427
close(): Promise<Status>;
3528
private createOperation;
3629
private assertStatus;

dist/HiveSession.js

Lines changed: 46 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/HiveSession.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/contracts/IHiveSession.d.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,85 @@ export declare type PrimaryKeysRequest = {
4242
catalogName?: string;
4343
};
4444
export default interface IHiveSession {
45+
/**
46+
* Returns general information about the data source
47+
*
48+
* @param infoType one of the values TCLIService_types.TGetInfoType
49+
*/
4550
getInfo(infoType: number): Promise<InfoResult>;
51+
/**
52+
* Executes DDL/DML statements
53+
*
54+
* @param statement DDL/DML statement
55+
* @param options
56+
*/
4657
executeStatement(statement: string, options?: ExecuteStatementOptions): Promise<IOperation>;
58+
/**
59+
* Informataion about supported data types
60+
*/
4761
getTypeInfo(): Promise<IOperation>;
62+
/**
63+
* Get list of catalogs
64+
*/
4865
getCatalogs(): Promise<IOperation>;
66+
/**
67+
* Get list of databases
68+
*
69+
* @param request
70+
*/
4971
getSchemas(request: SchemasRequest): Promise<IOperation>;
72+
/**
73+
* Get list of tables
74+
*
75+
* @param request
76+
*/
5077
getTables(request: TablesRequest): Promise<IOperation>;
78+
/**
79+
* Get list of supported table types
80+
*/
5181
getTableTypes(): Promise<IOperation>;
82+
/**
83+
* Get full information about columns of the table
84+
*
85+
* @param request
86+
*/
5287
getColumns(request: ColumnRequest): Promise<IOperation>;
88+
/**
89+
* Get information about function
90+
*
91+
* @param request
92+
*/
5393
getFunctions(request: FunctionNameRequest): Promise<IOperation>;
94+
/**
95+
* Get primary keys of table
96+
*
97+
* @param request
98+
*/
5499
getPrimaryKeys(request: PrimaryKeysRequest): Promise<IOperation>;
100+
/**
101+
* Request information about foreign keys between two tables
102+
* @param request
103+
*/
104+
getCrossReference(request: CrossReferenceRequest): Promise<IOperation>;
105+
/**
106+
* Get delegation token. For kerberos auth only
107+
*
108+
* @param owner
109+
* @param renewer
110+
*/
111+
getDelegationToken(owner: string, renewer: string): Promise<string>;
112+
/**
113+
* Renew delegation token/ For kerberos auth only
114+
* @param token
115+
*/
116+
renewDelegationToken(token: string): Promise<Status>;
117+
/**
118+
* Cancel delegation token. For kerberos auth only
119+
* @param token
120+
*/
121+
cancelDelegationToken(token: string): Promise<Status>;
122+
/**
123+
* closes the session
124+
*/
55125
close(): Promise<Status>;
56126
}

dist/contracts/IOperation.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,42 @@ import { GetOperationStatusResponse } from "../hive/Commands/GetOperationStatusC
22
import Status from "../dto/Status";
33
import { TableSchema, RowSet } from "../hive/Types";
44
export default interface IOperation {
5+
/**
6+
* Fetch schema and a portion of data
7+
*/
58
fetch(): Promise<Status>;
9+
/**
10+
* Request status of operation
11+
*
12+
* @param progress
13+
*/
614
status(progress: boolean): Promise<GetOperationStatusResponse>;
15+
/**
16+
* Cancel operation
17+
*/
718
cancel(): Promise<Status>;
19+
/**
20+
* Close operation
21+
*/
822
close(): Promise<Status>;
23+
/**
24+
* Check if operation is finished
25+
*/
926
finished(): boolean;
27+
/**
28+
* Check if operation hasMoreRows
29+
*/
1030
hasMoreRows(): boolean;
31+
/**
32+
* Return retrieved schema
33+
*/
1134
getSchema(): TableSchema | null;
35+
/**
36+
* Return retrieved data
37+
*/
1238
getData(): Array<RowSet>;
39+
/**
40+
* Request queryId
41+
*/
1342
getQueryId(): Promise<string>;
1443
}

0 commit comments

Comments
 (0)