Repository: hive Updated Branches: refs/heads/branch-2 c0a57a33b -> 9d9167542
HIVE-19605 : TAB_COL_STATS table has no index on db/table name (Vihang Karajgaonkar reviewed by Yongzhi Chen) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/9d916754 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/9d916754 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/9d916754 Branch: refs/heads/branch-2 Commit: 9d91675424d00e71b252915d3b4272500f7e8be4 Parents: c0a57a3 Author: Vihang Karajgaonkar <vih...@cloudera.com> Authored: Mon Jun 11 11:25:07 2018 -0700 Committer: Vihang Karajgaonkar <vih...@cloudera.com> Committed: Mon Jun 11 11:25:13 2018 -0700 ---------------------------------------------------------------------- metastore/scripts/upgrade/derby/042-HIVE-19605.derby.sql | 1 + metastore/scripts/upgrade/derby/hive-schema-2.4.0.derby.sql | 2 ++ .../scripts/upgrade/derby/upgrade-2.3.0-to-2.4.0.derby.sql | 1 + metastore/scripts/upgrade/mssql/027-HIVE-19605.mssql.sql | 1 + metastore/scripts/upgrade/mssql/hive-schema-2.4.0.mssql.sql | 1 + .../scripts/upgrade/mssql/upgrade-2.3.0-to-2.4.0.mssql.sql | 1 + metastore/scripts/upgrade/mysql/042-HIVE-19605.mysql.sql | 1 + metastore/scripts/upgrade/mysql/hive-schema-2.4.0.mysql.sql | 2 ++ .../scripts/upgrade/mysql/upgrade-2.3.0-to-2.4.0.mysql.sql | 1 + metastore/scripts/upgrade/oracle/042-HIVE-19605.oracle.sql | 1 + metastore/scripts/upgrade/oracle/hive-schema-2.4.0.oracle.sql | 2 ++ .../scripts/upgrade/oracle/upgrade-2.3.0-to-2.4.0.oracle.sql | 1 + metastore/scripts/upgrade/postgres/041-HIVE-19605.postgres.sql | 1 + .../scripts/upgrade/postgres/hive-schema-2.4.0.postgres.sql | 6 ++++++ .../upgrade/postgres/upgrade-2.3.0-to-2.4.0.postgres.sql | 1 + 15 files changed, 23 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/derby/042-HIVE-19605.derby.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/derby/042-HIVE-19605.derby.sql b/metastore/scripts/upgrade/derby/042-HIVE-19605.derby.sql new file mode 100644 index 0000000..b2f458e --- /dev/null +++ b/metastore/scripts/upgrade/derby/042-HIVE-19605.derby.sql @@ -0,0 +1 @@ +CREATE INDEX "APP"."TAB_COL_STATS_IDX" ON "APP"."TAB_COL_STATS" ("CAT_NAME", "DB_NAME", "TABLE_NAME", "COLUMN_NAME"); http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/derby/hive-schema-2.4.0.derby.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/derby/hive-schema-2.4.0.derby.sql b/metastore/scripts/upgrade/derby/hive-schema-2.4.0.derby.sql index f30b5b4..b548ce2 100644 --- a/metastore/scripts/upgrade/derby/hive-schema-2.4.0.derby.sql +++ b/metastore/scripts/upgrade/derby/hive-schema-2.4.0.derby.sql @@ -124,6 +124,8 @@ CREATE UNIQUE INDEX "APP"."DBPRIVILEGEINDEX" ON "APP"."DB_PRIVS" ("DB_ID", "PRIN CREATE INDEX "APP"."PCS_STATS_IDX" ON "APP"."PART_COL_STATS" ("DB_NAME","TABLE_NAME","COLUMN_NAME","PARTITION_NAME"); +CREATE INDEX "APP"."TAB_COL_STATS_IDX" ON "APP"."TAB_COL_STATS" ("CAT_NAME", "DB_NAME", "TABLE_NAME", "COLUMN_NAME"); + CREATE INDEX "APP"."PARTPRIVILEGEINDEX" ON "APP"."PART_PRIVS" ("PART_ID", "PRINCIPAL_NAME", "PRINCIPAL_TYPE", "PART_PRIV", "GRANTOR", "GRANTOR_TYPE"); CREATE UNIQUE INDEX "APP"."ROLEENTITYINDEX" ON "APP"."ROLES" ("ROLE_NAME"); http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-2.4.0.derby.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-2.4.0.derby.sql b/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-2.4.0.derby.sql index 58dde50..336ae62 100644 --- a/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-2.4.0.derby.sql +++ b/metastore/scripts/upgrade/derby/upgrade-2.3.0-to-2.4.0.derby.sql @@ -1,5 +1,6 @@ -- Upgrade MetaStore schema from 2.3.0 to 2.4.0 RUN '041-HIVE-19372.derby.sql'; +RUN '042-HIVE-19605.derby.sql'; UPDATE "APP".VERSION SET SCHEMA_VERSION='2.4.0', VERSION_COMMENT='Hive release version 2.4.0' where VER_ID=1; http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/mssql/027-HIVE-19605.mssql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mssql/027-HIVE-19605.mssql.sql b/metastore/scripts/upgrade/mssql/027-HIVE-19605.mssql.sql new file mode 100644 index 0000000..149a445 --- /dev/null +++ b/metastore/scripts/upgrade/mssql/027-HIVE-19605.mssql.sql @@ -0,0 +1 @@ +CREATE INDEX TAB_COL_STATS_IDX ON TAB_COL_STATS (CAT_NAME, DB_NAME, TABLE_NAME, COLUMN_NAME); http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/mssql/hive-schema-2.4.0.mssql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mssql/hive-schema-2.4.0.mssql.sql b/metastore/scripts/upgrade/mssql/hive-schema-2.4.0.mssql.sql index c6c733e..7892777 100644 --- a/metastore/scripts/upgrade/mssql/hive-schema-2.4.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/hive-schema-2.4.0.mssql.sql @@ -238,6 +238,7 @@ CREATE TABLE TAB_COL_STATS ); ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_PK PRIMARY KEY (CS_ID); +CREATE INDEX TAB_COL_STATS_IDX ON TAB_COL_STATS (CAT_NAME, DB_NAME, TABLE_NAME, COLUMN_NAME); -- Table TYPES for classes [org.apache.hadoop.hive.metastore.model.MType] CREATE TABLE TYPES http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-2.4.0.mssql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-2.4.0.mssql.sql b/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-2.4.0.mssql.sql index b3cceea..339f78e 100644 --- a/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-2.4.0.mssql.sql +++ b/metastore/scripts/upgrade/mssql/upgrade-2.3.0-to-2.4.0.mssql.sql @@ -1,6 +1,7 @@ SELECT 'Upgrading MetaStore schema from 2.3.0 to 2.4.0' AS MESSAGE; :r 026-HIVE-19372.mssql.sql +:r 027-HIVE-19605.mssql.sql UPDATE VERSION SET SCHEMA_VERSION='2.4.0', VERSION_COMMENT='Hive release version 2.4.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 2.4.0' AS MESSAGE; http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/mysql/042-HIVE-19605.mysql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mysql/042-HIVE-19605.mysql.sql b/metastore/scripts/upgrade/mysql/042-HIVE-19605.mysql.sql new file mode 100644 index 0000000..7a1b5a8 --- /dev/null +++ b/metastore/scripts/upgrade/mysql/042-HIVE-19605.mysql.sql @@ -0,0 +1 @@ +CREATE INDEX TAB_COL_STATS_IDX ON TAB_COL_STATS (CAT_NAME, DB_NAME, TABLE_NAME, COLUMN_NAME) USING BTREE; http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/mysql/hive-schema-2.4.0.mysql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mysql/hive-schema-2.4.0.mysql.sql b/metastore/scripts/upgrade/mysql/hive-schema-2.4.0.mysql.sql index 7aed5a8..6c67d0b 100644 --- a/metastore/scripts/upgrade/mysql/hive-schema-2.4.0.mysql.sql +++ b/metastore/scripts/upgrade/mysql/hive-schema-2.4.0.mysql.sql @@ -672,6 +672,8 @@ CREATE TABLE IF NOT EXISTS `TAB_COL_STATS` ( CONSTRAINT `TAB_COL_STATS_FK` FOREIGN KEY (`TBL_ID`) REFERENCES `TBLS` (`TBL_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE INDEX TAB_COL_STATS_IDX ON TAB_COL_STATS (CAT_NAME, DB_NAME, TABLE_NAME, COLUMN_NAME) USING BTREE; + -- -- Table structure for table `PART_COL_STATS` -- http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-2.4.0.mysql.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-2.4.0.mysql.sql b/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-2.4.0.mysql.sql index d85b30b..2db0a4a 100644 --- a/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-2.4.0.mysql.sql +++ b/metastore/scripts/upgrade/mysql/upgrade-2.3.0-to-2.4.0.mysql.sql @@ -1,6 +1,7 @@ SELECT 'Upgrading MetaStore schema from 2.3.0 to 2.4.0' AS ' '; SOURCE 041-HIVE-19372.mysql.sql; +SOURCE 042-HIVE-19605.mysql.sql; UPDATE VERSION SET SCHEMA_VERSION='2.4.0', VERSION_COMMENT='Hive release version 2.4.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 2.4.0' AS ' '; http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/oracle/042-HIVE-19605.oracle.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/oracle/042-HIVE-19605.oracle.sql b/metastore/scripts/upgrade/oracle/042-HIVE-19605.oracle.sql new file mode 100644 index 0000000..149a445 --- /dev/null +++ b/metastore/scripts/upgrade/oracle/042-HIVE-19605.oracle.sql @@ -0,0 +1 @@ +CREATE INDEX TAB_COL_STATS_IDX ON TAB_COL_STATS (CAT_NAME, DB_NAME, TABLE_NAME, COLUMN_NAME); http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/oracle/hive-schema-2.4.0.oracle.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/oracle/hive-schema-2.4.0.oracle.sql b/metastore/scripts/upgrade/oracle/hive-schema-2.4.0.oracle.sql index 94d1221..3554fc4 100644 --- a/metastore/scripts/upgrade/oracle/hive-schema-2.4.0.oracle.sql +++ b/metastore/scripts/upgrade/oracle/hive-schema-2.4.0.oracle.sql @@ -500,6 +500,8 @@ ALTER TABLE TAB_COL_STATS ADD CONSTRAINT TAB_COL_STATS_FK FOREIGN KEY (TBL_ID) R CREATE INDEX TAB_COL_STATS_N49 ON TAB_COL_STATS(TBL_ID); +CREATE INDEX TAB_COL_STATS_IDX ON TAB_COL_STATS (CAT_NAME, DB_NAME, TABLE_NAME, COLUMN_NAME); + CREATE TABLE PART_COL_STATS ( CS_ID NUMBER NOT NULL, DB_NAME VARCHAR2(128) NOT NULL, http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-2.4.0.oracle.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-2.4.0.oracle.sql b/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-2.4.0.oracle.sql index 3b4e273..5a5d8b0 100644 --- a/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-2.4.0.oracle.sql +++ b/metastore/scripts/upgrade/oracle/upgrade-2.3.0-to-2.4.0.oracle.sql @@ -2,6 +2,7 @@ SELECT 'Upgrading MetaStore schema from 2.3.0 to 2.4.0' AS Status from dual; @040-HIVE-16399.oracle.sql; @041-HIVE-19372.oracle.sql; +@042-HIVE-19605.oracle.sql; UPDATE VERSION SET SCHEMA_VERSION='2.4.0', VERSION_COMMENT='Hive release version 2.4.0' where VER_ID=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 2.4.0' AS Status from dual; http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/postgres/041-HIVE-19605.postgres.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/postgres/041-HIVE-19605.postgres.sql b/metastore/scripts/upgrade/postgres/041-HIVE-19605.postgres.sql new file mode 100644 index 0000000..371d0f0 --- /dev/null +++ b/metastore/scripts/upgrade/postgres/041-HIVE-19605.postgres.sql @@ -0,0 +1 @@ +CREATE INDEX "TAB_COL_STATS_IDX" ON "TAB_COL_STATS" USING btree ("CAT_NAME", "DB_NAME","TABLE_NAME","COLUMN_NAME"); http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/postgres/hive-schema-2.4.0.postgres.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/postgres/hive-schema-2.4.0.postgres.sql b/metastore/scripts/upgrade/postgres/hive-schema-2.4.0.postgres.sql index ffa29cf..4866788 100644 --- a/metastore/scripts/upgrade/postgres/hive-schema-2.4.0.postgres.sql +++ b/metastore/scripts/upgrade/postgres/hive-schema-2.4.0.postgres.sql @@ -1175,6 +1175,12 @@ CREATE INDEX "TYPE_FIELDS_N49" ON "TYPE_FIELDS" USING btree ("TYPE_NAME"); CREATE INDEX "TAB_COL_STATS_N49" ON "TAB_COL_STATS" USING btree ("TBL_ID"); -- +-- Name: TAB_COL_STATS_IDX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: +-- + +CREATE INDEX "TAB_COL_STATS_IDX" ON "TAB_COL_STATS" USING btree ("CAT_NAME", "DB_NAME","TABLE_NAME","COLUMN_NAME"); + +-- -- Name: PART_COL_STATS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: -- http://git-wip-us.apache.org/repos/asf/hive/blob/9d916754/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-2.4.0.postgres.sql ---------------------------------------------------------------------- diff --git a/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-2.4.0.postgres.sql b/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-2.4.0.postgres.sql index 1b2a52a..b74e6e0 100644 --- a/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-2.4.0.postgres.sql +++ b/metastore/scripts/upgrade/postgres/upgrade-2.3.0-to-2.4.0.postgres.sql @@ -2,6 +2,7 @@ SELECT 'Upgrading MetaStore schema from 2.3.0 to 2.4.0'; \i 039-HIVE-16399.postgres.sql; \i 040-HIVE-19372.postgres.sql; +\i 041-HIVE-19605.postgres.sql; UPDATE "VERSION" SET "SCHEMA_VERSION"='2.4.0', "VERSION_COMMENT"='Hive release version 2.4.0' where "VER_ID"=1; SELECT 'Finished upgrading MetaStore schema from 2.3.0 to 2.4.0';