nrg4878 commented on a change in pull request #2037:
URL: https://github.com/apache/hive/pull/2037#discussion_r601609303



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/ddl/dataconnector/alter/AbstractAlterDataConnectorOperation.java
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.ql.ddl.dataconnector.alter;
+
+import java.util.Map;
+
+import org.apache.hadoop.hive.metastore.api.DataConnector;
+import org.apache.hadoop.hive.ql.ErrorMsg;
+import org.apache.hadoop.hive.ql.ddl.DDLOperation;
+import org.apache.hadoop.hive.ql.ddl.DDLOperationContext;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+
+/**
+ * Operation process of altering a data connector.
+ */
+public abstract class AbstractAlterDataConnectorOperation<T extends 
AbstractAlterDataConnectorDesc> extends DDLOperation<T> {
+  public AbstractAlterDataConnectorOperation(DDLOperationContext context, T 
desc) {
+    super(context, desc);
+  }
+
+  @Override
+  public int execute() throws HiveException {
+    String dcName = desc.getConnectorName();
+    DataConnector connector = context.getDb().getDataConnector(dcName);
+    if (connector == null) {
+      throw new HiveException(ErrorMsg.DATACONNECTOR_ALREADY_EXISTS, dcName);

Review comment:
       yes, it should be DATACONNECTOR_NOT_EXISTS. Fixed it.
   
   I explained this above in the prior comment. We return null because the 
query processor can then decide what to do. A connector not existing is 
expected in some cases like "create connector" statements. 
   If HMS is down, client not able to communicate, in such scenarios, we will 
be seeing a ThriftException (RuntimeException). We will not even get a 
NoSuchObjectException in such scenarios from the HMS side. IT will fail way 
before that.
   I am not sure what login credentials you are referring to, but if the 
connector parameters are set incorrectly, it has no bearing on HMS returning 
the connector object. It will has to return what has been set on the metadata 
for the connector. Credentials being incorrect is a runtime issue.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to