--
-- Table structure for table SERDES
--
CREATE TABLE IF NOT EXISTS metastore.SERDES (
  SERDE_ID bigint(20) NOT NULL,
  NAME varchar(128)  DEFAULT NULL,
  SLIB varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (SERDE_ID)
);

--
-- Table structure for table SDS
--
CREATE TABLE IF NOT EXISTS metastore.SDS (
  SD_ID bigint(20) NOT NULL,
  INPUT_FORMAT varchar(4000)  DEFAULT NULL,
  IS_COMPRESSED bit(1) NOT NULL,
  LOCATION varchar(4000)  DEFAULT NULL,
  NUM_BUCKETS int(11) NOT NULL,
  OUTPUT_FORMAT varchar(4000)  DEFAULT NULL,
  SERDE_ID bigint(20) DEFAULT NULL,
  PRIMARY KEY (SD_ID),
  CONSTRAINT SDS_FK1 FOREIGN KEY (SERDE_ID) REFERENCES metastore.SERDES (SERDE_ID)
);
CREATE INDEX IF NOT EXISTS SDS_N49 on metastore.SDS (SERDE_ID);

--
-- Table structure for table DBS
--
CREATE TABLE IF NOT EXISTS metastore.DBS (
  DB_ID bigint(20) NOT NULL,
  DESC varchar(4000)  DEFAULT NULL,
  DB_LOCATION_URI varchar(4000)  NOT NULL,
  NAME varchar(128)  DEFAULT NULL,
  PRIMARY KEY (DB_ID),
  UNIQUE KEY UNIQUE_DATABASE (NAME)
);

--
-- Table structure for table GLOBAL_PRIVS
--
CREATE TABLE IF NOT EXISTS metastore.GLOBAL_PRIVS (
  USER_GRANT_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  USER_PRIV varchar(128)  DEFAULT NULL,
  PRIMARY KEY (USER_GRANT_ID),
  UNIQUE KEY GLOBALPRIVILEGEINDEX (PRINCIPAL_NAME,PRINCIPAL_TYPE,USER_PRIV,GRANTOR,GRANTOR_TYPE)
);

--
-- Table structure for table ROLES
--
CREATE TABLE IF NOT EXISTS metastore.ROLES (
  ROLE_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  OWNER_NAME varchar(128)  DEFAULT NULL,
  ROLE_NAME varchar(128)  DEFAULT NULL,
  PRIMARY KEY (ROLE_ID),
  UNIQUE KEY ROLEENTITYINDEX (ROLE_NAME)
);

--
-- Table structure for table SEQUENCE_TABLE
--
CREATE TABLE IF NOT EXISTS metastore.SEQUENCE_TABLE (
  SEQUENCE_NAME varchar(255)  NOT NULL,
  NEXT_VAL bigint(20) NOT NULL,
  PRIMARY KEY (SEQUENCE_NAME)
);

--
-- Table structure for table NUCLEUS_TABLES
--
CREATE TABLE IF NOT EXISTS metastore.NUCLEUS_TABLES (
  CLASS_NAME varchar(128)  NOT NULL,
  TABLE_NAME varchar(128)  NOT NULL,
  TYPE varchar(4)  NOT NULL,
  OWNER varchar(2)  NOT NULL,
  VERSION varchar(20)  NOT NULL,
  INTERFACE_NAME varchar(255)  DEFAULT NULL,
  PRIMARY KEY (CLASS_NAME)
);

--
-- Table structure for table TYPES
--
CREATE TABLE IF NOT EXISTS metastore.TYPES (
  TYPES_ID bigint(20) NOT NULL,
  TYPE_NAME varchar(128)  DEFAULT NULL,
  TYPE1 varchar(767)  DEFAULT NULL,
  TYPE2 varchar(767)  DEFAULT NULL,
  PRIMARY KEY (TYPES_ID),
  UNIQUE KEY UNIQUE_TYPE (TYPE_NAME)
);

--
-- Table structure for table TBLS
--
CREATE TABLE IF NOT EXISTS metastore.TBLS (
  TBL_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  DB_ID bigint(20) DEFAULT NULL,
  LAST_ACCESS_TIME int(11) NOT NULL,
  OWNER varchar(767)  DEFAULT NULL,
  RETENTION int(11) NOT NULL,
  SD_ID bigint(20) DEFAULT NULL,
  TBL_NAME varchar(128)  DEFAULT NULL,
  TBL_TYPE varchar(128)  DEFAULT NULL,
  VIEW_EXPANDED_TEXT mediumtext,
  VIEW_ORIGINAL_TEXT mediumtext,
  PRIMARY KEY (TBL_ID),
  UNIQUE KEY UNIQUETABLE (TBL_NAME,DB_ID),  
  CONSTRAINT TBLS_FK1 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID),
  CONSTRAINT TBLS_FK2 FOREIGN KEY (DB_ID) REFERENCES metastore.DBS (DB_ID)
);
CREATE INDEX IF NOT EXISTS TBLS_N50 on metastore.TBLS (SD_ID);
CREATE INDEX IF NOT EXISTS TBLS_N49 on metastore.TBLS (DB_ID);
--
-- Table structure for table BUCKETING_COLS
--
CREATE TABLE IF NOT EXISTS metastore.BUCKETING_COLS (
  SD_ID bigint(20) NOT NULL,
  BUCKET_COL_NAME varchar(256) DEFAULT NULL,
  INTEGER_IDX int(11) NOT NULL,
  PRIMARY KEY (SD_ID,INTEGER_IDX),
  CONSTRAINT BUCKETING_COLS_FK1 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID)
);
CREATE INDEX IF NOT EXISTS BUCKETING_COLS_N49 on metastore.BUCKETING_COLS (SD_ID);

--
-- Table structure for table COLUMNS
--
CREATE TABLE IF NOT EXISTS metastore.COLUMNS (
  SD_ID bigint(20) NOT NULL,
  COMMENT varchar(256)  DEFAULT NULL,
  COLUMN_NAME varchar(128)  NOT NULL,
  TYPE_NAME varchar(4000)  NOT NULL,
  INTEGER_IDX int(11) NOT NULL,
  PRIMARY KEY (SD_ID,COLUMN_NAME),
  CONSTRAINT COLUMNS_FK1 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID)
);
CREATE INDEX IF NOT EXISTS COLUMNS_N49 on metastore.COLUMNS (SD_ID);

--
-- Table structure for table DATABASE_PARAMS
--
CREATE TABLE IF NOT EXISTS metastore.DATABASE_PARAMS (
  DB_ID bigint(20) NOT NULL,
  PARAM_KEY varchar(180)  NOT NULL,
  PARAM_VALUE varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (DB_ID,PARAM_KEY),
  CONSTRAINT DATABASE_PARAMS_FK1 FOREIGN KEY (DB_ID) REFERENCES metastore.DBS (DB_ID)
);
CREATE INDEX IF NOT EXISTS DATABASE_PARAMS_N49 on metastore.DATABASE_PARAMS (DB_ID);

--
-- Table structure for table DB_PRIVS
--
CREATE TABLE IF NOT EXISTS metastore.DB_PRIVS (
  DB_GRANT_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  DB_ID bigint(20) DEFAULT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  DB_PRIV varchar(128)  DEFAULT NULL,
  PRIMARY KEY (DB_GRANT_ID),
  UNIQUE KEY DBPRIVILEGEINDEX (DB_ID,PRINCIPAL_NAME,PRINCIPAL_TYPE,DB_PRIV,GRANTOR,GRANTOR_TYPE),
  CONSTRAINT DB_PRIVS_FK1 FOREIGN KEY (DB_ID) REFERENCES metastore.DBS (DB_ID)
);
CREATE INDEX IF NOT EXISTS DB_PRIVS_N49 on metastore.DB_PRIVS (DB_ID);

--
-- Table structure for table IDXS
--
CREATE TABLE IF NOT EXISTS metastore.IDXS (
  INDEX_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  DEFERRED_REBUILD bit(1) NOT NULL,
  INDEX_HANDLER_CLASS varchar(4000)  DEFAULT NULL,
  INDEX_NAME varchar(128)  DEFAULT NULL,
  INDEX_TBL_ID bigint(20) DEFAULT NULL,
  LAST_ACCESS_TIME int(11) NOT NULL,
  ORIG_TBL_ID bigint(20) DEFAULT NULL,
  SD_ID bigint(20) DEFAULT NULL,
  PRIMARY KEY (INDEX_ID),
  UNIQUE KEY UNIQUEINDEX (INDEX_NAME,ORIG_TBL_ID),
  CONSTRAINT IDXS_FK3 FOREIGN KEY (INDEX_TBL_ID) REFERENCES metastore.TBLS (TBL_ID),
  CONSTRAINT IDXS_FK1 FOREIGN KEY (ORIG_TBL_ID) REFERENCES metastore.TBLS (TBL_ID),
  CONSTRAINT IDXS_FK2 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID)
);
CREATE INDEX IF NOT EXISTS IDXS_N51 on metastore.IDXS (SD_ID);
CREATE INDEX IF NOT EXISTS IDXS_N50 on metastore.IDXS (INDEX_TBL_ID);
CREATE INDEX IF NOT EXISTS IDXS_N49 on metastore.IDXS (ORIG_TBL_ID);

--
-- Table structure for table INDEX_PARAMS
--
CREATE TABLE IF NOT EXISTS metastore.INDEX_PARAMS (
  INDEX_ID bigint(20) NOT NULL,
  PARAM_KEY varchar(256)  NOT NULL,
  PARAM_VALUE varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (INDEX_ID,PARAM_KEY),
  CONSTRAINT INDEX_PARAMS_FK1 FOREIGN KEY (INDEX_ID) REFERENCES metastore.IDXS (INDEX_ID)
);
CREATE INDEX IF NOT EXISTS INDEX_PARAMS_N49 on metastore.INDEX_PARAMS (INDEX_ID);

--
-- Table structure for table PARTITIONS
--
CREATE TABLE IF NOT EXISTS metastore.PARTITIONS (
  PART_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  LAST_ACCESS_TIME int(11) NOT NULL,
  PART_NAME varchar(767)  DEFAULT NULL,
  SD_ID bigint(20) DEFAULT NULL,
  TBL_ID bigint(20) DEFAULT NULL,
  PRIMARY KEY (PART_ID),
  UNIQUE KEY UNIQUEPARTITION (PART_NAME,TBL_ID),
  CONSTRAINT PARTITIONS_FK2 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID),
  CONSTRAINT PARTITIONS_FK1 FOREIGN KEY (TBL_ID) REFERENCES metastore.TBLS (TBL_ID)
);
CREATE INDEX IF NOT EXISTS PARTITIONS_N49 on metastore.PARTITIONS (TBL_ID);
CREATE INDEX IF NOT EXISTS PARTITIONS_N50 on metastore.PARTITIONS (TBL_ID);

--
-- Table structure for table PARTITION_KEYS
--
CREATE TABLE IF NOT EXISTS metastore.PARTITION_KEYS (
  TBL_ID bigint(20) NOT NULL,
  PKEY_COMMENT varchar(4000)  DEFAULT NULL,
  PKEY_NAME varchar(128)  NOT NULL,
  PKEY_TYPE varchar(767)  NOT NULL,
  INTEGER_IDX int(11) NOT NULL,
  PRIMARY KEY (TBL_ID,PKEY_NAME),
  CONSTRAINT PARTITION_KEYS_FK1 FOREIGN KEY (TBL_ID) REFERENCES metastore.TBLS (TBL_ID)
);
CREATE INDEX IF NOT EXISTS PARTITION_KEYS_N49 on metastore.PARTITION_KEYS (TBL_ID);

--
-- Table structure for table PARTITION_KEY_VALS
--
CREATE TABLE IF NOT EXISTS metastore.PARTITION_KEY_VALS (
  PART_ID bigint(20) NOT NULL,
  PART_KEY_VAL varchar(256)  DEFAULT NULL,
  INTEGER_IDX int(11) NOT NULL,
  PRIMARY KEY (PART_ID,INTEGER_IDX),
  CONSTRAINT PARTITION_KEY_VALS_FK1 FOREIGN KEY (PART_ID) REFERENCES metastore.PARTITIONS (PART_ID)
);
CREATE INDEX IF NOT EXISTS PARTITION_KEY_VALS_N49 on metastore.PARTITION_KEY_VALS (PART_ID);

--
-- Table structure for table PARTITION_PARAMS
--
CREATE TABLE IF NOT EXISTS metastore.PARTITION_PARAMS (
  PART_ID bigint(20) NOT NULL,
  PARAM_KEY varchar(256)  NOT NULL,
  PARAM_VALUE varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (PART_ID,PARAM_KEY),
  CONSTRAINT PARTITION_PARAMS_FK1 FOREIGN KEY (PART_ID) REFERENCES metastore.PARTITIONS (PART_ID)
);
CREATE INDEX IF NOT EXISTS PARTITION_PARAMS_N49 on metastore.PARTITION_PARAMS (PART_ID);

--
-- Table structure for table PART_COL_PRIVS
--
CREATE TABLE IF NOT EXISTS metastore.PART_COL_PRIVS (
  PART_COLUMN_GRANT_ID bigint(20) NOT NULL,
  COLUMN_NAME varchar(128)  DEFAULT NULL,
  CREATE_TIME int(11) NOT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PART_ID bigint(20) DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  PART_COL_PRIV varchar(128)  DEFAULT NULL,
  PRIMARY KEY (PART_COLUMN_GRANT_ID),
  CONSTRAINT PART_COL_PRIVS_FK1 FOREIGN KEY (PART_ID) REFERENCES metastore.PARTITIONS (PART_ID)
);
CREATE INDEX IF NOT EXISTS PART_COL_PRIVS_N49 on metastore.PART_COL_PRIVS (PART_ID);
CREATE INDEX IF NOT EXISTS PARTITIONCOLUMNPRIVILEGEINDEX on metastore.PART_COL_PRIVS (PART_ID,COLUMN_NAME,PRINCIPAL_NAME,PRINCIPAL_TYPE,PART_COL_PRIV,GRANTOR,GRANTOR_TYPE);

--
-- Table structure for table PART_PRIVS
--
CREATE TABLE IF NOT EXISTS metastore.PART_PRIVS (
  PART_GRANT_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PART_ID bigint(20) DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  PART_PRIV varchar(128)  DEFAULT NULL,
  PRIMARY KEY (PART_GRANT_ID),  
  CONSTRAINT PART_PRIVS_FK1 FOREIGN KEY (PART_ID) REFERENCES metastore.PARTITIONS (PART_ID)
);
CREATE INDEX IF NOT EXISTS PART_PRIVS_N49 on metastore.PART_PRIVS (PART_ID);
CREATE INDEX IF NOT EXISTS PARTPRIVILEGEINDEX on metastore.PART_PRIVS (PART_ID,PRINCIPAL_NAME,PRINCIPAL_TYPE,PART_PRIV,GRANTOR,GRANTOR_TYPE);

--
-- Table structure for table ROLE_MAP
--
CREATE TABLE IF NOT EXISTS metastore.ROLE_MAP (
  ROLE_GRANT_ID bigint(20) NOT NULL,
  ADD_TIME int(11) NOT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  ROLE_ID bigint(20) DEFAULT NULL,
  PRIMARY KEY (ROLE_GRANT_ID),
  UNIQUE KEY USERROLEMAPINDEX (PRINCIPAL_NAME,ROLE_ID,GRANTOR,GRANTOR_TYPE),
  CONSTRAINT ROLE_MAP_FK1 FOREIGN KEY (ROLE_ID) REFERENCES metastore.ROLES (ROLE_ID)
);
CREATE INDEX IF NOT EXISTS ROLE_MAP_N49 on metastore.ROLE_MAP (ROLE_ID);

--
-- Table structure for table SD_PARAMS
--
CREATE TABLE IF NOT EXISTS metastore.SD_PARAMS (
  SD_ID bigint(20) NOT NULL,
  PARAM_KEY varchar(256)  NOT NULL,
  PARAM_VALUE varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (SD_ID,PARAM_KEY),
  CONSTRAINT SD_PARAMS_FK1 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID)
);
CREATE INDEX IF NOT EXISTS SD_PARAMS_N49 on metastore.SD_PARAMS (SD_ID);

--
-- Table structure for table SERDE_PARAMS
--
CREATE TABLE IF NOT EXISTS metastore.SERDE_PARAMS (
  SERDE_ID bigint(20) NOT NULL,
  PARAM_KEY varchar(256)  NOT NULL,
  PARAM_VALUE varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (SERDE_ID,PARAM_KEY),
  CONSTRAINT SERDE_PARAMS_FK1 FOREIGN KEY (SERDE_ID) REFERENCES metastore.SERDES (SERDE_ID)
);
CREATE INDEX IF NOT EXISTS SERDE_PARAMS_N49 on metastore.SERDE_PARAMS (SERDE_ID);

--
-- Table structure for table SORT_COLS
--
CREATE TABLE IF NOT EXISTS metastore.SORT_COLS (
  SD_ID bigint(20) NOT NULL,
  COLUMN_NAME varchar(128) DEFAULT NULL,
  "ORDER" int(11) NOT NULL,
  INTEGER_IDX int(11) NOT NULL,
  PRIMARY KEY (SD_ID,INTEGER_IDX),
  CONSTRAINT SORT_COLS_FK1 FOREIGN KEY (SD_ID) REFERENCES metastore.SDS (SD_ID)
);
CREATE INDEX IF NOT EXISTS SORT_COLS_N49 on metastore.SORT_COLS (SD_ID);

--
-- Table structure for table TABLE_PARAMS
--
CREATE TABLE IF NOT EXISTS metastore.TABLE_PARAMS (
  TBL_ID bigint(20) NOT NULL,
  PARAM_KEY varchar(256)  NOT NULL,
  PARAM_VALUE varchar(4000)  DEFAULT NULL,
  PRIMARY KEY (TBL_ID,PARAM_KEY),
  CONSTRAINT TABLE_PARAMS_FK1 FOREIGN KEY (TBL_ID) REFERENCES metastore.TBLS (TBL_ID)
);
CREATE INDEX IF NOT EXISTS TABLE_PARAMS_N49 on metastore.TABLE_PARAMS (TBL_ID);

--
-- Table structure for table TBL_COL_PRIVS
--
CREATE TABLE IF NOT EXISTS metastore.TBL_COL_PRIVS (
  TBL_COLUMN_GRANT_ID bigint(20) NOT NULL,
  COLUMN_NAME varchar(128)  DEFAULT NULL,
  CREATE_TIME int(11) NOT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  TBL_COL_PRIV varchar(128)  DEFAULT NULL,
  TBL_ID bigint(20) DEFAULT NULL,
  PRIMARY KEY (TBL_COLUMN_GRANT_ID),
  CONSTRAINT TBL_COL_PRIVS_FK1 FOREIGN KEY (TBL_ID) REFERENCES metastore.TBLS (TBL_ID)
);
CREATE INDEX IF NOT EXISTS TABLECOLUMNPRIVILEGEINDEX on metastore.TBL_COL_PRIVS (TBL_ID,COLUMN_NAME,PRINCIPAL_NAME,PRINCIPAL_TYPE,TBL_COL_PRIV,GRANTOR,GRANTOR_TYPE);
CREATE INDEX IF NOT EXISTS TBL_COL_PRIVS_N49 on metastore.TBL_COL_PRIVS (TBL_ID);

--
-- Table structure for table TBL_PRIVS
--
CREATE TABLE IF NOT EXISTS metastore.TBL_PRIVS (
  TBL_GRANT_ID bigint(20) NOT NULL,
  CREATE_TIME int(11) NOT NULL,
  GRANT_OPTION smallint(6) NOT NULL,
  GRANTOR varchar(128)  DEFAULT NULL,
  GRANTOR_TYPE varchar(128)  DEFAULT NULL,
  PRINCIPAL_NAME varchar(128)  DEFAULT NULL,
  PRINCIPAL_TYPE varchar(128)  DEFAULT NULL,
  TBL_PRIV varchar(128)  DEFAULT NULL,
  TBL_ID bigint(20) DEFAULT NULL,
  PRIMARY KEY (TBL_GRANT_ID),
  CONSTRAINT TBL_PRIVS_FK1 FOREIGN KEY (TBL_ID) REFERENCES metastore.TBLS (TBL_ID)
);
CREATE INDEX IF NOT EXISTS TBL_PRIVS_N49 on metastore.TBL_PRIVS (TBL_ID);
CREATE INDEX IF NOT EXISTS TABLEPRIVILEGEINDEX on metastore.TBL_PRIVS (TBL_ID,PRINCIPAL_NAME,PRINCIPAL_TYPE,TBL_PRIV,GRANTOR,GRANTOR_TYPE);

--
-- Table structure for table TYPE_FIELDS
--
CREATE TABLE IF NOT EXISTS metastore.TYPE_FIELDS (
  TYPE_NAME bigint(20) NOT NULL,
  COMMENT varchar(256)  DEFAULT NULL,
  FIELD_NAME varchar(128)  NOT NULL,
  FIELD_TYPE varchar(767)  NOT NULL,
  INTEGER_IDX int(11) NOT NULL,
  PRIMARY KEY (TYPE_NAME,FIELD_NAME),
  CONSTRAINT TYPE_FIELDS_FK1 FOREIGN KEY (TYPE_NAME) REFERENCES metastore.TYPES (TYPES_ID)
);
CREATE INDEX IF NOT EXISTS TYPE_FIELDS_N49 on metastore.TYPE_FIELDS (TYPE_NAME);