0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 package org.apache.hive.service.cli;
0020
0021 import java.util.List;
0022 import java.util.Map;
0023
0024 import org.apache.hive.service.auth.HiveAuthFactory;
0025
0026
0027
0028
0029
0030
0031 public class EmbeddedCLIServiceClient extends CLIServiceClient {
0032 private final ICLIService cliService;
0033
0034 public EmbeddedCLIServiceClient(ICLIService cliService) {
0035 this.cliService = cliService;
0036 }
0037
0038
0039
0040
0041 @Override
0042 public SessionHandle openSession(String username, String password,
0043 Map<String, String> configuration) throws HiveSQLException {
0044 return cliService.openSession(username, password, configuration);
0045 }
0046
0047 @Override
0048 public SessionHandle openSessionWithImpersonation(String username, String password,
0049 Map<String, String> configuration, String delegationToken) throws HiveSQLException {
0050 throw new HiveSQLException("Impersonated session is not supported in the embedded mode");
0051 }
0052
0053
0054
0055
0056 @Override
0057 public void closeSession(SessionHandle sessionHandle) throws HiveSQLException {
0058 cliService.closeSession(sessionHandle);
0059 }
0060
0061
0062
0063
0064 @Override
0065 public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType getInfoType)
0066 throws HiveSQLException {
0067 return cliService.getInfo(sessionHandle, getInfoType);
0068 }
0069
0070
0071
0072
0073
0074 @Override
0075 public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
0076 Map<String, String> confOverlay) throws HiveSQLException {
0077 return cliService.executeStatement(sessionHandle, statement, confOverlay);
0078 }
0079
0080
0081
0082
0083
0084 @Override
0085 public OperationHandle executeStatementAsync(SessionHandle sessionHandle, String statement,
0086 Map<String, String> confOverlay) throws HiveSQLException {
0087 return cliService.executeStatementAsync(sessionHandle, statement, confOverlay);
0088 }
0089
0090
0091
0092
0093
0094 @Override
0095 public OperationHandle getTypeInfo(SessionHandle sessionHandle) throws HiveSQLException {
0096 return cliService.getTypeInfo(sessionHandle);
0097 }
0098
0099
0100
0101
0102 @Override
0103 public OperationHandle getCatalogs(SessionHandle sessionHandle) throws HiveSQLException {
0104 return cliService.getCatalogs(sessionHandle);
0105 }
0106
0107
0108
0109
0110 @Override
0111 public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName,
0112 String schemaName) throws HiveSQLException {
0113 return cliService.getSchemas(sessionHandle, catalogName, schemaName);
0114 }
0115
0116
0117
0118
0119 @Override
0120 public OperationHandle getTables(SessionHandle sessionHandle, String catalogName,
0121 String schemaName, String tableName, List<String> tableTypes) throws HiveSQLException {
0122 return cliService.getTables(sessionHandle, catalogName, schemaName, tableName, tableTypes);
0123 }
0124
0125
0126
0127
0128 @Override
0129 public OperationHandle getTableTypes(SessionHandle sessionHandle) throws HiveSQLException {
0130 return cliService.getTableTypes(sessionHandle);
0131 }
0132
0133
0134
0135
0136 @Override
0137 public OperationHandle getColumns(SessionHandle sessionHandle, String catalogName,
0138 String schemaName, String tableName, String columnName) throws HiveSQLException {
0139 return cliService.getColumns(sessionHandle, catalogName, schemaName, tableName, columnName);
0140 }
0141
0142
0143
0144
0145 @Override
0146 public OperationHandle getFunctions(SessionHandle sessionHandle,
0147 String catalogName, String schemaName, String functionName)
0148 throws HiveSQLException {
0149 return cliService.getFunctions(sessionHandle, catalogName, schemaName, functionName);
0150 }
0151
0152
0153
0154
0155 @Override
0156 public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException {
0157 return cliService.getOperationStatus(opHandle);
0158 }
0159
0160
0161
0162
0163 @Override
0164 public void cancelOperation(OperationHandle opHandle) throws HiveSQLException {
0165 cliService.cancelOperation(opHandle);
0166 }
0167
0168
0169
0170
0171 @Override
0172 public void closeOperation(OperationHandle opHandle) throws HiveSQLException {
0173 cliService.closeOperation(opHandle);
0174 }
0175
0176
0177
0178
0179 @Override
0180 public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException {
0181 return cliService.getResultSetMetadata(opHandle);
0182 }
0183
0184 @Override
0185 public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation,
0186 long maxRows, FetchType fetchType) throws HiveSQLException {
0187 return cliService.fetchResults(opHandle, orientation, maxRows, fetchType);
0188 }
0189
0190
0191 @Override
0192 public String getDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory,
0193 String owner, String renewer) throws HiveSQLException {
0194 return cliService.getDelegationToken(sessionHandle, authFactory, owner, renewer);
0195 }
0196
0197 @Override
0198 public void cancelDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory,
0199 String tokenStr) throws HiveSQLException {
0200 cliService.cancelDelegationToken(sessionHandle, authFactory, tokenStr);
0201 }
0202
0203 @Override
0204 public void renewDelegationToken(SessionHandle sessionHandle, HiveAuthFactory authFactory,
0205 String tokenStr) throws HiveSQLException {
0206 cliService.renewDelegationToken(sessionHandle, authFactory, tokenStr);
0207 }
0208 }