Skip to content

Commit

Permalink
Merge pull request #16 from lenchv/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
lenchv authored Feb 24, 2020
2 parents 18955d7 + 4adf0af commit 2a5f098
Show file tree
Hide file tree
Showing 19 changed files with 452 additions and 55 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

[0.1.1](https://github.com/lenchv/hive-driver/releases/tag/v0.1.1) 2020-02-21
[0.1.2](https://github.com/lenchv/hive-driver/releases/tag/v0.1.2) 2020-02-24

- Fixed setting response in OperationStateError

[0.1.1](https://github.com/lenchv/hive-driver/releases/tag/v0.1.1) 2020-02-23

- Changed version in package.json
- Fixed retrieving data when Hive does not return hasResultSet
Expand Down
1 change: 1 addition & 0 deletions dist/connection/transports/TlsTransport.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default class TlsTransport implements ITransport {
private connection;
private tlsOptions;
private options;
private tls;
constructor(host: string, port: number, options?: TlsOptions);
setOptions(option: string, value: any): void;
getOptions(): object;
Expand Down
3 changes: 2 additions & 1 deletion dist/connection/transports/TlsTransport.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/connection/transports/TlsTransport.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/errors/OperationStateError.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HiveDriverError from "./HiveDriverError";
import { GetOperationStatusResponse } from "../hive/Commands/GetOperationStatusCommand";
export default class OperationStateError extends HiveDriverError {
response?: GetOperationStatusResponse;
setResponse(response: GetOperationStatusResponse): void;
response: GetOperationStatusResponse;
constructor(message: string, response: GetOperationStatusResponse);
}
9 changes: 4 additions & 5 deletions dist/errors/OperationStateError.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/errors/OperationStateError.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions dist/utils/WaitUntilReady.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/utils/WaitUntilReady.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/connection/transports/TlsTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export default class TlsTransport implements ITransport {
private connection: any;
private tlsOptions: TlsOptions;
private options: object;
private tls: any;

constructor(host: string, port: number, options: TlsOptions = {}) {
this.tls = tls;
this.host = host;
this.port = port;
this.tlsOptions = {
Expand Down Expand Up @@ -41,7 +43,7 @@ export default class TlsTransport implements ITransport {
}

connect(): any {
this.connection = tls.connect(this.port, this.host, this.tlsOptions);
this.connection = this.tls.connect(this.port, this.host, this.tlsOptions);
this.connection.setMaxSendFragment(65536);
this.connection.setNoDelay(true);
};
Expand Down
6 changes: 4 additions & 2 deletions lib/errors/OperationStateError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import HiveDriverError from "./HiveDriverError";
import { GetOperationStatusResponse } from "../hive/Commands/GetOperationStatusCommand";

export default class OperationStateError extends HiveDriverError {
public response?: GetOperationStatusResponse;
public response: GetOperationStatusResponse;

setResponse(response: GetOperationStatusResponse) {
constructor(message: string, response: GetOperationStatusResponse) {
super(message);

this.response = response;
}
}
19 changes: 9 additions & 10 deletions lib/utils/WaitUntilReady.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,39 @@ export default class WaitUntilReady {
}

try {
const isReady = this.isReady(response.operationState);
const isReady = this.isReady(response);

if (isReady) {
return this.operation;
} else {
return this.execute(progress, callback);
}
} catch (error) {
error.setResponse(response);
throw error;
}
}

private isReady(operationState?: number): boolean {
switch(operationState) {
private isReady(response: GetOperationStatusResponse): boolean {
switch(response.operationState) {
case this.TCLIService_types.TOperationState.INITIALIZED_STATE:
return false;
case this.TCLIService_types.TOperationState.RUNNING_STATE:
return false;
case this.TCLIService_types.TOperationState.FINISHED_STATE:
return true;
case this.TCLIService_types.TOperationState.CANCELED_STATE:
throw new OperationStateError('The operation was canceled by a client');
throw new OperationStateError('The operation was canceled by a client', response);
case this.TCLIService_types.TOperationState.CLOSED_STATE:
throw new OperationStateError('The operation was closed by a client');
throw new OperationStateError('The operation was closed by a client', response);
case this.TCLIService_types.TOperationState.ERROR_STATE:
throw new OperationStateError('The operation failed due to an error');
throw new OperationStateError('The operation failed due to an error', response);
case this.TCLIService_types.TOperationState.PENDING_STATE:
throw new OperationStateError('The operation is in a pending state');
throw new OperationStateError('The operation is in a pending state', response);
case this.TCLIService_types.TOperationState.TIMEDOUT_STATE:
throw new OperationStateError('The operation is in a timedout state');
throw new OperationStateError('The operation is in a timedout state', response);
case this.TCLIService_types.TOperationState.UKNOWN_STATE:
default:
throw new OperationStateError('The operation is in an unrecognized state');
throw new OperationStateError('The operation is in an unrecognized state', response);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hive-driver",
"version": "0.1.1",
"version": "0.1.2",
"description": "Driver for connection to Apache Hive via Thrift API.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Loading

0 comments on commit 2a5f098

Please sign in to comment.