@databricks/sql 0.1.8-beta.1
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/.gitattributes +32 -0
- package/CHANGELOG.md +1 -0
- package/CONTRIBUTING.md +55 -0
- package/LICENSE +201 -0
- package/README.md +78 -0
- package/dist/DBSQLClient.d.ts +42 -0
- package/dist/DBSQLClient.js +111 -0
- package/dist/DBSQLClient.js.map +1 -0
- package/dist/HiveClient.d.ts +35 -0
- package/dist/HiveClient.js +156 -0
- package/dist/HiveClient.js.map +1 -0
- package/dist/HiveOperation.d.ts +65 -0
- package/dist/HiveOperation.js +190 -0
- package/dist/HiveOperation.js.map +1 -0
- package/dist/HiveSession.d.ts +30 -0
- package/dist/HiveSession.js +197 -0
- package/dist/HiveSession.js.map +1 -0
- package/dist/connection/auth/NoSaslAuthentication.d.ts +5 -0
- package/dist/connection/auth/NoSaslAuthentication.js +15 -0
- package/dist/connection/auth/NoSaslAuthentication.js.map +1 -0
- package/dist/connection/auth/PlainHttpAuthentication.d.ts +15 -0
- package/dist/connection/auth/PlainHttpAuthentication.js +30 -0
- package/dist/connection/auth/PlainHttpAuthentication.js.map +1 -0
- package/dist/connection/auth/helpers/SaslPackageFactory.d.ts +11 -0
- package/dist/connection/auth/helpers/SaslPackageFactory.js +24 -0
- package/dist/connection/auth/helpers/SaslPackageFactory.js.map +1 -0
- package/dist/connection/connections/HttpConnection.d.ts +13 -0
- package/dist/connection/connections/HttpConnection.js +77 -0
- package/dist/connection/connections/HttpConnection.js.map +1 -0
- package/dist/connection/contracts/IAuthentication.d.ts +4 -0
- package/dist/connection/contracts/IAuthentication.js +3 -0
- package/dist/connection/contracts/IAuthentication.js.map +1 -0
- package/dist/connection/contracts/IConnectionOptions.d.ts +23 -0
- package/dist/connection/contracts/IConnectionOptions.js +3 -0
- package/dist/connection/contracts/IConnectionOptions.js.map +1 -0
- package/dist/connection/contracts/IConnectionProvider.d.ts +6 -0
- package/dist/connection/contracts/IConnectionProvider.js +3 -0
- package/dist/connection/contracts/IConnectionProvider.js.map +1 -0
- package/dist/connection/contracts/IThriftConnection.d.ts +4 -0
- package/dist/connection/contracts/IThriftConnection.js +3 -0
- package/dist/connection/contracts/IThriftConnection.js.map +1 -0
- package/dist/connection/contracts/ITransport.d.ts +13 -0
- package/dist/connection/contracts/ITransport.js +3 -0
- package/dist/connection/contracts/ITransport.js.map +1 -0
- package/dist/connection/transports/HttpTransport.d.ts +14 -0
- package/dist/connection/transports/HttpTransport.js +39 -0
- package/dist/connection/transports/HttpTransport.js.map +1 -0
- package/dist/connection/types/AuthOptions.d.ts +4 -0
- package/dist/connection/types/AuthOptions.js +3 -0
- package/dist/connection/types/AuthOptions.js.map +1 -0
- package/dist/contracts/IHiveClient.d.ts +10 -0
- package/dist/contracts/IHiveClient.js +3 -0
- package/dist/contracts/IHiveClient.js.map +1 -0
- package/dist/contracts/IHiveSession.d.ts +126 -0
- package/dist/contracts/IHiveSession.js +3 -0
- package/dist/contracts/IHiveSession.js.map +1 -0
- package/dist/contracts/IOperation.d.ts +47 -0
- package/dist/contracts/IOperation.js +3 -0
- package/dist/contracts/IOperation.js.map +1 -0
- package/dist/dto/InfoValue.d.ts +9 -0
- package/dist/dto/InfoValue.js +31 -0
- package/dist/dto/InfoValue.js.map +1 -0
- package/dist/dto/Status.d.ts +15 -0
- package/dist/dto/Status.js +21 -0
- package/dist/dto/Status.js.map +1 -0
- package/dist/errors/AuthenticationError.d.ts +3 -0
- package/dist/errors/AuthenticationError.js +30 -0
- package/dist/errors/AuthenticationError.js.map +1 -0
- package/dist/errors/HiveDriverError.d.ts +2 -0
- package/dist/errors/HiveDriverError.js +26 -0
- package/dist/errors/HiveDriverError.js.map +1 -0
- package/dist/errors/OperationStateError.d.ts +6 -0
- package/dist/errors/OperationStateError.js +32 -0
- package/dist/errors/OperationStateError.js.map +1 -0
- package/dist/errors/StatusError.d.ts +8 -0
- package/dist/errors/StatusError.js +15 -0
- package/dist/errors/StatusError.js.map +1 -0
- package/dist/factory/StatusFactory.d.ts +14 -0
- package/dist/factory/StatusFactory.js +40 -0
- package/dist/factory/StatusFactory.js.map +1 -0
- package/dist/hive/Commands/BaseCommand.d.ts +7 -0
- package/dist/hive/Commands/BaseCommand.js +36 -0
- package/dist/hive/Commands/BaseCommand.js.map +1 -0
- package/dist/hive/Commands/CancelDelegationTokenCommand.d.ts +12 -0
- package/dist/hive/Commands/CancelDelegationTokenCommand.js +34 -0
- package/dist/hive/Commands/CancelDelegationTokenCommand.js.map +1 -0
- package/dist/hive/Commands/CancelOperationCommand.d.ts +11 -0
- package/dist/hive/Commands/CancelOperationCommand.js +34 -0
- package/dist/hive/Commands/CancelOperationCommand.js.map +1 -0
- package/dist/hive/Commands/CloseOperationCommand.d.ts +11 -0
- package/dist/hive/Commands/CloseOperationCommand.js +34 -0
- package/dist/hive/Commands/CloseOperationCommand.js.map +1 -0
- package/dist/hive/Commands/CloseSessionCommand.d.ts +11 -0
- package/dist/hive/Commands/CloseSessionCommand.js +34 -0
- package/dist/hive/Commands/CloseSessionCommand.js.map +1 -0
- package/dist/hive/Commands/ExecuteStatementCommand.d.ts +17 -0
- package/dist/hive/Commands/ExecuteStatementCommand.js +34 -0
- package/dist/hive/Commands/ExecuteStatementCommand.js.map +1 -0
- package/dist/hive/Commands/FetchResultsCommand.d.ts +20 -0
- package/dist/hive/Commands/FetchResultsCommand.js +34 -0
- package/dist/hive/Commands/FetchResultsCommand.js.map +1 -0
- package/dist/hive/Commands/GetCatalogsCommand.d.ts +12 -0
- package/dist/hive/Commands/GetCatalogsCommand.js +34 -0
- package/dist/hive/Commands/GetCatalogsCommand.js.map +1 -0
- package/dist/hive/Commands/GetColumnsCommand.d.ts +16 -0
- package/dist/hive/Commands/GetColumnsCommand.js +34 -0
- package/dist/hive/Commands/GetColumnsCommand.js.map +1 -0
- package/dist/hive/Commands/GetCrossReferenceCommand.d.ts +18 -0
- package/dist/hive/Commands/GetCrossReferenceCommand.js +34 -0
- package/dist/hive/Commands/GetCrossReferenceCommand.js.map +1 -0
- package/dist/hive/Commands/GetDelegationTokenCommand.d.ts +14 -0
- package/dist/hive/Commands/GetDelegationTokenCommand.js +34 -0
- package/dist/hive/Commands/GetDelegationTokenCommand.js.map +1 -0
- package/dist/hive/Commands/GetFunctionsCommand.d.ts +15 -0
- package/dist/hive/Commands/GetFunctionsCommand.js +34 -0
- package/dist/hive/Commands/GetFunctionsCommand.js.map +1 -0
- package/dist/hive/Commands/GetInfoCommand.d.ts +16 -0
- package/dist/hive/Commands/GetInfoCommand.js +34 -0
- package/dist/hive/Commands/GetInfoCommand.js.map +1 -0
- package/dist/hive/Commands/GetOperationStatusCommand.d.ts +23 -0
- package/dist/hive/Commands/GetOperationStatusCommand.js +34 -0
- package/dist/hive/Commands/GetOperationStatusCommand.js.map +1 -0
- package/dist/hive/Commands/GetPrimaryKeysCommand.d.ts +15 -0
- package/dist/hive/Commands/GetPrimaryKeysCommand.js +34 -0
- package/dist/hive/Commands/GetPrimaryKeysCommand.js.map +1 -0
- package/dist/hive/Commands/GetQueryIdCommand.d.ts +11 -0
- package/dist/hive/Commands/GetQueryIdCommand.js +34 -0
- package/dist/hive/Commands/GetQueryIdCommand.js.map +1 -0
- package/dist/hive/Commands/GetResultSetMetadataCommand.d.ts +12 -0
- package/dist/hive/Commands/GetResultSetMetadataCommand.js +34 -0
- package/dist/hive/Commands/GetResultSetMetadataCommand.js.map +1 -0
- package/dist/hive/Commands/GetSchemasCommand.d.ts +14 -0
- package/dist/hive/Commands/GetSchemasCommand.js +34 -0
- package/dist/hive/Commands/GetSchemasCommand.js.map +1 -0
- package/dist/hive/Commands/GetTableTypesCommand.d.ts +12 -0
- package/dist/hive/Commands/GetTableTypesCommand.js +34 -0
- package/dist/hive/Commands/GetTableTypesCommand.js.map +1 -0
- package/dist/hive/Commands/GetTablesCommand.d.ts +16 -0
- package/dist/hive/Commands/GetTablesCommand.js +34 -0
- package/dist/hive/Commands/GetTablesCommand.js.map +1 -0
- package/dist/hive/Commands/GetTypeInfoCommand.d.ts +12 -0
- package/dist/hive/Commands/GetTypeInfoCommand.js +34 -0
- package/dist/hive/Commands/GetTypeInfoCommand.js.map +1 -0
- package/dist/hive/Commands/OpenSessionCommand.d.ts +33 -0
- package/dist/hive/Commands/OpenSessionCommand.js +34 -0
- package/dist/hive/Commands/OpenSessionCommand.js.map +1 -0
- package/dist/hive/Commands/RenewDelegationTokenCommand.d.ts +12 -0
- package/dist/hive/Commands/RenewDelegationTokenCommand.js +34 -0
- package/dist/hive/Commands/RenewDelegationTokenCommand.js.map +1 -0
- package/dist/hive/Commands/SetClientInfoCommand.d.ts +12 -0
- package/dist/hive/Commands/SetClientInfoCommand.js +34 -0
- package/dist/hive/Commands/SetClientInfoCommand.js.map +1 -0
- package/dist/hive/HiveDriver.d.ts +52 -0
- package/dist/hive/HiveDriver.js +129 -0
- package/dist/hive/HiveDriver.js.map +1 -0
- package/dist/hive/Types/index.d.ts +229 -0
- package/dist/hive/Types/index.js +16 -0
- package/dist/hive/Types/index.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/result/IOperationResult.d.ts +5 -0
- package/dist/result/IOperationResult.js +3 -0
- package/dist/result/IOperationResult.js.map +1 -0
- package/dist/result/JsonResult.d.ts +20 -0
- package/dist/result/JsonResult.js +137 -0
- package/dist/result/JsonResult.js.map +1 -0
- package/dist/result/NullResult.d.ts +6 -0
- package/dist/result/NullResult.js +13 -0
- package/dist/result/NullResult.js.map +1 -0
- package/dist/utils/GetResult.d.ts +16 -0
- package/dist/utils/GetResult.js +38 -0
- package/dist/utils/GetResult.js.map +1 -0
- package/dist/utils/HiveUtils.d.ts +11 -0
- package/dist/utils/HiveUtils.js +39 -0
- package/dist/utils/HiveUtils.js.map +1 -0
- package/dist/utils/ProgressUpdateTransformer.d.ts +8 -0
- package/dist/utils/ProgressUpdateTransformer.js +33 -0
- package/dist/utils/ProgressUpdateTransformer.js.map +1 -0
- package/dist/utils/WaitUntilReady.d.ts +16 -0
- package/dist/utils/WaitUntilReady.js +120 -0
- package/dist/utils/WaitUntilReady.js.map +1 -0
- package/docs/readme.md +227 -0
- package/docs/troubleshooting.md +84 -0
- package/examples/data_types.js +173 -0
- package/examples/repl +106 -0
- package/examples/session.js +55 -0
- package/examples/usage.js +18 -0
- package/nyc.config.js +8 -0
- package/package.json +56 -0
- package/tests/e2e/data_types.test.js +353 -0
- package/tests/e2e/utils/config.js +20 -0
- package/tests/e2e/utils/logger.js +22 -0
- package/tests/unit/HiveClient.test.js +153 -0
- package/tests/unit/HiveOperation.test.js +340 -0
- package/tests/unit/HiveSession.test.js +146 -0
- package/tests/unit/connection/auth/PlainHttpAuthentication.test.js +44 -0
- package/tests/unit/connection/connections/HttpConnection.test.js +141 -0
- package/tests/unit/dto/InfoValue.test.js +50 -0
- package/tests/unit/factory/StatusFactory.test.js +62 -0
- package/tests/unit/hive/HiveDriver.test.js +115 -0
- package/tests/unit/hive/commands/CancelDelegationTokenCommand.test.js +43 -0
- package/tests/unit/hive/commands/CancelOperationCommand.test.js +45 -0
- package/tests/unit/hive/commands/CloseOperationCommand.test.js +45 -0
- package/tests/unit/hive/commands/CloseSessionCommand.test.js +38 -0
- package/tests/unit/hive/commands/ExecuteStatementCommand.test.js +54 -0
- package/tests/unit/hive/commands/FetchResultsCommand.test.js +59 -0
- package/tests/unit/hive/commands/GetCatalogsCommand.test.js +50 -0
- package/tests/unit/hive/commands/GetColumnsCommand.test.js +50 -0
- package/tests/unit/hive/commands/GetCrossReferenceCommand.test.js +56 -0
- package/tests/unit/hive/commands/GetDelegationTokenCommand.test.js +45 -0
- package/tests/unit/hive/commands/GetFunctionsCommand.test.js +50 -0
- package/tests/unit/hive/commands/GetInfoCommand.test.js +51 -0
- package/tests/unit/hive/commands/GetOperationStatusCommand.test.js +63 -0
- package/tests/unit/hive/commands/GetPrimaryKeysCommand.test.js +50 -0
- package/tests/unit/hive/commands/GetQueryIdCommand.test.js +42 -0
- package/tests/unit/hive/commands/GetResultSetMetadataCommand.test.js +54 -0
- package/tests/unit/hive/commands/GetSchemasCommand.test.js +52 -0
- package/tests/unit/hive/commands/GetTableTypesCommand.test.js +50 -0
- package/tests/unit/hive/commands/GetTablesCommand.test.js +54 -0
- package/tests/unit/hive/commands/GetTypeInfoCommand.test.js +50 -0
- package/tests/unit/hive/commands/OpenSessionCommand.test.js +43 -0
- package/tests/unit/hive/commands/RenewDelegationTokenCommand.test.js +43 -0
- package/tests/unit/hive/commands/SetClientInfoCommand.test.js +45 -0
- package/tests/unit/result/JsonResult.test.js +295 -0
- package/tests/unit/utils/GetResult.test.js +30 -0
- package/tests/unit/utils/HiveUtils.test.js +60 -0
- package/tests/unit/utils/ProgressUpdateTransformer.test.js +28 -0
- package/tests/unit/utils/WaitUntilReady.test.js +105 -0
- package/thrift/TCLIService.thrift +1299 -0
- package/thrift/gen-nodejs/TCLIService.js +4596 -0
- package/thrift/gen-nodejs/TCLIService_types.js +6794 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetCatalogsCommand = require('../../../../dist/hive/Commands/GetCatalogsCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetCatalogsReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const GET_CATALOG = 2;
|
|
19
|
+
|
|
20
|
+
const responseMock = {
|
|
21
|
+
status: { statusCode: 0 },
|
|
22
|
+
operationHandle: {
|
|
23
|
+
hasResultSet: true,
|
|
24
|
+
operationId: { guid: '', secret: '' },
|
|
25
|
+
operationType: GET_CATALOG,
|
|
26
|
+
modifiedRowCount: 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const thriftClientMock = {
|
|
30
|
+
GetCatalogs(request, callback) {
|
|
31
|
+
return callback(null, responseMock);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('GetCatalogsCommand', () => {
|
|
36
|
+
it('should return response', (cb) => {
|
|
37
|
+
const command = new GetCatalogsCommand(
|
|
38
|
+
thriftClientMock,
|
|
39
|
+
TCLIService_types
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
command.execute(requestMock)
|
|
43
|
+
.then(response => {
|
|
44
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
45
|
+
cb();
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
cb(error);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetColumnsCommand = require('../../../../dist/hive/Commands/GetColumnsCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetColumnsReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const GET_COLUMNS = 6;
|
|
19
|
+
|
|
20
|
+
const responseMock = {
|
|
21
|
+
status: { statusCode: 0 },
|
|
22
|
+
operationHandle: {
|
|
23
|
+
hasResultSet: true,
|
|
24
|
+
operationId: { guid: '', secret: '' },
|
|
25
|
+
operationType: GET_COLUMNS,
|
|
26
|
+
modifiedRowCount: 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const thriftClientMock = {
|
|
30
|
+
GetColumns(request, callback) {
|
|
31
|
+
return callback(null, responseMock);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('GetColumnsCommand', () => {
|
|
36
|
+
it('should return response', (cb) => {
|
|
37
|
+
const command = new GetColumnsCommand(
|
|
38
|
+
thriftClientMock,
|
|
39
|
+
TCLIService_types
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
command.execute(requestMock)
|
|
43
|
+
.then(response => {
|
|
44
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
45
|
+
cb();
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
cb(error);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetCrossReferenceCommand = require('../../../../dist/hive/Commands/GetCrossReferenceCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
parentCatalogName: 'parentCatalogName',
|
|
9
|
+
parentSchemaName: 'parentSchemaName',
|
|
10
|
+
parentTableName: 'parentTableName',
|
|
11
|
+
foreignCatalogName: 'foreignCatalogName',
|
|
12
|
+
foreignSchemaName: 'foreignSchemaName',
|
|
13
|
+
foreignTableName: 'foreignTableName',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const TCLIService_types = {
|
|
17
|
+
TGetCrossReferenceReq: function (options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
|
|
20
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const GET_CROSS_REFERENCE = 7;
|
|
25
|
+
|
|
26
|
+
const responseMock = {
|
|
27
|
+
status: { statusCode: 0 },
|
|
28
|
+
operationHandle: {
|
|
29
|
+
hasResultSet: true,
|
|
30
|
+
operationId: { guid: '', secret: '' },
|
|
31
|
+
operationType: GET_CROSS_REFERENCE,
|
|
32
|
+
modifiedRowCount: 0
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const thriftClientMock = {
|
|
36
|
+
GetCrossReference(request, callback) {
|
|
37
|
+
return callback(null, responseMock);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
describe('GetCrossReferenceCommand', () => {
|
|
42
|
+
it('should return response', (cb) => {
|
|
43
|
+
const command = new GetCrossReferenceCommand(
|
|
44
|
+
thriftClientMock,
|
|
45
|
+
TCLIService_types
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
command.execute(requestMock)
|
|
49
|
+
.then(response => {
|
|
50
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
51
|
+
cb();
|
|
52
|
+
}).catch(error => {
|
|
53
|
+
cb(error);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetDelegationTokenCommand = require('../../../../dist/hive/Commands/GetDelegationTokenCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
owner: 'user1',
|
|
9
|
+
renewer: 'user2'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const TCLIService_types = {
|
|
13
|
+
TGetDelegationTokenReq: function (options) {
|
|
14
|
+
this.options = options;
|
|
15
|
+
|
|
16
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const responseMock = {
|
|
21
|
+
status: { statusCode: 0 },
|
|
22
|
+
delegationToken: 'token'
|
|
23
|
+
};
|
|
24
|
+
const thriftClientMock = {
|
|
25
|
+
GetDelegationToken(request, callback) {
|
|
26
|
+
return callback(null, responseMock);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
describe('GetDelegationTokenCommand', () => {
|
|
31
|
+
it('should return response', (cb) => {
|
|
32
|
+
const command = new GetDelegationTokenCommand(
|
|
33
|
+
thriftClientMock,
|
|
34
|
+
TCLIService_types
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
command.execute(requestMock)
|
|
38
|
+
.then(response => {
|
|
39
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
40
|
+
cb();
|
|
41
|
+
}).catch(error => {
|
|
42
|
+
cb(error);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetFunctionsCommand = require('../../../../dist/hive/Commands/GetFunctionsCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetFunctionsReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const GET_FUNCTIONS = 7;
|
|
19
|
+
|
|
20
|
+
const responseMock = {
|
|
21
|
+
status: { statusCode: 0 },
|
|
22
|
+
operationHandle: {
|
|
23
|
+
hasResultSet: true,
|
|
24
|
+
operationId: { guid: '', secret: '' },
|
|
25
|
+
operationType: GET_FUNCTIONS,
|
|
26
|
+
modifiedRowCount: 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const thriftClientMock = {
|
|
30
|
+
GetFunctions(request, callback) {
|
|
31
|
+
return callback(null, responseMock);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('GetFunctionsCommand', () => {
|
|
36
|
+
it('should return response', (cb) => {
|
|
37
|
+
const command = new GetFunctionsCommand(
|
|
38
|
+
thriftClientMock,
|
|
39
|
+
TCLIService_types
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
command.execute(requestMock)
|
|
43
|
+
.then(response => {
|
|
44
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
45
|
+
cb();
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
cb(error);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetInfoCommand = require('../../../../dist/hive/Commands/GetInfoCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
infoType: 0
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const TCLIService_types = {
|
|
12
|
+
TGetInfoReq: function (options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
|
|
15
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const responseMock = {
|
|
20
|
+
status: { statusCode: 0 },
|
|
21
|
+
infoValue: {
|
|
22
|
+
stringValue: '',
|
|
23
|
+
smallIntValue: 0,
|
|
24
|
+
integerBitmask: 1,
|
|
25
|
+
integerFlag: 0,
|
|
26
|
+
binaryValue: Buffer.from([]),
|
|
27
|
+
lenValue: Buffer.from([])
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const thriftClientMock = {
|
|
31
|
+
GetInfo(request, callback) {
|
|
32
|
+
return callback(null, responseMock);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
describe('GetInfoCommand', () => {
|
|
37
|
+
it('should return response', (cb) => {
|
|
38
|
+
const command = new GetInfoCommand(
|
|
39
|
+
thriftClientMock,
|
|
40
|
+
TCLIService_types
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
command.execute(requestMock)
|
|
44
|
+
.then(response => {
|
|
45
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
46
|
+
cb();
|
|
47
|
+
}).catch(error => {
|
|
48
|
+
cb(error);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetOperationStatusCommand = require('../../../../dist/hive/Commands/GetOperationStatusCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
operationHandle: {
|
|
6
|
+
hasResultSet: true,
|
|
7
|
+
operationId: { guid: '', secret: '' },
|
|
8
|
+
operationType: 0,
|
|
9
|
+
modifiedRowCount: 0
|
|
10
|
+
},
|
|
11
|
+
getProgressUpdate: true
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const TCLIService_types = {
|
|
15
|
+
TGetOperationStatusReq: function (options) {
|
|
16
|
+
this.options = options;
|
|
17
|
+
|
|
18
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const responseMock = {
|
|
23
|
+
status: { statusCode: 0 },
|
|
24
|
+
operationState: 2,
|
|
25
|
+
sqlState: '',
|
|
26
|
+
errorCode: 0,
|
|
27
|
+
errorMessage: '',
|
|
28
|
+
taskStatus: '',
|
|
29
|
+
operationStarted: Buffer.from([]),
|
|
30
|
+
operationCompleted: Buffer.from([]),
|
|
31
|
+
hasResultSet: true,
|
|
32
|
+
progressUpdateResponse: {
|
|
33
|
+
headerNames: [''],
|
|
34
|
+
rows: [['']],
|
|
35
|
+
progressedPercentage: 50,
|
|
36
|
+
status: 0,
|
|
37
|
+
footerSummary: '',
|
|
38
|
+
startTime: Buffer.from([])
|
|
39
|
+
},
|
|
40
|
+
numModifiedRows: Buffer.from([]),
|
|
41
|
+
};
|
|
42
|
+
const thriftClientMock = {
|
|
43
|
+
GetOperationStatus(request, callback) {
|
|
44
|
+
return callback(null, responseMock);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
describe('GetOperationStatusCommand', () => {
|
|
49
|
+
it('should return response', (cb) => {
|
|
50
|
+
const command = new GetOperationStatusCommand(
|
|
51
|
+
thriftClientMock,
|
|
52
|
+
TCLIService_types
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
command.execute(requestMock)
|
|
56
|
+
.then(response => {
|
|
57
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
58
|
+
cb();
|
|
59
|
+
}).catch(error => {
|
|
60
|
+
cb(error);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetPrimaryKeysCommand = require('../../../../dist/hive/Commands/GetPrimaryKeysCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetPrimaryKeysReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const GET_PRIMARY_KEYS = 7;
|
|
19
|
+
|
|
20
|
+
const responseMock = {
|
|
21
|
+
status: { statusCode: 0 },
|
|
22
|
+
operationHandle: {
|
|
23
|
+
hasResultSet: true,
|
|
24
|
+
operationId: { guid: '', secret: '' },
|
|
25
|
+
operationType: GET_PRIMARY_KEYS,
|
|
26
|
+
modifiedRowCount: 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const thriftClientMock = {
|
|
30
|
+
GetPrimaryKeys(request, callback) {
|
|
31
|
+
return callback(null, responseMock);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('GetPrimaryKeysCommand', () => {
|
|
36
|
+
it('should return response', (cb) => {
|
|
37
|
+
const command = new GetPrimaryKeysCommand(
|
|
38
|
+
thriftClientMock,
|
|
39
|
+
TCLIService_types
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
command.execute(requestMock)
|
|
43
|
+
.then(response => {
|
|
44
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
45
|
+
cb();
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
cb(error);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetQueryIdCommand = require('../../../../dist/hive/Commands/GetQueryIdCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
operationHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetQueryIdReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const responseMock = {
|
|
19
|
+
queryId: 'id'
|
|
20
|
+
};
|
|
21
|
+
const thriftClientMock = {
|
|
22
|
+
GetQueryId(request, callback) {
|
|
23
|
+
return callback(null, responseMock);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
describe('GetQueryIdCommand', () => {
|
|
28
|
+
it('should return response', (cb) => {
|
|
29
|
+
const command = new GetQueryIdCommand(
|
|
30
|
+
thriftClientMock,
|
|
31
|
+
TCLIService_types
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
command.execute(requestMock)
|
|
35
|
+
.then(response => {
|
|
36
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
37
|
+
cb();
|
|
38
|
+
}).catch(error => {
|
|
39
|
+
cb(error);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetResultSetMetadataCommand = require('../../../../dist/hive/Commands/GetResultSetMetadataCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
operationHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetResultSetMetadataReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const responseMock = {
|
|
19
|
+
status: { statusCode: 0 },
|
|
20
|
+
schema: {
|
|
21
|
+
columns: [{
|
|
22
|
+
columnName: 'column1',
|
|
23
|
+
typeDesc: {
|
|
24
|
+
types: [{
|
|
25
|
+
type: 0
|
|
26
|
+
}]
|
|
27
|
+
},
|
|
28
|
+
position: 0,
|
|
29
|
+
comment: ''
|
|
30
|
+
}]
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const thriftClientMock = {
|
|
34
|
+
GetResultSetMetadata(request, callback) {
|
|
35
|
+
return callback(null, responseMock);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
describe('GetResultSetMetadataCommand', () => {
|
|
40
|
+
it('should return response', (cb) => {
|
|
41
|
+
const command = new GetResultSetMetadataCommand(
|
|
42
|
+
thriftClientMock,
|
|
43
|
+
TCLIService_types
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
command.execute(requestMock)
|
|
47
|
+
.then(response => {
|
|
48
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
49
|
+
cb();
|
|
50
|
+
}).catch(error => {
|
|
51
|
+
cb(error);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetSchemasCommand = require('../../../../dist/hive/Commands/GetSchemasCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
catalogName: 'catalog',
|
|
9
|
+
schemaName: 'schema'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const TCLIService_types = {
|
|
13
|
+
TGetSchemasReq: function (options) {
|
|
14
|
+
this.options = options;
|
|
15
|
+
|
|
16
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const GET_SCHEMAS = 3;
|
|
21
|
+
|
|
22
|
+
const responseMock = {
|
|
23
|
+
status: { statusCode: 0 },
|
|
24
|
+
operationHandle: {
|
|
25
|
+
hasResultSet: true,
|
|
26
|
+
operationId: { guid: '', secret: '' },
|
|
27
|
+
operationType: GET_SCHEMAS,
|
|
28
|
+
modifiedRowCount: 0
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const thriftClientMock = {
|
|
32
|
+
GetSchemas(request, callback) {
|
|
33
|
+
return callback(null, responseMock);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
describe('GetSchemasCommand', () => {
|
|
38
|
+
it('should return response', (cb) => {
|
|
39
|
+
const command = new GetSchemasCommand(
|
|
40
|
+
thriftClientMock,
|
|
41
|
+
TCLIService_types
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
command.execute(requestMock)
|
|
45
|
+
.then(response => {
|
|
46
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
47
|
+
cb();
|
|
48
|
+
}).catch(error => {
|
|
49
|
+
cb(error);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetTableTypesCommand = require('../../../../dist/hive/Commands/GetTableTypesCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const TCLIService_types = {
|
|
11
|
+
TGetTableTypesReq: function (options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
|
|
14
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const GET_TABLE_TYPES = 5;
|
|
19
|
+
|
|
20
|
+
const responseMock = {
|
|
21
|
+
status: { statusCode: 0 },
|
|
22
|
+
operationHandle: {
|
|
23
|
+
hasResultSet: true,
|
|
24
|
+
operationId: { guid: '', secret: '' },
|
|
25
|
+
operationType: GET_TABLE_TYPES,
|
|
26
|
+
modifiedRowCount: 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const thriftClientMock = {
|
|
30
|
+
GetTableTypes(request, callback) {
|
|
31
|
+
return callback(null, responseMock);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
describe('GetTableTypesCommand', () => {
|
|
36
|
+
it('should return response', (cb) => {
|
|
37
|
+
const command = new GetTableTypesCommand(
|
|
38
|
+
thriftClientMock,
|
|
39
|
+
TCLIService_types
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
command.execute(requestMock)
|
|
43
|
+
.then(response => {
|
|
44
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
45
|
+
cb();
|
|
46
|
+
}).catch(error => {
|
|
47
|
+
cb(error);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const { expect } = require('chai');
|
|
2
|
+
const GetTablesCommand = require('../../../../dist/hive/Commands/GetTablesCommand').default;
|
|
3
|
+
|
|
4
|
+
const requestMock = {
|
|
5
|
+
sessionHandle: {
|
|
6
|
+
sessionId: { guid: '', secret: '' }
|
|
7
|
+
},
|
|
8
|
+
catalogName: 'catalog',
|
|
9
|
+
schemaName: 'schema',
|
|
10
|
+
tableName: 'table',
|
|
11
|
+
tableTypes: ['TABLE', 'VIEW', 'SYSTEM TABLE', 'GLOBAL TEMPORARY', 'LOCAL TEMPORARY', 'ALIAS', 'SYNONYM']
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const TCLIService_types = {
|
|
15
|
+
TGetTablesReq: function (options) {
|
|
16
|
+
this.options = options;
|
|
17
|
+
|
|
18
|
+
expect(options).to.be.deep.eq(requestMock);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const GET_TABLES = 4;
|
|
23
|
+
|
|
24
|
+
const responseMock = {
|
|
25
|
+
status: { statusCode: 0 },
|
|
26
|
+
operationHandle: {
|
|
27
|
+
hasResultSet: true,
|
|
28
|
+
operationId: { guid: '', secret: '' },
|
|
29
|
+
operationType: GET_TABLES,
|
|
30
|
+
modifiedRowCount: 0
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const thriftClientMock = {
|
|
34
|
+
GetTables(request, callback) {
|
|
35
|
+
return callback(null, responseMock);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
describe('GetTablesCommand', () => {
|
|
40
|
+
it('should return response', (cb) => {
|
|
41
|
+
const command = new GetTablesCommand(
|
|
42
|
+
thriftClientMock,
|
|
43
|
+
TCLIService_types
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
command.execute(requestMock)
|
|
47
|
+
.then(response => {
|
|
48
|
+
expect(response).to.be.deep.eq(responseMock);
|
|
49
|
+
cb();
|
|
50
|
+
}).catch(error => {
|
|
51
|
+
cb(error);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|