duplicate key name while upgrading hive

while trying to upgrade hive from 2.1.0 to 2.3.0 getting below error (actually upgrading emr 5.7.0 to 5.8.0)

init hive-metastore schema]/returns: 0: jdbc:mysql://connection_string-> CREATE INDEX PCS_STATS_IDX ON PART_COL_STATS (DB_NAME,TABLE_NAME,COLUMN_NAME,PARTITION_NAME) USING BTREE Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061) Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: Closing: 0: jdbc:mysql://connection_string:3306/hive?createDatabaseIfNotExist=true Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !! Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:586) Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: ... 8 more Notice: /Stage[main]/Hadoop_hive::Init_metastore_schema/Exec[init hive-metastore schema]/returns: *** schemaTool failed ***

Is there a way to resolve without manually dropping already created index PCS_STATS_IDX in hive external metastore?

Relevant tags