aboutsummaryrefslogtreecommitdiff
path: root/sql/hive-thriftserver
diff options
context:
space:
mode:
authorDavies Liu <davies@databricks.com>2016-05-03 14:40:47 -0700
committerReynold Xin <rxin@databricks.com>2016-05-03 14:40:47 -0700
commit028c6a5dba01e5d82c34701f40d15916c9d3e9d0 (patch)
treee8de45db7758efcdbfa89b393872486f2396273b /sql/hive-thriftserver
parent71296c041e59159bd7c5836cf652c02843974077 (diff)
downloadspark-028c6a5dba01e5d82c34701f40d15916c9d3e9d0.tar.gz
spark-028c6a5dba01e5d82c34701f40d15916c9d3e9d0.tar.bz2
spark-028c6a5dba01e5d82c34701f40d15916c9d3e9d0.zip
[SQL-15102][SQL] remove delegation token support from ThriftServer
## What changes were proposed in this pull request? These API is only useful for Hadoop, may not work for Spark SQL. The APIs is kept for source compatibility. ## How was this patch tested? No unit tests needed. Author: Davies Liu <davies@databricks.com> Closes #12878 from davies/remove_delegate.
Diffstat (limited to 'sql/hive-thriftserver')
-rw-r--r--sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java65
1 files changed, 7 insertions, 58 deletions
diff --git a/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java b/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
index 866beb19f5..ad7a9a238f 100644
--- a/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
+++ b/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java
@@ -18,6 +18,7 @@
package org.apache.hive.service.cli.thrift;
+import javax.security.auth.login.LoginException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -25,8 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import javax.security.auth.login.LoginException;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.conf.HiveConf;
@@ -36,17 +35,7 @@ import org.apache.hive.service.ServiceException;
import org.apache.hive.service.ServiceUtils;
import org.apache.hive.service.auth.HiveAuthFactory;
import org.apache.hive.service.auth.TSetIpAddressProcessor;
-import org.apache.hive.service.cli.CLIService;
-import org.apache.hive.service.cli.FetchOrientation;
-import org.apache.hive.service.cli.FetchType;
-import org.apache.hive.service.cli.GetInfoType;
-import org.apache.hive.service.cli.GetInfoValue;
-import org.apache.hive.service.cli.HiveSQLException;
-import org.apache.hive.service.cli.OperationHandle;
-import org.apache.hive.service.cli.OperationStatus;
-import org.apache.hive.service.cli.RowSet;
-import org.apache.hive.service.cli.SessionHandle;
-import org.apache.hive.service.cli.TableSchema;
+import org.apache.hive.service.cli.*;
import org.apache.hive.service.cli.session.SessionManager;
import org.apache.hive.service.server.HiveServer2;
import org.apache.thrift.TException;
@@ -223,23 +212,7 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
public TGetDelegationTokenResp GetDelegationToken(TGetDelegationTokenReq req)
throws TException {
TGetDelegationTokenResp resp = new TGetDelegationTokenResp();
-
- if (hiveAuthFactory == null) {
- resp.setStatus(unsecureTokenErrorStatus());
- } else {
- try {
- String token = cliService.getDelegationToken(
- new SessionHandle(req.getSessionHandle()),
- hiveAuthFactory, req.getOwner(), req.getRenewer());
- resp.setDelegationToken(token);
- resp.setStatus(OK_STATUS);
- } catch (HiveSQLException e) {
- LOG.error("Error obtaining delegation token", e);
- TStatus tokenErrorStatus = HiveSQLException.toTStatus(e);
- tokenErrorStatus.setSqlState("42000");
- resp.setStatus(tokenErrorStatus);
- }
- }
+ resp.setStatus(notSupportTokenErrorStatus());
return resp;
}
@@ -247,19 +220,7 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
public TCancelDelegationTokenResp CancelDelegationToken(TCancelDelegationTokenReq req)
throws TException {
TCancelDelegationTokenResp resp = new TCancelDelegationTokenResp();
-
- if (hiveAuthFactory == null) {
- resp.setStatus(unsecureTokenErrorStatus());
- } else {
- try {
- cliService.cancelDelegationToken(new SessionHandle(req.getSessionHandle()),
- hiveAuthFactory, req.getDelegationToken());
- resp.setStatus(OK_STATUS);
- } catch (HiveSQLException e) {
- LOG.error("Error canceling delegation token", e);
- resp.setStatus(HiveSQLException.toTStatus(e));
- }
- }
+ resp.setStatus(notSupportTokenErrorStatus());
return resp;
}
@@ -267,25 +228,13 @@ public abstract class ThriftCLIService extends AbstractService implements TCLISe
public TRenewDelegationTokenResp RenewDelegationToken(TRenewDelegationTokenReq req)
throws TException {
TRenewDelegationTokenResp resp = new TRenewDelegationTokenResp();
- if (hiveAuthFactory == null) {
- resp.setStatus(unsecureTokenErrorStatus());
- } else {
- try {
- cliService.renewDelegationToken(new SessionHandle(req.getSessionHandle()),
- hiveAuthFactory, req.getDelegationToken());
- resp.setStatus(OK_STATUS);
- } catch (HiveSQLException e) {
- LOG.error("Error obtaining renewing token", e);
- resp.setStatus(HiveSQLException.toTStatus(e));
- }
- }
+ resp.setStatus(notSupportTokenErrorStatus());
return resp;
}
- private TStatus unsecureTokenErrorStatus() {
+ private TStatus notSupportTokenErrorStatus() {
TStatus errorStatus = new TStatus(TStatusCode.ERROR_STATUS);
- errorStatus.setErrorMessage("Delegation token only supported over remote " +
- "client with kerberos authentication");
+ errorStatus.setErrorMessage("Delegation token is not supported");
return errorStatus;
}