-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathHiveDriver.ts
255 lines (203 loc) · 9.39 KB
/
HiveDriver.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import { ThriftClient, TCLIServiceTypes } from './Types/'
import OpenSessionCommand, { OpenSessionRequest, OpenSessionResponse } from "./Commands/OpenSessionCommand";
import CloseSessionCommand, { CloseSessionRequest, CloseSessionResponse } from "./Commands/CloseSessionCommand";
import ExecuteStatementCommand, { ExecuteStatementResponse, ExecuteStatementRequest } from "./Commands/ExecuteStatementCommand";
import GetResultSetMetadataCommand, { GetResultSetMetadataRequest, GetResultSetMetadataResponse } from "./Commands/GetResultSetMetadataCommand";
import FetchResultsCommand, { FetchResultsRequest, FetchResultsResponse } from "./Commands/FetchResultsCommand";
import GetInfoCommand, { GetInfoRequest, GetInfoResponse } from "./Commands/GetInfoCommand";
import GetTypeInfoCommand, { GetTypeInfoRequest, GetTypeInfoResponse } from "./Commands/GetTypeInfoCommand";
import GetCatalogsCommand, { GetCatalogsRequest, GetCatalogsResponse } from "./Commands/GetCatalogsCommand";
import GetSchemasCommand, { GetSchemasRequest, GetSchemasResponse } from "./Commands/GetSchemasCommand";
import GetTablesCommand, { GetTablesRequest, GetTablesResponse } from "./Commands/GetTablesCommand";
import GetTableTypesCommand, { GetTableTypesRequest, GetTableTypesResponse } from "./Commands/GetTableTypesCommand";
import GetColumnsCommand, { GetColumnsRequest, GetColumnsResponse } from "./Commands/GetColumnsCommand";
import GetFunctionsCommand, { GetFunctionsRequest, GetFunctionsResponse } from "./Commands/GetFunctionsCommand";
import GetPrimaryKeysCommand, { GetPrimaryKeysRequest, GetPrimaryKeysResponse } from "./Commands/GetPrimaryKeysCommand";
import GetCrossReferenceCommand, { GetCrossReferenceRequest, GetCrossReferenceResponse } from "./Commands/GetCrossReferenceCommand";
import GetOperationStatusCommand, { GetOperationStatusRequest, GetOperationStatusResponse } from "./Commands/GetOperationStatusCommand";
import CancelOperationCommand, { CancelOperationRequest, CancelOperationResponse } from "./Commands/CancelOperationCommand";
import CloseOperationCommand, { CloseOperationRequest, CloseOperationResponse } from "./Commands/CloseOperationCommand";
import GetDelegationTokenCommand, { GetDelegationTokenRequest, GetDelegationTokenResponse } from "./Commands/GetDelegationTokenCommand";
import CancelDelegationTokenCommand, { CancelDelegationTokenRequest, CancelDelegationTokenResponse } from "./Commands/CancelDelegationTokenCommand";
import RenewDelegationTokenCommand, { RenewDelegationTokenRequest, RenewDelegationTokenResponse } from "./Commands/RenewDelegationTokenCommand";
import GetQueryIdCommand, { GetQueryIdRequest, GetQueryIdResponse } from "./Commands/GetQueryIdCommand";
import SetClientInfoCommand, { SetClientInfoRequest, SetClientInfoResponse } from "./Commands/SetClientInfoCommand";
import UploadDataCommand, { UploadDataRequest, UploadDataResponse } from './Commands/UploadDataCommand';
import DownloadDataCommand, { DownloadDataRequest, DownloadDataResponse } from './Commands/DownloadDataCommand';
export default class HiveDriver {
private TCLIService_types: TCLIServiceTypes;
private client: ThriftClient;
constructor(TCLIService_types: TCLIServiceTypes, client: ThriftClient) {
this.TCLIService_types = TCLIService_types;
this.client = client;
}
openSession(request: OpenSessionRequest): Promise<OpenSessionResponse> {
const action = new OpenSessionCommand(
this.client,
this.TCLIService_types
);
return action.execute(request);
}
closeSession(request: CloseSessionRequest): Promise<CloseSessionResponse> {
const command = new CloseSessionCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
executeStatement(request: ExecuteStatementRequest): Promise<ExecuteStatementResponse> {
const command = new ExecuteStatementCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getResultSetMetadata(request: GetResultSetMetadataRequest): Promise<GetResultSetMetadataResponse> {
const command = new GetResultSetMetadataCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
fetchResults(request: FetchResultsRequest): Promise<FetchResultsResponse> {
const command = new FetchResultsCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getInfo(request: GetInfoRequest): Promise<GetInfoResponse> {
const command = new GetInfoCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getTypeInfo(request: GetTypeInfoRequest): Promise<GetTypeInfoResponse> {
const command = new GetTypeInfoCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getCatalogs(request: GetCatalogsRequest): Promise<GetCatalogsResponse> {
const command = new GetCatalogsCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getSchemas(request: GetSchemasRequest): Promise<GetSchemasResponse> {
const command = new GetSchemasCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getTables(request: GetTablesRequest): Promise<GetTablesResponse> {
const command = new GetTablesCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getTableTypes(request: GetTableTypesRequest): Promise<GetTableTypesResponse> {
const command = new GetTableTypesCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getColumns(request: GetColumnsRequest): Promise<GetColumnsResponse> {
const command = new GetColumnsCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getFunctions(request: GetFunctionsRequest): Promise<GetFunctionsResponse> {
const command = new GetFunctionsCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getPrimaryKeys(request: GetPrimaryKeysRequest): Promise<GetPrimaryKeysResponse> {
const command = new GetPrimaryKeysCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getCrossReference(request: GetCrossReferenceRequest): Promise<GetCrossReferenceResponse> {
const command = new GetCrossReferenceCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getOperationStatus(request: GetOperationStatusRequest): Promise<GetOperationStatusResponse> {
const command = new GetOperationStatusCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
cancelOperation(request: CancelOperationRequest): Promise<CancelOperationResponse> {
const command = new CancelOperationCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
closeOperation(request: CloseOperationRequest): Promise<CloseOperationResponse> {
const command = new CloseOperationCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getDelegationToken(request: GetDelegationTokenRequest): Promise<GetDelegationTokenResponse> {
const command = new GetDelegationTokenCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
cancelDelegationToken(request: CancelDelegationTokenRequest): Promise<CancelDelegationTokenResponse> {
const command = new CancelDelegationTokenCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
renewDelegationToken(request: RenewDelegationTokenRequest): Promise<RenewDelegationTokenResponse> {
const command = new RenewDelegationTokenCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
getQueryId(request: GetQueryIdRequest): Promise<GetQueryIdResponse> {
const command = new GetQueryIdCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
setClientInfo(request: SetClientInfoRequest): Promise<SetClientInfoResponse> {
const command = new SetClientInfoCommand(
this.client,
this.TCLIService_types
);
return command.execute(request);
}
uploadData(request: UploadDataRequest): Promise<UploadDataResponse> {
const command = new UploadDataCommand(this.client, this.TCLIService_types);
return command.execute(request);
}
downloadData(request: DownloadDataRequest): Promise<DownloadDataResponse> {
const command = new DownloadDataCommand(this.client, this.TCLIService_types);
return command.execute(request);
}
}