[GitHub] [hive] kishendas commented on a change in pull request #1355: send tableId to get_partition APIs

2020-08-06 Thread GitBox


kishendas commented on a change in pull request #1355:
URL: https://github.com/apache/hive/pull/1355#discussion_r466627274



##
File path: ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestTxnManager.java
##
@@ -0,0 +1,71 @@
+/*
+ * 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.lockmgr;
+
+import org.apache.hadoop.hive.common.FileUtils;
+import org.apache.hadoop.hive.common.ValidTxnWriteIdList;
+import org.apache.hadoop.hive.metastore.api.CommitTxnRequest;
+import org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse;
+import org.apache.hadoop.hive.metastore.api.TxnToWriteId;
+import org.apache.hadoop.hive.metastore.api.TxnType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.hadoop.hive.common.ValidTxnList;
+import org.apache.hadoop.hive.common.ValidReadTxnList;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.api.Database;
+import org.apache.hadoop.hive.ql.Context;
+import org.apache.hadoop.hive.ql.ErrorMsg;
+import org.apache.hadoop.hive.ql.DriverState;
+import org.apache.hadoop.hive.ql.QueryPlan;
+import org.apache.hadoop.hive.ql.hooks.ReadEntity;
+import org.apache.hadoop.hive.ql.hooks.WriteEntity;
+import org.apache.hadoop.hive.ql.metadata.DummyPartition;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.metadata.Partition;
+import org.apache.hadoop.hive.ql.metadata.Table;
+import org.apache.hadoop.util.ReflectionUtils;
+
+import java.util.*;
+
+/**
+ * An implementation of {@link HiveTxnManager} that does not support
+ * transactions.
+ * This class is only used in test.
+ */
+class TestTxnManager extends DummyTxnManager {
+  final static Character SEMICOLON = ':';

Review comment:
   :-) It's a COLON. 

##
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##
@@ -5292,6 +5303,16 @@ public synchronized SynchronizedMetaStoreClient 
getSynchronizedMSC() throws Meta
 return syncMetaStoreClient;
   }
 
+/**
+   * @return the metastore client for the current thread
+   * @throws MetaException
+   */
+  @LimitedPrivate(value = {"Hive"})

Review comment:
   Sure





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org



[GitHub] [hive] kishendas commented on a change in pull request #1355: send tableId to get_partition APIs

2020-08-06 Thread GitBox


kishendas commented on a change in pull request #1355:
URL: https://github.com/apache/hive/pull/1355#discussion_r466626987



##
File path: 
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHiveMetaStoreClient.java
##
@@ -0,0 +1,119 @@
+/*
+ * 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.metadata;

Review comment:
   Makes sense. 





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org



[GitHub] [hive] kishendas commented on a change in pull request #1355: send tableId to get_partition APIs

2020-08-06 Thread GitBox


kishendas commented on a change in pull request #1355:
URL: https://github.com/apache/hive/pull/1355#discussion_r466626887



##
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##
@@ -474,6 +476,12 @@ public static Hive get() throws HiveException {
 return get(true);
   }
 
+  public static Hive get(IMetaStoreClient msc) throws HiveException, 
MetaException {

Review comment:
   Done.





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org



[GitHub] [hive] kishendas commented on a change in pull request #1355: send tableId to get_partition APIs

2020-08-06 Thread GitBox


kishendas commented on a change in pull request #1355:
URL: https://github.com/apache/hive/pull/1355#discussion_r466625978



##
File path: 
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHiveMetaStoreClientApiArgumentsChecker.java
##
@@ -0,0 +1,140 @@
+/*
+ * 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.metadata;
+
+import com.google.common.collect.Lists;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.hive.common.ValidTxnList;
+import org.apache.hadoop.hive.common.ValidWriteIdList;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.IMetaStoreClient;
+import org.apache.hadoop.hive.metastore.TableType;
+import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
+import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
+import org.apache.hadoop.hive.ql.Context;
+import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
+import org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc;
+import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
+import org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc;
+import org.apache.hadoop.hive.ql.session.SessionState;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.thrift.TException;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * TestHiveMetaStoreClientApiArgumentsChecker
+ *
+ * This class works with {@link TestHiveMetaStoreClient} in order to verify 
the arguments that
+ * are sent from HS2 to HMS APIs.
+ *
+ */
+public class TestHiveMetaStoreClientApiArgumentsChecker {
+
+  private Hive hive;
+  private IMetaStoreClient msc;
+  private FileSystem fs;
+  final static String DB_NAME = "db";
+  final static String TABLE_NAME = "table";
+  private IMetaStoreClient client;
+  private Table t;
+
+  protected static final String USER_NAME = "user0";
+
+  @Before
+  public void setUp() throws Exception {
+
+client = new TestHiveMetaStoreClient(new HiveConf(Hive.class));
+hive = Hive.get(client);
+
hive.getConf().set(MetastoreConf.ConfVars.FS_HANDLER_THREADS_COUNT.getVarname(),
 "15");
+
hive.getConf().set(MetastoreConf.ConfVars.MSCK_PATH_VALIDATION.getVarname(), 
"throw");
+msc = new HiveMetaStoreClient(hive.getConf());
+
+hive.getConf().setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER,
+
"org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
+HiveConf.setBoolVar(hive.getConf(), 
HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
+hive.getConf().set(ValidTxnList.VALID_TXNS_KEY, "1:");
+hive.getConf().set(ValidWriteIdList.VALID_WRITEIDS_KEY, TABLE_NAME + 
":1:");
+hive.getConf().setVar(HiveConf.ConfVars.HIVE_TXN_MANAGER, 
"org.apache.hadoop.hive.ql.lockmgr.TestTxnManager");
+SessionState.start(hive.getConf());
+SessionState.get().initTxnMgr(hive.getConf());
+Context ctx = new Context(hive.getConf());
+SessionState.get().getTxnMgr().openTxn(ctx, USER_NAME);
+
+t = new Table();
+org.apache.hadoop.hive.metastore.api.Table tTable = new 
org.apache.hadoop.hive.metastore.api.Table();
+tTable.setId(Long.MAX_VALUE);
+t.setTTable(tTable);
+Map parameters = new HashMap<>();
+parameters.put(hive_metastoreConstants.TABLE_IS_TRANSACTIONAL, "true");

Review comment:
   HS2 methods have explicit checks to know whether a given table is 
transactional or not. So, validWriteIdList and tableId are only set for 
transactional tables. 





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: