Skip to content

Commit

Permalink
HIVE-27749: Addendum: SchemaTool initSchema fails on Mariadb 10.2 - F…
Browse files Browse the repository at this point in the history
…ix INSERT query (#5009) (Sourabh Badhya reviewed by Attila Turoczy, Denys Kuzmenko)
  • Loading branch information
SourabhBadhya authored Jan 18, 2024
1 parent 1097dde commit 9c4eb96
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ CREATE TABLE IF NOT EXISTS `NOTIFICATION_SEQUENCE`

ALTER TABLE `NOTIFICATION_SEQUENCE` ADD CONSTRAINT `ONE_ROW_CONSTRAINT` CHECK (`NNI_ID` = 1);

INSERT INTO `NOTIFICATION_SEQUENCE` (`NEXT_EVENT_ID`) SELECT * from (select 1 as `NOTIFICATION_SEQUENCE`) a WHERE (SELECT COUNT(*) FROM `NOTIFICATION_SEQUENCE`) = 0;
INSERT INTO `NOTIFICATION_SEQUENCE` (`NNI_ID`, `NEXT_EVENT_ID`) SELECT 1,1 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `NOTIFICATION_SEQUENCE`);

CREATE TABLE IF NOT EXISTS `KEY_CONSTRAINTS`
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ CREATE TABLE IF NOT EXISTS `NOTIFICATION_SEQUENCE`

ALTER TABLE `NOTIFICATION_SEQUENCE` ADD CONSTRAINT `ONE_ROW_CONSTRAINT` CHECK (`NNI_ID` = 1);

INSERT INTO `NOTIFICATION_SEQUENCE` (`NEXT_EVENT_ID`) SELECT * from (select 1 as `NOTIFICATION_SEQUENCE`) a WHERE (SELECT COUNT(*) FROM `NOTIFICATION_SEQUENCE`) = 0;
INSERT INTO `NOTIFICATION_SEQUENCE` (`NNI_ID`, `NEXT_EVENT_ID`) SELECT 1,1 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `NOTIFICATION_SEQUENCE`);

CREATE TABLE IF NOT EXISTS `KEY_CONSTRAINTS`
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,9 @@ CREATE TABLE IF NOT EXISTS `NOTIFICATION_SEQUENCE`
PRIMARY KEY (`NNI_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `NOTIFICATION_SEQUENCE` MODIFY COLUMN `NNI_ID` BIGINT(20) GENERATED ALWAYS AS (1) STORED NOT NULL;
ALTER TABLE `NOTIFICATION_SEQUENCE` ADD CONSTRAINT `ONE_ROW_CONSTRAINT` CHECK (`NNI_ID` = 1);

INSERT INTO `NOTIFICATION_SEQUENCE` (`NEXT_EVENT_ID`) SELECT * from (select 1 as `NOTIFICATION_SEQUENCE`) a WHERE (SELECT COUNT(*) FROM `NOTIFICATION_SEQUENCE`) = 0;
INSERT INTO `NOTIFICATION_SEQUENCE` (`NNI_ID`, `NEXT_EVENT_ID`) SELECT 1,1 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `NOTIFICATION_SEQUENCE`);

CREATE TABLE IF NOT EXISTS `KEY_CONSTRAINTS`
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.metastore.dbinstall.rules.DatabaseRule;
import org.apache.hadoop.hive.metastore.dbinstall.rules.Derby;
import org.apache.hadoop.hive.metastore.dbinstall.rules.Mariadb;
import org.apache.hadoop.hive.metastore.dbinstall.rules.Mssql;
import org.apache.hadoop.hive.metastore.dbinstall.rules.Mysql;
import org.apache.hadoop.hive.metastore.dbinstall.rules.Oracle;
Expand Down Expand Up @@ -85,7 +86,7 @@ public static Collection<Object[]> databases() {
dbs.add(new Object[] { new Mysql() });
dbs.add(new Object[] { new Oracle() });
dbs.add(new Object[] { new Postgres() });
// dbs.add(new Object[] { new Mariadb() }); Disabled due to HIVE-27749
dbs.add(new Object[] { new Mariadb() });
dbs.add(new Object[] { new Mssql() });
return dbs;
}
Expand Down

0 comments on commit 9c4eb96

Please sign in to comment.