hive git commit: HIVE-20785: Wrong key name in the JDBC DatabaseMetaData.getPrimaryKeys method (Guillaume Grossetie reviewed by Prasanth Jayachandran)

2018-12-17 Thread prasanthj
Repository: hive
Updated Branches:
  refs/heads/branch-3 3db928668 -> 1ea6e49cf


HIVE-20785: Wrong key name in the JDBC DatabaseMetaData.getPrimaryKeys method 
(Guillaume Grossetie reviewed by Prasanth Jayachandran)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1ea6e49c
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1ea6e49c
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1ea6e49c

Branch: refs/heads/branch-3
Commit: 1ea6e49cf9eac41908ee2952917eba7bce656179
Parents: 3db9286
Author: Guillaume Grossetie 
Authored: Mon Dec 17 16:59:37 2018 -0800
Committer: Prasanth Jayachandran 
Committed: Mon Dec 17 17:02:08 2018 -0800

--
 .../apache/hive/service/cli/operation/GetPrimaryKeysOperation.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/1ea6e49c/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
 
b/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
index e603fdd..2daa60e 100644
--- 
a/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
+++ 
b/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
@@ -60,7 +60,7 @@ PK_NAME String => primary key name (may be null)
   "Table name")
   .addPrimitiveColumn("COLUMN_NAME", Type.STRING_TYPE,
   "Column name")
-  .addPrimitiveColumn("KEQ_SEQ", Type.INT_TYPE,
+  .addPrimitiveColumn("KEY_SEQ", Type.INT_TYPE,
   "Sequence number within primary key")
   .addPrimitiveColumn("PK_NAME", Type.STRING_TYPE,
   "Primary key name (may be null)");



hive git commit: HIVE-20785: Wrong key name in the JDBC DatabaseMetaData.getPrimaryKeys method (Guillaume Grossetie reviewed by Prasanth Jayachandran)

2018-12-17 Thread prasanthj
Repository: hive
Updated Branches:
  refs/heads/master ec5ce5da8 -> 87f8eccf9


HIVE-20785: Wrong key name in the JDBC DatabaseMetaData.getPrimaryKeys method 
(Guillaume Grossetie reviewed by Prasanth Jayachandran)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/87f8eccf
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/87f8eccf
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/87f8eccf

Branch: refs/heads/master
Commit: 87f8eccf92c4be11858b1559e501f854eb814542
Parents: ec5ce5d
Author: Guillaume Grossetie 
Authored: Mon Dec 17 16:59:37 2018 -0800
Committer: Prasanth Jayachandran 
Committed: Mon Dec 17 17:01:14 2018 -0800

--
 .../apache/hive/service/cli/operation/GetPrimaryKeysOperation.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/87f8eccf/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
 
b/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
index 55f4ab6..0e5d5c1 100644
--- 
a/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
+++ 
b/service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java
@@ -62,7 +62,7 @@ PK_NAME String => primary key name (may be null)
   "Table name")
   .addPrimitiveColumn("COLUMN_NAME", Type.STRING_TYPE,
   "Column name")
-  .addPrimitiveColumn("KEQ_SEQ", Type.INT_TYPE,
+  .addPrimitiveColumn("KEY_SEQ", Type.INT_TYPE,
   "Sequence number within primary key")
   .addPrimitiveColumn("PK_NAME", Type.STRING_TYPE,
   "Primary key name (may be null)");



hive git commit: HIVE-19081: Add partition should prevent loading acid files (Igor Kryvenko via Eugene Koifman)

2018-12-17 Thread ekoifman
Repository: hive
Updated Branches:
  refs/heads/master 4d9df0fdf -> ec5ce5da8


HIVE-19081: Add partition should prevent loading acid files (Igor Kryvenko via 
Eugene Koifman)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/ec5ce5da
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ec5ce5da
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ec5ce5da

Branch: refs/heads/master
Commit: ec5ce5da8079f50b8555b5178e739ec71eafa3fa
Parents: 4d9df0f
Author: Igor Kryvenko 
Authored: Mon Dec 17 13:48:42 2018 -0800
Committer: Eugene Koifman 
Committed: Mon Dec 17 16:47:11 2018 -0800

--
 .../org/apache/hadoop/hive/ql/ErrorMsg.java |  2 +-
 .../org/apache/hadoop/hive/ql/io/AcidUtils.java | 43 
 .../hive/ql/parse/DDLSemanticAnalyzer.java  |  1 +
 .../hive/ql/parse/LoadSemanticAnalyzer.java | 23 +--
 .../hadoop/hive/ql/TestTxnAddPartition.java | 26 +++-
 5 files changed, 71 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/ec5ce5da/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java 
b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
index 1a58311..d58f626 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
@@ -461,7 +461,7 @@ public enum ErrorMsg {
 "Grouping sets size cannot be greater than 64"),
   REBUILD_NO_MATERIALIZED_VIEW(10412, "Rebuild command only valid for 
materialized views"),
   LOAD_DATA_ACID_FILE(10413,
-  "\"{0}\" was created created by Acid write - it cannot be loaded into 
anther Acid table",
+  "\"{0}\" was created by Acid write - it cannot be loaded into anther 
Acid table",
   true),
   ACID_OP_ON_INSERTONLYTRAN_TABLE(10414, "Attempt to do update or delete on 
table {0} that is " +
 "insert-only transactional", true),

http://git-wip-us.apache.org/repos/asf/hive/blob/ec5ce5da/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java 
b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
index d36b4d1..badcc55 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java
@@ -22,6 +22,8 @@ import static 
org.apache.hadoop.hive.ql.exec.Utilities.COPY_KEYWORD;
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -65,6 +67,8 @@ import org.apache.hadoop.hive.ql.lockmgr.HiveTxnManager;
 import org.apache.hadoop.hive.ql.lockmgr.LockException;
 import org.apache.hadoop.hive.ql.metadata.HiveStorageHandler;
 import org.apache.hadoop.hive.ql.metadata.Table;
+import org.apache.hadoop.hive.ql.parse.LoadSemanticAnalyzer;
+import org.apache.hadoop.hive.ql.parse.SemanticException;
 import org.apache.hadoop.hive.ql.plan.CreateTableDesc;
 import org.apache.hadoop.hive.ql.plan.TableScanDesc;
 import org.apache.hadoop.hive.ql.session.SessionState;
@@ -2493,4 +2497,43 @@ public class AcidUtils {
 }
 return lockComponents;
   }
+
+  /**
+   * Safety check to make sure a file take from one acid table is not added 
into another acid table
+   * since the ROW__IDs embedded as part a write to one table won't make sense 
in different
+   * table/cluster.
+   */
+  public static void validateAcidFiles(Table table, FileStatus[] srcs, 
FileSystem fs) throws SemanticException {
+if (!AcidUtils.isFullAcidTable(table)) {
+  return;
+}
+validateAcidFiles(srcs, fs);
+  }
+
+  private static void validateAcidFiles(FileStatus[] srcs, FileSystem fs) 
throws SemanticException {
+try {
+  for (FileStatus oneSrc : srcs) {
+if (!AcidUtils.MetaDataFile.isRawFormatFile(oneSrc.getPath(), fs)) {
+  throw new SemanticException(ErrorMsg.LOAD_DATA_ACID_FILE, 
oneSrc.getPath().toString());
+}
+  }
+} catch (IOException ex) {
+  throw new SemanticException(ex);
+}
+  }
+
+  /**
+   * Safety check to make sure the given location is not the location of acid 
table and
+   * all it's files  will be not added into another acid table
+   */
+  public static void validateAcidPartitionLocation(String location, 
Configuration conf) throws SemanticException {
+try {
+  URI uri = new URI(location);
+  FileSystem fs = FileSystem.get(uri, conf);
+  FileStatus[] fileStatuses = LoadSemanticAnalyzer.matchFilesOrDir(fs, new 
Path(uri));
+  validateAcidFiles(fileStatuses, fs);
+} catch 

hive git commit: HIVE-20992 : Split the config hive.metastore.dbaccess.ssl.properties into more meaningful configs (Morio Ramdenbourg reviewed by Karthik Manamcheri and Vihang Karajgaonkar)

2018-12-17 Thread vihangk1
Repository: hive
Updated Branches:
  refs/heads/master 4e415609c -> 4d9df0fdf


HIVE-20992 : Split the config hive.metastore.dbaccess.ssl.properties into more 
meaningful configs (Morio Ramdenbourg reviewed by Karthik Manamcheri and Vihang 
Karajgaonkar)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/4d9df0fd
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4d9df0fd
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4d9df0fd

Branch: refs/heads/master
Commit: 4d9df0fdf4f31adceacb67195497deddbf624103
Parents: 4e41560
Author: Morio Ramdenbourg 
Authored: Mon Dec 17 13:25:35 2018 -0800
Committer: Vihang Karajgaonkar 
Committed: Mon Dec 17 13:58:16 2018 -0800

--
 .../hive/metastore/conf/MetastoreConf.java  | 35 -
 .../hadoop/hive/metastore/ObjectStore.java  | 78 +++-
 .../hadoop/hive/metastore/TestObjectStore.java  | 74 +++
 3 files changed, 181 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/4d9df0fd/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
--
diff --git 
a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
 
b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
index e25a8cf..400097b 100644
--- 
a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
+++ 
b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
@@ -247,7 +247,9 @@ public class MetastoreConf {
   ConfVars.SSL_KEYSTORE_PASSWORD.varname,
   ConfVars.SSL_KEYSTORE_PASSWORD.hiveName,
   ConfVars.SSL_TRUSTSTORE_PASSWORD.varname,
-  ConfVars.SSL_TRUSTSTORE_PASSWORD.hiveName
+  ConfVars.SSL_TRUSTSTORE_PASSWORD.hiveName,
+  ConfVars.DBACCESS_SSL_TRUSTSTORE_PASSWORD.varname,
+  ConfVars.DBACCESS_SSL_TRUSTSTORE_PASSWORD.hiveName
   );
 
   public static ConfVars getMetaConf(String name) {
@@ -452,9 +454,26 @@ public class MetastoreConf {
 "Default transaction isolation level for identity generation."),
 
DATANUCLEUS_USE_LEGACY_VALUE_STRATEGY("datanucleus.rdbms.useLegacyNativeValueStrategy",
 "datanucleus.rdbms.useLegacyNativeValueStrategy", true, ""),
-DBACCESS_SSL_PROPS("metastore.dbaccess.ssl.properties", 
"hive.metastore.dbaccess.ssl.properties", "",
-"Comma-separated SSL properties for metastore to access database when 
JDO connection URL\n" +
-"enables SSL access. e.g. 
javax.net.ssl.trustStore=/tmp/truststore,javax.net.ssl.trustStorePassword=pwd."),
+
+// Parameters for configuring SSL encryption to the database store
+// If DBACCESS_USE_SSL is false, then all other DBACCESS_SSL_* properties 
will be ignored
+
DBACCESS_SSL_TRUSTSTORE_PASSWORD("metastore.dbaccess.ssl.truststore.password", 
"hive.metastore.dbaccess.ssl.truststore.password", "",
+"Password for the Java truststore file that is used when encrypting 
the connection to the database store. \n"
++ "This directly maps to the javax.net.ssl.trustStorePassword Java 
system property. \n"
++ "While Java does allow an empty truststore password, we highly 
recommend against this. \n"
++ "An empty password can compromise the integrity of the 
truststore file."),
+DBACCESS_SSL_TRUSTSTORE_PATH("metastore.dbaccess.ssl.truststore.path", 
"hive.metastore.dbaccess.ssl.truststore.path", "",
+"Location on disk of the Java truststore file to use when encrypting 
the connection to the database store. \n"
++ "This directly maps to the javax.net.ssl.trustStore Java system 
property. \n"
++ "This file consists of a collection of certificates trusted by 
the metastore server.\n"),
+DBACCESS_SSL_TRUSTSTORE_TYPE("metastore.dbaccess.ssl.truststore.type", 
"hive.metastore.dbaccess.ssl.truststore.type", "jks",
+new StringSetValidator("jceks", "jks", "dks", "pkcs11", "pkcs12"),
+"File type for the Java truststore file that is used when encrypting 
the connection to the database store. \n"
++ "This directly maps to the javax.net.ssl.trustStoreType Java 
system property. \n"
++ "Types jceks, jks, dks, pkcs11, and pkcs12 can be read from Java 
8 and beyond. We default to jks. \n"),
+DBACCESS_USE_SSL("metastore.dbaccess.ssl.use.SSL", 
"hive.metastore.dbaccess.ssl.use.SSL", false,
+"Set this to true to use SSL encryption to the database store."),
+
 DEFAULTPARTITIONNAME("metastore.default.partition.name",
 "hive.exec.default.partition.name",