http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/etc/hive-schema-0.12.0.postgres.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/etc/hive-schema-0.12.0.postgres.sql b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/etc/hive-schema-0.12.0.postgres.sql deleted file mode 100644 index bc6486b..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/etc/hive-schema-0.12.0.postgres.sql +++ /dev/null @@ -1,1406 +0,0 @@ --- --- PostgreSQL database dump --- - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET escape_string_warning = off; - -SET search_path = public, pg_catalog; - -SET default_tablespace = ''; - -SET default_with_oids = false; - --- --- Name: BUCKETING_COLS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "BUCKETING_COLS" ( - "SD_ID" bigint NOT NULL, - "BUCKET_COL_NAME" character varying(256) DEFAULT NULL::character varying, - "INTEGER_IDX" bigint NOT NULL -); - - --- --- Name: CDS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "CDS" ( - "CD_ID" bigint NOT NULL -); - - --- --- Name: COLUMNS_OLD; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "COLUMNS_OLD" ( - "SD_ID" bigint NOT NULL, - "COMMENT" character varying(256) DEFAULT NULL::character varying, - "COLUMN_NAME" character varying(128) NOT NULL, - "TYPE_NAME" character varying(4000) NOT NULL, - "INTEGER_IDX" bigint NOT NULL -); - - --- --- Name: COLUMNS_V2; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "COLUMNS_V2" ( - "CD_ID" bigint NOT NULL, - "COMMENT" character varying(4000), - "COLUMN_NAME" character varying(128) NOT NULL, - "TYPE_NAME" character varying(4000), - "INTEGER_IDX" integer NOT NULL -); - - --- --- Name: DATABASE_PARAMS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "DATABASE_PARAMS" ( - "DB_ID" bigint NOT NULL, - "PARAM_KEY" character varying(180) NOT NULL, - "PARAM_VALUE" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: DBS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "DBS" ( - "DB_ID" bigint NOT NULL, - "DESC" character varying(4000) DEFAULT NULL::character varying, - "DB_LOCATION_URI" character varying(4000) NOT NULL, - "NAME" character varying(128) DEFAULT NULL::character varying -); - - --- --- Name: DB_PRIVS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "DB_PRIVS" ( - "DB_GRANT_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "DB_ID" bigint, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "DB_PRIV" character varying(128) DEFAULT NULL::character varying -); - - --- --- Name: GLOBAL_PRIVS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "GLOBAL_PRIVS" ( - "USER_GRANT_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "USER_PRIV" character varying(128) DEFAULT NULL::character varying -); - - --- --- Name: IDXS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "IDXS" ( - "INDEX_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "DEFERRED_REBUILD" boolean NOT NULL, - "INDEX_HANDLER_CLASS" character varying(4000) DEFAULT NULL::character varying, - "INDEX_NAME" character varying(128) DEFAULT NULL::character varying, - "INDEX_TBL_ID" bigint, - "LAST_ACCESS_TIME" bigint NOT NULL, - "ORIG_TBL_ID" bigint, - "SD_ID" bigint -); - - --- --- Name: INDEX_PARAMS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "INDEX_PARAMS" ( - "INDEX_ID" bigint NOT NULL, - "PARAM_KEY" character varying(256) NOT NULL, - "PARAM_VALUE" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: NUCLEUS_TABLES; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "NUCLEUS_TABLES" ( - "CLASS_NAME" character varying(128) NOT NULL, - "TABLE_NAME" character varying(128) NOT NULL, - "TYPE" character varying(4) NOT NULL, - "OWNER" character varying(2) NOT NULL, - "VERSION" character varying(20) NOT NULL, - "INTERFACE_NAME" character varying(255) DEFAULT NULL::character varying -); - - --- --- Name: PARTITIONS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PARTITIONS" ( - "PART_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "LAST_ACCESS_TIME" bigint NOT NULL, - "PART_NAME" character varying(767) DEFAULT NULL::character varying, - "SD_ID" bigint, - "TBL_ID" bigint -); - - --- --- Name: PARTITION_EVENTS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PARTITION_EVENTS" ( - "PART_NAME_ID" bigint NOT NULL, - "DB_NAME" character varying(128), - "EVENT_TIME" bigint NOT NULL, - "EVENT_TYPE" integer NOT NULL, - "PARTITION_NAME" character varying(767), - "TBL_NAME" character varying(128) -); - - --- --- Name: PARTITION_KEYS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PARTITION_KEYS" ( - "TBL_ID" bigint NOT NULL, - "PKEY_COMMENT" character varying(4000) DEFAULT NULL::character varying, - "PKEY_NAME" character varying(128) NOT NULL, - "PKEY_TYPE" character varying(767) NOT NULL, - "INTEGER_IDX" bigint NOT NULL -); - - --- --- Name: PARTITION_KEY_VALS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PARTITION_KEY_VALS" ( - "PART_ID" bigint NOT NULL, - "PART_KEY_VAL" character varying(256) DEFAULT NULL::character varying, - "INTEGER_IDX" bigint NOT NULL -); - - --- --- Name: PARTITION_PARAMS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PARTITION_PARAMS" ( - "PART_ID" bigint NOT NULL, - "PARAM_KEY" character varying(256) NOT NULL, - "PARAM_VALUE" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: PART_COL_PRIVS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PART_COL_PRIVS" ( - "PART_COLUMN_GRANT_ID" bigint NOT NULL, - "COLUMN_NAME" character varying(128) DEFAULT NULL::character varying, - "CREATE_TIME" bigint NOT NULL, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PART_ID" bigint, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "PART_COL_PRIV" character varying(128) DEFAULT NULL::character varying -); - - --- --- Name: PART_PRIVS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PART_PRIVS" ( - "PART_GRANT_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PART_ID" bigint, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "PART_PRIV" character varying(128) DEFAULT NULL::character varying -); - - --- --- Name: ROLES; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "ROLES" ( - "ROLE_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "OWNER_NAME" character varying(128) DEFAULT NULL::character varying, - "ROLE_NAME" character varying(128) DEFAULT NULL::character varying -); - - --- --- Name: ROLE_MAP; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "ROLE_MAP" ( - "ROLE_GRANT_ID" bigint NOT NULL, - "ADD_TIME" bigint NOT NULL, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "ROLE_ID" bigint -); - - --- --- Name: SDS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "SDS" ( - "SD_ID" bigint NOT NULL, - "INPUT_FORMAT" character varying(4000) DEFAULT NULL::character varying, - "IS_COMPRESSED" boolean NOT NULL, - "LOCATION" character varying(4000) DEFAULT NULL::character varying, - "NUM_BUCKETS" bigint NOT NULL, - "OUTPUT_FORMAT" character varying(4000) DEFAULT NULL::character varying, - "SERDE_ID" bigint, - "CD_ID" bigint, - "IS_STOREDASSUBDIRECTORIES" boolean NOT NULL -); - - --- --- Name: SD_PARAMS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "SD_PARAMS" ( - "SD_ID" bigint NOT NULL, - "PARAM_KEY" character varying(256) NOT NULL, - "PARAM_VALUE" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: SEQUENCE_TABLE; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "SEQUENCE_TABLE" ( - "SEQUENCE_NAME" character varying(255) NOT NULL, - "NEXT_VAL" bigint NOT NULL -); - - --- --- Name: SERDES; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "SERDES" ( - "SERDE_ID" bigint NOT NULL, - "NAME" character varying(128) DEFAULT NULL::character varying, - "SLIB" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: SERDE_PARAMS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "SERDE_PARAMS" ( - "SERDE_ID" bigint NOT NULL, - "PARAM_KEY" character varying(256) NOT NULL, - "PARAM_VALUE" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: SORT_COLS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "SORT_COLS" ( - "SD_ID" bigint NOT NULL, - "COLUMN_NAME" character varying(128) DEFAULT NULL::character varying, - "ORDER" bigint NOT NULL, - "INTEGER_IDX" bigint NOT NULL -); - - --- --- Name: TABLE_PARAMS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "TABLE_PARAMS" ( - "TBL_ID" bigint NOT NULL, - "PARAM_KEY" character varying(256) NOT NULL, - "PARAM_VALUE" character varying(4000) DEFAULT NULL::character varying -); - - --- --- Name: TBLS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "TBLS" ( - "TBL_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "DB_ID" bigint, - "LAST_ACCESS_TIME" bigint NOT NULL, - "OWNER" character varying(767) DEFAULT NULL::character varying, - "RETENTION" bigint NOT NULL, - "SD_ID" bigint, - "TBL_NAME" character varying(128) DEFAULT NULL::character varying, - "TBL_TYPE" character varying(128) DEFAULT NULL::character varying, - "VIEW_EXPANDED_TEXT" text, - "VIEW_ORIGINAL_TEXT" text -); - - --- --- Name: TBL_COL_PRIVS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "TBL_COL_PRIVS" ( - "TBL_COLUMN_GRANT_ID" bigint NOT NULL, - "COLUMN_NAME" character varying(128) DEFAULT NULL::character varying, - "CREATE_TIME" bigint NOT NULL, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "TBL_COL_PRIV" character varying(128) DEFAULT NULL::character varying, - "TBL_ID" bigint -); - - --- --- Name: TBL_PRIVS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "TBL_PRIVS" ( - "TBL_GRANT_ID" bigint NOT NULL, - "CREATE_TIME" bigint NOT NULL, - "GRANT_OPTION" smallint NOT NULL, - "GRANTOR" character varying(128) DEFAULT NULL::character varying, - "GRANTOR_TYPE" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_NAME" character varying(128) DEFAULT NULL::character varying, - "PRINCIPAL_TYPE" character varying(128) DEFAULT NULL::character varying, - "TBL_PRIV" character varying(128) DEFAULT NULL::character varying, - "TBL_ID" bigint -); - - --- --- Name: TYPES; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "TYPES" ( - "TYPES_ID" bigint NOT NULL, - "TYPE_NAME" character varying(128) DEFAULT NULL::character varying, - "TYPE1" character varying(767) DEFAULT NULL::character varying, - "TYPE2" character varying(767) DEFAULT NULL::character varying -); - - --- --- Name: TYPE_FIELDS; Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "TYPE_FIELDS" ( - "TYPE_NAME" bigint NOT NULL, - "COMMENT" character varying(256) DEFAULT NULL::character varying, - "FIELD_NAME" character varying(128) NOT NULL, - "FIELD_TYPE" character varying(767) NOT NULL, - "INTEGER_IDX" bigint NOT NULL -); - -CREATE TABLE "SKEWED_STRING_LIST" ( - "STRING_LIST_ID" bigint NOT NULL -); - -CREATE TABLE "SKEWED_STRING_LIST_VALUES" ( - "STRING_LIST_ID" bigint NOT NULL, - "STRING_LIST_VALUE" character varying(256) DEFAULT NULL::character varying, - "INTEGER_IDX" bigint NOT NULL -); - -CREATE TABLE "SKEWED_COL_NAMES" ( - "SD_ID" bigint NOT NULL, - "SKEWED_COL_NAME" character varying(256) DEFAULT NULL::character varying, - "INTEGER_IDX" bigint NOT NULL -); - -CREATE TABLE "SKEWED_COL_VALUE_LOC_MAP" ( - "SD_ID" bigint NOT NULL, - "STRING_LIST_ID_KID" bigint NOT NULL, - "LOCATION" character varying(4000) DEFAULT NULL::character varying -); - -CREATE TABLE "SKEWED_VALUES" ( - "SD_ID_OID" bigint NOT NULL, - "STRING_LIST_ID_EID" bigint NOT NULL, - "INTEGER_IDX" bigint NOT NULL -); - - --- --- Name: TAB_COL_STATS Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "MASTER_KEYS" -( - "KEY_ID" SERIAL, - "MASTER_KEY" varchar(767) NULL, - PRIMARY KEY ("KEY_ID") -); - -CREATE TABLE "DELEGATION_TOKENS" -( - "TOKEN_IDENT" varchar(767) NOT NULL, - "TOKEN" varchar(767) NULL, - PRIMARY KEY ("TOKEN_IDENT") -); - -CREATE TABLE "TAB_COL_STATS" ( - "CS_ID" bigint NOT NULL, - "DB_NAME" character varying(128) DEFAULT NULL::character varying, - "TABLE_NAME" character varying(128) DEFAULT NULL::character varying, - "COLUMN_NAME" character varying(128) DEFAULT NULL::character varying, - "COLUMN_TYPE" character varying(128) DEFAULT NULL::character varying, - "TBL_ID" bigint NOT NULL, - "LONG_LOW_VALUE" bigint, - "LONG_HIGH_VALUE" bigint, - "DOUBLE_LOW_VALUE" double precision, - "DOUBLE_HIGH_VALUE" double precision, - "BIG_DECIMAL_LOW_VALUE" character varying(4000) DEFAULT NULL::character varying, - "BIG_DECIMAL_HIGH_VALUE" character varying(4000) DEFAULT NULL::character varying, - "NUM_NULLS" bigint NOT NULL, - "NUM_DISTINCTS" bigint, - "AVG_COL_LEN" double precision, - "MAX_COL_LEN" bigint, - "NUM_TRUES" bigint, - "NUM_FALSES" bigint, - "LAST_ANALYZED" bigint NOT NULL -); - --- --- Table structure for VERSION --- -CREATE TABLE "VERSION" ( - "VER_ID" bigint, - "SCHEMA_VERSION" character varying(127) NOT NULL, - "VERSION_COMMENT" character varying(255) NOT NULL -); - --- --- Name: PART_COL_STATS Type: TABLE; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE TABLE "PART_COL_STATS" ( - "CS_ID" bigint NOT NULL, - "DB_NAME" character varying(128) DEFAULT NULL::character varying, - "TABLE_NAME" character varying(128) DEFAULT NULL::character varying, - "PARTITION_NAME" character varying(767) DEFAULT NULL::character varying, - "COLUMN_NAME" character varying(128) DEFAULT NULL::character varying, - "COLUMN_TYPE" character varying(128) DEFAULT NULL::character varying, - "PART_ID" bigint NOT NULL, - "LONG_LOW_VALUE" bigint, - "LONG_HIGH_VALUE" bigint, - "DOUBLE_LOW_VALUE" double precision, - "DOUBLE_HIGH_VALUE" double precision, - "BIG_DECIMAL_LOW_VALUE" character varying(4000) DEFAULT NULL::character varying, - "BIG_DECIMAL_HIGH_VALUE" character varying(4000) DEFAULT NULL::character varying, - "NUM_NULLS" bigint NOT NULL, - "NUM_DISTINCTS" bigint, - "AVG_COL_LEN" double precision, - "MAX_COL_LEN" bigint, - "NUM_TRUES" bigint, - "NUM_FALSES" bigint, - "LAST_ANALYZED" bigint NOT NULL -); - --- --- Name: BUCKETING_COLS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "BUCKETING_COLS" - ADD CONSTRAINT "BUCKETING_COLS_pkey" PRIMARY KEY ("SD_ID", "INTEGER_IDX"); - - --- --- Name: CDS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "CDS" - ADD CONSTRAINT "CDS_pkey" PRIMARY KEY ("CD_ID"); - - --- --- Name: COLUMNS_V2_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "COLUMNS_V2" - ADD CONSTRAINT "COLUMNS_V2_pkey" PRIMARY KEY ("CD_ID", "COLUMN_NAME"); - - --- --- Name: COLUMNS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "COLUMNS_OLD" - ADD CONSTRAINT "COLUMNS_pkey" PRIMARY KEY ("SD_ID", "COLUMN_NAME"); - - --- --- Name: DATABASE_PARAMS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "DATABASE_PARAMS" - ADD CONSTRAINT "DATABASE_PARAMS_pkey" PRIMARY KEY ("DB_ID", "PARAM_KEY"); - - --- --- Name: DBPRIVILEGEINDEX; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "DB_PRIVS" - ADD CONSTRAINT "DBPRIVILEGEINDEX" UNIQUE ("DB_ID", "PRINCIPAL_NAME", "PRINCIPAL_TYPE", "DB_PRIV", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: DBS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "DBS" - ADD CONSTRAINT "DBS_pkey" PRIMARY KEY ("DB_ID"); - - --- --- Name: DB_PRIVS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "DB_PRIVS" - ADD CONSTRAINT "DB_PRIVS_pkey" PRIMARY KEY ("DB_GRANT_ID"); - - --- --- Name: GLOBALPRIVILEGEINDEX; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "GLOBAL_PRIVS" - ADD CONSTRAINT "GLOBALPRIVILEGEINDEX" UNIQUE ("PRINCIPAL_NAME", "PRINCIPAL_TYPE", "USER_PRIV", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: GLOBAL_PRIVS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "GLOBAL_PRIVS" - ADD CONSTRAINT "GLOBAL_PRIVS_pkey" PRIMARY KEY ("USER_GRANT_ID"); - - --- --- Name: IDXS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "IDXS" - ADD CONSTRAINT "IDXS_pkey" PRIMARY KEY ("INDEX_ID"); - - --- --- Name: INDEX_PARAMS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "INDEX_PARAMS" - ADD CONSTRAINT "INDEX_PARAMS_pkey" PRIMARY KEY ("INDEX_ID", "PARAM_KEY"); - - --- --- Name: NUCLEUS_TABLES_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "NUCLEUS_TABLES" - ADD CONSTRAINT "NUCLEUS_TABLES_pkey" PRIMARY KEY ("CLASS_NAME"); - - --- --- Name: PARTITIONS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PARTITIONS" - ADD CONSTRAINT "PARTITIONS_pkey" PRIMARY KEY ("PART_ID"); - - --- --- Name: PARTITION_EVENTS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PARTITION_EVENTS" - ADD CONSTRAINT "PARTITION_EVENTS_pkey" PRIMARY KEY ("PART_NAME_ID"); - - --- --- Name: PARTITION_KEYS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PARTITION_KEYS" - ADD CONSTRAINT "PARTITION_KEYS_pkey" PRIMARY KEY ("TBL_ID", "PKEY_NAME"); - - --- --- Name: PARTITION_KEY_VALS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PARTITION_KEY_VALS" - ADD CONSTRAINT "PARTITION_KEY_VALS_pkey" PRIMARY KEY ("PART_ID", "INTEGER_IDX"); - - --- --- Name: PARTITION_PARAMS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PARTITION_PARAMS" - ADD CONSTRAINT "PARTITION_PARAMS_pkey" PRIMARY KEY ("PART_ID", "PARAM_KEY"); - - --- --- Name: PART_COL_PRIVS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PART_COL_PRIVS" - ADD CONSTRAINT "PART_COL_PRIVS_pkey" PRIMARY KEY ("PART_COLUMN_GRANT_ID"); - - --- --- Name: PART_PRIVS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PART_PRIVS" - ADD CONSTRAINT "PART_PRIVS_pkey" PRIMARY KEY ("PART_GRANT_ID"); - - --- --- Name: ROLEENTITYINDEX; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "ROLES" - ADD CONSTRAINT "ROLEENTITYINDEX" UNIQUE ("ROLE_NAME"); - - --- --- Name: ROLES_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "ROLES" - ADD CONSTRAINT "ROLES_pkey" PRIMARY KEY ("ROLE_ID"); - - --- --- Name: ROLE_MAP_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "ROLE_MAP" - ADD CONSTRAINT "ROLE_MAP_pkey" PRIMARY KEY ("ROLE_GRANT_ID"); - - --- --- Name: SDS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "SDS" - ADD CONSTRAINT "SDS_pkey" PRIMARY KEY ("SD_ID"); - - --- --- Name: SD_PARAMS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "SD_PARAMS" - ADD CONSTRAINT "SD_PARAMS_pkey" PRIMARY KEY ("SD_ID", "PARAM_KEY"); - - --- --- Name: SEQUENCE_TABLE_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "SEQUENCE_TABLE" - ADD CONSTRAINT "SEQUENCE_TABLE_pkey" PRIMARY KEY ("SEQUENCE_NAME"); - - --- --- Name: SERDES_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "SERDES" - ADD CONSTRAINT "SERDES_pkey" PRIMARY KEY ("SERDE_ID"); - - --- --- Name: SERDE_PARAMS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "SERDE_PARAMS" - ADD CONSTRAINT "SERDE_PARAMS_pkey" PRIMARY KEY ("SERDE_ID", "PARAM_KEY"); - - --- --- Name: SORT_COLS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "SORT_COLS" - ADD CONSTRAINT "SORT_COLS_pkey" PRIMARY KEY ("SD_ID", "INTEGER_IDX"); - - --- --- Name: TABLE_PARAMS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TABLE_PARAMS" - ADD CONSTRAINT "TABLE_PARAMS_pkey" PRIMARY KEY ("TBL_ID", "PARAM_KEY"); - - --- --- Name: TBLS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TBLS" - ADD CONSTRAINT "TBLS_pkey" PRIMARY KEY ("TBL_ID"); - - --- --- Name: TBL_COL_PRIVS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TBL_COL_PRIVS" - ADD CONSTRAINT "TBL_COL_PRIVS_pkey" PRIMARY KEY ("TBL_COLUMN_GRANT_ID"); - - --- --- Name: TBL_PRIVS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TBL_PRIVS" - ADD CONSTRAINT "TBL_PRIVS_pkey" PRIMARY KEY ("TBL_GRANT_ID"); - - --- --- Name: TYPES_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TYPES" - ADD CONSTRAINT "TYPES_pkey" PRIMARY KEY ("TYPES_ID"); - - --- --- Name: TYPE_FIELDS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TYPE_FIELDS" - ADD CONSTRAINT "TYPE_FIELDS_pkey" PRIMARY KEY ("TYPE_NAME", "FIELD_NAME"); - -ALTER TABLE ONLY "SKEWED_STRING_LIST" - ADD CONSTRAINT "SKEWED_STRING_LIST_pkey" PRIMARY KEY ("STRING_LIST_ID"); - -ALTER TABLE ONLY "SKEWED_STRING_LIST_VALUES" - ADD CONSTRAINT "SKEWED_STRING_LIST_VALUES_pkey" PRIMARY KEY ("STRING_LIST_ID", "INTEGER_IDX"); - - -ALTER TABLE ONLY "SKEWED_COL_NAMES" - ADD CONSTRAINT "SKEWED_COL_NAMES_pkey" PRIMARY KEY ("SD_ID", "INTEGER_IDX"); - -ALTER TABLE ONLY "SKEWED_COL_VALUE_LOC_MAP" - ADD CONSTRAINT "SKEWED_COL_VALUE_LOC_MAP_pkey" PRIMARY KEY ("SD_ID", "STRING_LIST_ID_KID"); - -ALTER TABLE ONLY "SKEWED_VALUES" - ADD CONSTRAINT "SKEWED_VALUES_pkey" PRIMARY KEY ("SD_ID_OID", "INTEGER_IDX"); - --- --- Name: TAB_COL_STATS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- -ALTER TABLE ONLY "TAB_COL_STATS" ADD CONSTRAINT "TAB_COL_STATS_pkey" PRIMARY KEY("CS_ID"); - --- --- Name: PART_COL_STATS_pkey; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- -ALTER TABLE ONLY "PART_COL_STATS" ADD CONSTRAINT "PART_COL_STATS_pkey" PRIMARY KEY("CS_ID"); - --- --- Name: UNIQUEINDEX; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "IDXS" - ADD CONSTRAINT "UNIQUEINDEX" UNIQUE ("INDEX_NAME", "ORIG_TBL_ID"); - - --- --- Name: UNIQUEPARTITION; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "PARTITIONS" - ADD CONSTRAINT "UNIQUEPARTITION" UNIQUE ("PART_NAME", "TBL_ID"); - - --- --- Name: UNIQUETABLE; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TBLS" - ADD CONSTRAINT "UNIQUETABLE" UNIQUE ("TBL_NAME", "DB_ID"); - - --- --- Name: UNIQUE_DATABASE; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "DBS" - ADD CONSTRAINT "UNIQUE_DATABASE" UNIQUE ("NAME"); - - --- --- Name: UNIQUE_TYPE; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "TYPES" - ADD CONSTRAINT "UNIQUE_TYPE" UNIQUE ("TYPE_NAME"); - - --- --- Name: USERROLEMAPINDEX; Type: CONSTRAINT; Schema: public; Owner: hiveuser; Tablespace: --- - -ALTER TABLE ONLY "ROLE_MAP" - ADD CONSTRAINT "USERROLEMAPINDEX" UNIQUE ("PRINCIPAL_NAME", "ROLE_ID", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: BUCKETING_COLS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "BUCKETING_COLS_N49" ON "BUCKETING_COLS" USING btree ("SD_ID"); - - --- --- Name: COLUMNS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "COLUMNS_N49" ON "COLUMNS_OLD" USING btree ("SD_ID"); - - --- --- Name: DATABASE_PARAMS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "DATABASE_PARAMS_N49" ON "DATABASE_PARAMS" USING btree ("DB_ID"); - - --- --- Name: DB_PRIVS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "DB_PRIVS_N49" ON "DB_PRIVS" USING btree ("DB_ID"); - - --- --- Name: IDXS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "IDXS_N49" ON "IDXS" USING btree ("ORIG_TBL_ID"); - - --- --- Name: IDXS_N50; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "IDXS_N50" ON "IDXS" USING btree ("INDEX_TBL_ID"); - - --- --- Name: IDXS_N51; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "IDXS_N51" ON "IDXS" USING btree ("SD_ID"); - - --- --- Name: INDEX_PARAMS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "INDEX_PARAMS_N49" ON "INDEX_PARAMS" USING btree ("INDEX_ID"); - - --- --- Name: PARTITIONCOLUMNPRIVILEGEINDEX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITIONCOLUMNPRIVILEGEINDEX" ON "PART_COL_PRIVS" USING btree ("PART_ID", "COLUMN_NAME", "PRINCIPAL_NAME", "PRINCIPAL_TYPE", "PART_COL_PRIV", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: PARTITIONEVENTINDEX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITIONEVENTINDEX" ON "PARTITION_EVENTS" USING btree ("PARTITION_NAME"); - - --- --- Name: PARTITIONS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITIONS_N49" ON "PARTITIONS" USING btree ("TBL_ID"); - - --- --- Name: PARTITIONS_N50; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITIONS_N50" ON "PARTITIONS" USING btree ("SD_ID"); - - --- --- Name: PARTITION_KEYS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITION_KEYS_N49" ON "PARTITION_KEYS" USING btree ("TBL_ID"); - - --- --- Name: PARTITION_KEY_VALS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITION_KEY_VALS_N49" ON "PARTITION_KEY_VALS" USING btree ("PART_ID"); - - --- --- Name: PARTITION_PARAMS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTITION_PARAMS_N49" ON "PARTITION_PARAMS" USING btree ("PART_ID"); - - --- --- Name: PARTPRIVILEGEINDEX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PARTPRIVILEGEINDEX" ON "PART_PRIVS" USING btree ("PART_ID", "PRINCIPAL_NAME", "PRINCIPAL_TYPE", "PART_PRIV", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: PART_COL_PRIVS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PART_COL_PRIVS_N49" ON "PART_COL_PRIVS" USING btree ("PART_ID"); - - --- --- Name: PART_PRIVS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PART_PRIVS_N49" ON "PART_PRIVS" USING btree ("PART_ID"); - - --- --- Name: ROLE_MAP_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "ROLE_MAP_N49" ON "ROLE_MAP" USING btree ("ROLE_ID"); - - --- --- Name: SDS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "SDS_N49" ON "SDS" USING btree ("SERDE_ID"); - - --- --- Name: SD_PARAMS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "SD_PARAMS_N49" ON "SD_PARAMS" USING btree ("SD_ID"); - - --- --- Name: SERDE_PARAMS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "SERDE_PARAMS_N49" ON "SERDE_PARAMS" USING btree ("SERDE_ID"); - - --- --- Name: SORT_COLS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "SORT_COLS_N49" ON "SORT_COLS" USING btree ("SD_ID"); - - --- --- Name: TABLECOLUMNPRIVILEGEINDEX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TABLECOLUMNPRIVILEGEINDEX" ON "TBL_COL_PRIVS" USING btree ("TBL_ID", "COLUMN_NAME", "PRINCIPAL_NAME", "PRINCIPAL_TYPE", "TBL_COL_PRIV", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: TABLEPRIVILEGEINDEX; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TABLEPRIVILEGEINDEX" ON "TBL_PRIVS" USING btree ("TBL_ID", "PRINCIPAL_NAME", "PRINCIPAL_TYPE", "TBL_PRIV", "GRANTOR", "GRANTOR_TYPE"); - - --- --- Name: TABLE_PARAMS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TABLE_PARAMS_N49" ON "TABLE_PARAMS" USING btree ("TBL_ID"); - - --- --- Name: TBLS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TBLS_N49" ON "TBLS" USING btree ("DB_ID"); - - --- --- Name: TBLS_N50; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TBLS_N50" ON "TBLS" USING btree ("SD_ID"); - - --- --- Name: TBL_COL_PRIVS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TBL_COL_PRIVS_N49" ON "TBL_COL_PRIVS" USING btree ("TBL_ID"); - - --- --- Name: TBL_PRIVS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TBL_PRIVS_N49" ON "TBL_PRIVS" USING btree ("TBL_ID"); - - --- --- Name: TYPE_FIELDS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TYPE_FIELDS_N49" ON "TYPE_FIELDS" USING btree ("TYPE_NAME"); - --- --- Name: TAB_COL_STATS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "TAB_COL_STATS_N49" ON "TAB_COL_STATS" USING btree ("TBL_ID"); - --- --- Name: PART_COL_STATS_N49; Type: INDEX; Schema: public; Owner: hiveuser; Tablespace: --- - -CREATE INDEX "PART_COL_STATS_N49" ON "PART_COL_STATS" USING btree ("PART_ID"); - - -ALTER TABLE ONLY "SKEWED_STRING_LIST_VALUES" - ADD CONSTRAINT "SKEWED_STRING_LIST_VALUES_fkey" FOREIGN KEY ("STRING_LIST_ID") REFERENCES "SKEWED_STRING_LIST"("STRING_LIST_ID") DEFERRABLE; - - -ALTER TABLE ONLY "SKEWED_COL_NAMES" - ADD CONSTRAINT "SKEWED_COL_NAMES_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - -ALTER TABLE ONLY "SKEWED_COL_VALUE_LOC_MAP" - ADD CONSTRAINT "SKEWED_COL_VALUE_LOC_MAP_fkey1" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - -ALTER TABLE ONLY "SKEWED_COL_VALUE_LOC_MAP" - ADD CONSTRAINT "SKEWED_COL_VALUE_LOC_MAP_fkey2" FOREIGN KEY ("STRING_LIST_ID_KID") REFERENCES "SKEWED_STRING_LIST"("STRING_LIST_ID") DEFERRABLE; - -ALTER TABLE ONLY "SKEWED_VALUES" - ADD CONSTRAINT "SKEWED_VALUES_fkey1" FOREIGN KEY ("STRING_LIST_ID_EID") REFERENCES "SKEWED_STRING_LIST"("STRING_LIST_ID") DEFERRABLE; - -ALTER TABLE ONLY "SKEWED_VALUES" - ADD CONSTRAINT "SKEWED_VALUES_fkey2" FOREIGN KEY ("SD_ID_OID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: BUCKETING_COLS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "BUCKETING_COLS" - ADD CONSTRAINT "BUCKETING_COLS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: COLUMNS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "COLUMNS_OLD" - ADD CONSTRAINT "COLUMNS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: COLUMNS_V2_CD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "COLUMNS_V2" - ADD CONSTRAINT "COLUMNS_V2_CD_ID_fkey" FOREIGN KEY ("CD_ID") REFERENCES "CDS"("CD_ID") DEFERRABLE; - - --- --- Name: DATABASE_PARAMS_DB_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "DATABASE_PARAMS" - ADD CONSTRAINT "DATABASE_PARAMS_DB_ID_fkey" FOREIGN KEY ("DB_ID") REFERENCES "DBS"("DB_ID") DEFERRABLE; - - --- --- Name: DB_PRIVS_DB_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "DB_PRIVS" - ADD CONSTRAINT "DB_PRIVS_DB_ID_fkey" FOREIGN KEY ("DB_ID") REFERENCES "DBS"("DB_ID") DEFERRABLE; - - --- --- Name: IDXS_INDEX_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "IDXS" - ADD CONSTRAINT "IDXS_INDEX_TBL_ID_fkey" FOREIGN KEY ("INDEX_TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: IDXS_ORIG_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "IDXS" - ADD CONSTRAINT "IDXS_ORIG_TBL_ID_fkey" FOREIGN KEY ("ORIG_TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: IDXS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "IDXS" - ADD CONSTRAINT "IDXS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: INDEX_PARAMS_INDEX_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "INDEX_PARAMS" - ADD CONSTRAINT "INDEX_PARAMS_INDEX_ID_fkey" FOREIGN KEY ("INDEX_ID") REFERENCES "IDXS"("INDEX_ID") DEFERRABLE; - - --- --- Name: PARTITIONS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PARTITIONS" - ADD CONSTRAINT "PARTITIONS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: PARTITIONS_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PARTITIONS" - ADD CONSTRAINT "PARTITIONS_TBL_ID_fkey" FOREIGN KEY ("TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: PARTITION_KEYS_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PARTITION_KEYS" - ADD CONSTRAINT "PARTITION_KEYS_TBL_ID_fkey" FOREIGN KEY ("TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: PARTITION_KEY_VALS_PART_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PARTITION_KEY_VALS" - ADD CONSTRAINT "PARTITION_KEY_VALS_PART_ID_fkey" FOREIGN KEY ("PART_ID") REFERENCES "PARTITIONS"("PART_ID") DEFERRABLE; - - --- --- Name: PARTITION_PARAMS_PART_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PARTITION_PARAMS" - ADD CONSTRAINT "PARTITION_PARAMS_PART_ID_fkey" FOREIGN KEY ("PART_ID") REFERENCES "PARTITIONS"("PART_ID") DEFERRABLE; - - --- --- Name: PART_COL_PRIVS_PART_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PART_COL_PRIVS" - ADD CONSTRAINT "PART_COL_PRIVS_PART_ID_fkey" FOREIGN KEY ("PART_ID") REFERENCES "PARTITIONS"("PART_ID") DEFERRABLE; - - --- --- Name: PART_PRIVS_PART_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "PART_PRIVS" - ADD CONSTRAINT "PART_PRIVS_PART_ID_fkey" FOREIGN KEY ("PART_ID") REFERENCES "PARTITIONS"("PART_ID") DEFERRABLE; - - --- --- Name: ROLE_MAP_ROLE_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "ROLE_MAP" - ADD CONSTRAINT "ROLE_MAP_ROLE_ID_fkey" FOREIGN KEY ("ROLE_ID") REFERENCES "ROLES"("ROLE_ID") DEFERRABLE; - - --- --- Name: SDS_CD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "SDS" - ADD CONSTRAINT "SDS_CD_ID_fkey" FOREIGN KEY ("CD_ID") REFERENCES "CDS"("CD_ID") DEFERRABLE; - - --- --- Name: SDS_SERDE_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "SDS" - ADD CONSTRAINT "SDS_SERDE_ID_fkey" FOREIGN KEY ("SERDE_ID") REFERENCES "SERDES"("SERDE_ID") DEFERRABLE; - - --- --- Name: SD_PARAMS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "SD_PARAMS" - ADD CONSTRAINT "SD_PARAMS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: SERDE_PARAMS_SERDE_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "SERDE_PARAMS" - ADD CONSTRAINT "SERDE_PARAMS_SERDE_ID_fkey" FOREIGN KEY ("SERDE_ID") REFERENCES "SERDES"("SERDE_ID") DEFERRABLE; - - --- --- Name: SORT_COLS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "SORT_COLS" - ADD CONSTRAINT "SORT_COLS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: TABLE_PARAMS_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "TABLE_PARAMS" - ADD CONSTRAINT "TABLE_PARAMS_TBL_ID_fkey" FOREIGN KEY ("TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: TBLS_DB_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "TBLS" - ADD CONSTRAINT "TBLS_DB_ID_fkey" FOREIGN KEY ("DB_ID") REFERENCES "DBS"("DB_ID") DEFERRABLE; - - --- --- Name: TBLS_SD_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "TBLS" - ADD CONSTRAINT "TBLS_SD_ID_fkey" FOREIGN KEY ("SD_ID") REFERENCES "SDS"("SD_ID") DEFERRABLE; - - --- --- Name: TBL_COL_PRIVS_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "TBL_COL_PRIVS" - ADD CONSTRAINT "TBL_COL_PRIVS_TBL_ID_fkey" FOREIGN KEY ("TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: TBL_PRIVS_TBL_ID_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "TBL_PRIVS" - ADD CONSTRAINT "TBL_PRIVS_TBL_ID_fkey" FOREIGN KEY ("TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: TYPE_FIELDS_TYPE_NAME_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- - -ALTER TABLE ONLY "TYPE_FIELDS" - ADD CONSTRAINT "TYPE_FIELDS_TYPE_NAME_fkey" FOREIGN KEY ("TYPE_NAME") REFERENCES "TYPES"("TYPES_ID") DEFERRABLE; - --- --- Name: TAB_COL_STATS_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- -ALTER TABLE ONLY "TAB_COL_STATS" ADD CONSTRAINT "TAB_COL_STATS_fkey" FOREIGN KEY("TBL_ID") REFERENCES "TBLS"("TBL_ID") DEFERRABLE; - - --- --- Name: PART_COL_STATS_fkey; Type: FK CONSTRAINT; Schema: public; Owner: hiveuser --- -ALTER TABLE ONLY "PART_COL_STATS" ADD CONSTRAINT "PART_COL_STATS_fkey" FOREIGN KEY("PART_ID") REFERENCES "PARTITIONS"("PART_ID") DEFERRABLE; - - -ALTER TABLE ONLY "VERSION" ADD CONSTRAINT "VERSION_pkey" PRIMARY KEY ("VER_ID"); - --- --- Name: public; Type: ACL; Schema: -; Owner: hiveuser --- - -REVOKE ALL ON SCHEMA public FROM PUBLIC; -GRANT ALL ON SCHEMA public TO PUBLIC; - - -INSERT INTO "VERSION" ("VER_ID", "SCHEMA_VERSION", "VERSION_COMMENT") VALUES (1, '0.12.0', 'Hive release version 0.12.0'); --- --- PostgreSQL database dump complete --- -
http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/addMysqlUser.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/addMysqlUser.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/addMysqlUser.sh deleted file mode 100644 index 36ed58f..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/addMysqlUser.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -mysqldservice=$1 -mysqldbuser=$2 -mysqldbpasswd=$3 -userhost=$4 - -# The restart (not start) is required to pick up mysql configuration changes made by sed -# during install, in case mysql is already started. The changes are required by Hive later on. -/var/lib/ambari-agent/ambari-sudo.sh service $mysqldservice restart - -echo "Adding user $mysqldbuser@% and removing users with empty name" -/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"CREATE USER '$mysqldbuser'@'%' IDENTIFIED BY '$mysqldbpasswd';\"" -/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"GRANT ALL PRIVILEGES ON *.* TO '$mysqldbuser'@'%';\"" -/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"DELETE FROM mysql.user WHERE user='';\"" -/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"flush privileges;\"" -/var/lib/ambari-agent/ambari-sudo.sh service $mysqldservice stop http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hcatSmoke.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hcatSmoke.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hcatSmoke.sh deleted file mode 100644 index 39e63a6..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hcatSmoke.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -export tablename=$1 - -export purge_cmd="" -if [ "$3" == "true" ]; then - export purge_cmd="purge" -fi - -case "$2" in - -prepare) - hcat -e "show tables" - hcat -e "drop table IF EXISTS ${tablename} ${purge_cmd}" - hcat -e "create table ${tablename} ( id INT, name string ) stored as rcfile ;" -;; - -cleanup) - hcat -e "drop table IF EXISTS ${tablename} ${purge_cmd}" -;; - -esac http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveSmoke.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveSmoke.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveSmoke.sh deleted file mode 100644 index f9f2020..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveSmoke.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -export tablename=$1 -echo "CREATE EXTERNAL TABLE IF NOT EXISTS ${tablename} ( foo INT, bar STRING );" | hive -echo "DESCRIBE ${tablename};" | hive http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2.sql ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2.sql b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2.sql deleted file mode 100644 index 99a3865..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2.sql +++ /dev/null @@ -1,23 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -CREATE EXTERNAL TABLE IF NOT EXISTS hiveserver2smoke20408 ( foo INT, bar STRING ); -DESCRIBE hiveserver2smoke20408; http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2Smoke.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2Smoke.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2Smoke.sh deleted file mode 100644 index 77d7b3e..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/hiveserver2Smoke.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -smokeout=`/usr/lib/hive/bin/beeline -u $1 -n fakeuser -p fakepwd -d org.apache.hive.jdbc.HiveDriver -e '!run $2' 2>&1| awk '{print}'|grep Error` - -if [ "x$smokeout" == "x" ]; then - echo "Smoke test of hiveserver2 passed" - exit 0 -else - echo "Smoke test of hiveserver2 wasnt passed" - echo $smokeout - exit 1 -fi http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/pigSmoke.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/pigSmoke.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/pigSmoke.sh deleted file mode 100644 index 2e90ac0..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/pigSmoke.sh +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License - -A = load 'passwd' using PigStorage(':'); -B = foreach A generate \$0 as id; -store B into 'pigsmoke.out'; http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/removeMysqlUser.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/removeMysqlUser.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/removeMysqlUser.sh deleted file mode 100644 index 7b6d331..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/removeMysqlUser.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -mysqldservice=$1 -mysqldbuser=$2 -userhost=$3 -myhostname=$(hostname -f) -sudo_prefix = "/var/lib/ambari-agent/ambari-sudo.sh -H -E" - -$sudo_prefix service $mysqldservice start -echo "Removing user $mysqldbuser@$userhost" -/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"DROP USER '$mysqldbuser'@'$userhost';\"" -/var/lib/ambari-agent/ambari-sudo.sh su mysql -s /bin/bash - -c "mysql -u root -e \"flush privileges;\"" -$sudo_prefix service $mysqldservice stop http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/startMetastore.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/startMetastore.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/startMetastore.sh deleted file mode 100644 index 86541f0..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/startMetastore.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -HIVE_BIN=${HIVE_BIN:-"hive"} - -HIVE_CONF_DIR=$4 $HIVE_BIN --service metastore -hiveconf hive.log.file=hivemetastore.log -hiveconf hive.log.dir=$5 > $1 2> $2 & -echo $!|cat>$3 http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/templetonSmoke.sh ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/templetonSmoke.sh b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/templetonSmoke.sh deleted file mode 100644 index dd00e02..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/files/templetonSmoke.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -export ttonhost=$1 -export smoke_test_user=$2 -export templeton_port=$3 -export ttonTestScript=$4 -export smoke_user_keytab=$5 -export security_enabled=$6 -export kinit_path_local=$7 -export smokeuser_principal=$8 -export ttonurl="http://${ttonhost}:${templeton_port}/templeton/v1" - -if [[ $security_enabled == "true" ]]; then - kinitcmd="${kinit_path_local} -kt ${smoke_user_keytab} ${smokeuser_principal}; " -else - kinitcmd="" -fi - -export no_proxy=$ttonhost -cmd="${kinitcmd}curl --negotiate -u : -s -w 'http_code <%{http_code}>' $ttonurl/status 2>&1" -retVal=`/var/lib/ambari-agent/ambari-sudo.sh su ${smoke_test_user} -s /bin/bash - -c "$cmd"` -httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'` - -# try again for 2.3 username requirement -if [[ "$httpExitCode" == "500" ]] ; then - cmd="${kinitcmd}curl --negotiate -u : -s -w 'http_code <%{http_code}>' $ttonurl/status?user.name=$smoke_test_user 2>&1" - retVal=`/var/lib/ambari-agent/ambari-sudo.sh su ${smoke_test_user} -s /bin/bash - -c "$cmd"` - httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'` -fi - -if [[ "$httpExitCode" -ne "200" ]] ; then - echo "Templeton Smoke Test (status cmd): Failed. : $retVal" - export TEMPLETON_EXIT_CODE=1 - exit 1 -fi - -exit 0 - -#try hcat ddl command -echo "user.name=${smoke_test_user}&exec=show databases;" /tmp/show_db.post.txt -cmd="${kinitcmd}curl --negotiate -u : -s -w 'http_code <%{http_code}>' -d \@${destdir}/show_db.post.txt $ttonurl/ddl 2>&1" -retVal=`/var/lib/ambari-agent/ambari-sudo.sh su ${smoke_test_user} -s /bin/bash - -c "$cmd"` -httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'` - -if [[ "$httpExitCode" -ne "200" ]] ; then - echo "Templeton Smoke Test (ddl cmd): Failed. : $retVal" - export TEMPLETON_EXIT_CODE=1 - exit 1 -fi - -# NOT SURE?? SUHAS -if [[ $security_enabled == "true" ]]; then - echo "Templeton Pig Smoke Tests not run in secure mode" - exit 0 -fi - -#try pig query -ttonTestScript="idtest.${outname}.pig" - -#create, copy post args file -echo -n "user.name=${smoke_test_user}&file=/tmp/$ttonTestScript" > /tmp/pig_post.txt - -#submit pig query -cmd="curl -s -w 'http_code <%{http_code}>' -d \@${destdir}/pig_post.txt $ttonurl/pig 2>&1" -retVal=`/var/lib/ambari-agent/ambari-sudo.sh su ${smoke_test_user} -s /bin/bash - -c "$cmd"` -httpExitCode=`echo $retVal |sed 's/.*http_code <\([0-9]*\)>.*/\1/'` -if [[ "$httpExitCode" -ne "200" ]] ; then - echo "Templeton Smoke Test (pig cmd): Failed. : $retVal" - export TEMPLETON_EXIT_CODE=1 - exit 1 -fi - -exit 0 http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/__init__.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/__init__.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/__init__.py deleted file mode 100644 index 5561e10..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat.py deleted file mode 100644 index a867722..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -from resource_management import * -import sys -from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl -from ambari_commons import OSConst - - -@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY) -def hcat(): - import params - - XmlConfig("hive-site.xml", - conf_dir = params.hive_conf_dir, - configurations = params.config['configurations']['hive-site'], - owner=params.hive_user, - configuration_attributes=params.config['configuration_attributes']['hive-site'] - ) - - -@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) -def hcat(): - import params - - Directory(params.hive_conf_dir, - recursive=True, - owner=params.hcat_user, - group=params.user_group, - ) - - - Directory(params.hcat_conf_dir, - recursive=True, - owner=params.hcat_user, - group=params.user_group, - ) - - Directory(params.hcat_pid_dir, - owner=params.webhcat_user, - recursive=True - ) - - XmlConfig("hive-site.xml", - conf_dir=params.hive_client_conf_dir, - configurations=params.hive_site_config, - configuration_attributes=params.config['configuration_attributes']['hive-site'], - owner=params.hive_user, - group=params.user_group, - mode=0644) - - File(format("{hcat_conf_dir}/hcat-env.sh"), - owner=params.hcat_user, - group=params.user_group, - content=InlineTemplate(params.hcat_env_sh_template) - ) http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_client.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_client.py deleted file mode 100644 index c73254c..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_client.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -import sys -from resource_management import * -from hcat import hcat -from ambari_commons import OSConst -from ambari_commons.os_family_impl import OsFamilyImpl - - -class HCatClient(Script): - def install(self, env): - import params - self.install_packages(env, exclude_packages=params.hive_exclude_packages) - self.configure(env) - - def configure(self, env): - import params - env.set_params(params) - hcat() - - def status(self, env): - raise ClientComponentHasNoStatus() - - -@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) -class HCatClientDefault(HCatClient): - def get_stack_to_component(self): - return {"BigInsights": "hadoop-client"} - - -if __name__ == "__main__": - HCatClient().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_service_check.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_service_check.py deleted file mode 100644 index 574939a..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hcat_service_check.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -import os -from resource_management import * -from resource_management.libraries.functions import get_unique_id_and_date -from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl -from ambari_commons import OSConst - -@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) -def hcat_service_check(): - import params - unique = get_unique_id_and_date() - output_file = format("{hive_apps_whs_dir}/hcatsmoke{unique}") - test_cmd = format("fs -test -e {output_file}") - - if params.security_enabled: - kinit_cmd = format( - "{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal}; ") - else: - kinit_cmd = "" - - File(format("{tmp_dir}/hcatSmoke.sh"), - content=StaticFile("hcatSmoke.sh"), - mode=0755 - ) - - prepare_cmd = format("{kinit_cmd}env JAVA_HOME={java64_home} {tmp_dir}/hcatSmoke.sh hcatsmoke{unique} prepare {purge_tables}") - - exec_path = params.execute_path - if params.version and params.stack_name: - upgrade_hive_bin = format("/usr/iop/{version}/hive/bin") - exec_path = os.environ['PATH'] + os.pathsep + params.hadoop_bin_dir + os.pathsep + upgrade_hive_bin - - Execute(prepare_cmd, - tries=3, - user=params.smokeuser, - try_sleep=5, - path=['/usr/sbin', '/usr/local/bin', '/bin', '/usr/bin', exec_path], - logoutput=True) - - if params.security_enabled: - ExecuteHadoop(test_cmd, - user=params.hdfs_user, - logoutput=True, - conf_dir=params.hadoop_conf_dir, - security_enabled=params.security_enabled, - kinit_path_local=params.kinit_path_local, - keytab=params.hdfs_user_keytab, - principal=params.hdfs_principal_name, - bin_dir=params.execute_path) - else: - ExecuteHadoop(test_cmd, - user=params.hdfs_user, - logoutput=True, - conf_dir=params.hadoop_conf_dir, - security_enabled=params.security_enabled, - kinit_path_local=params.kinit_path_local, - keytab=params.hdfs_user_keytab, - bin_dir=params.execute_path - ) - - cleanup_cmd = format("{kinit_cmd} {tmp_dir}/hcatSmoke.sh hcatsmoke{unique} cleanup {purge_tables}") - - Execute(cleanup_cmd, - tries=3, - user=params.smokeuser, - try_sleep=5, - path=['/usr/sbin', '/usr/local/bin', '/bin', '/usr/bin', exec_path], - logoutput=True) http://git-wip-us.apache.org/repos/asf/ambari/blob/44e21f8e/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hive.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hive.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hive.py deleted file mode 100644 index 5fe7244..0000000 --- a/ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/hive.py +++ /dev/null @@ -1,421 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -import os -import glob -from urlparse import urlparse -from resource_management import PropertiesFile - -from resource_management.libraries.script.script import Script -from resource_management.libraries.resources.hdfs_resource import HdfsResource -from resource_management.libraries.functions.copy_tarball import copy_to_hdfs -from resource_management.libraries.functions.version import compare_versions -from resource_management.core.resources.service import ServiceConfig -from resource_management.core.resources.system import File, Execute, Directory -from resource_management.core.source import StaticFile, Template, DownloadSource, InlineTemplate -from resource_management.core.shell import as_user -from resource_management.libraries.functions.is_empty import is_empty -from resource_management.libraries.resources.xml_config import XmlConfig -from resource_management.libraries.functions.format import format -from resource_management.core.exceptions import Fail -from resource_management.core.shell import as_sudo -from resource_management.core.shell import quote_bash_args -from resource_management.core.logger import Logger -from resource_management.core import utils - -from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl -from ambari_commons import OSConst - - -@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY) -def hive(name=None): - import params - - XmlConfig("hive-site.xml", - conf_dir = params.hive_conf_dir, - configurations = params.config['configurations']['hive-site'], - owner=params.hive_user, - configuration_attributes=params.config['configuration_attributes']['hive-site'] - ) - - if name in ["hiveserver2","metastore"]: - # Manually overriding service logon user & password set by the installation package - service_name = params.service_map[name] - ServiceConfig(service_name, - action="change_user", - username = params.hive_user, - password = Script.get_password(params.hive_user)) - Execute(format("cmd /c hadoop fs -mkdir -p {hive_warehouse_dir}"), logoutput=True, user=params.hadoop_user) - - if name == 'metastore': - if params.init_metastore_schema: - check_schema_created_cmd = format('cmd /c "{hive_bin}\\hive.cmd --service schematool -info ' - '-dbType {hive_metastore_db_type} ' - '-userName {hive_metastore_user_name} ' - '-passWord {hive_metastore_user_passwd!p}' - '&set EXITCODE=%ERRORLEVEL%&exit /B %EXITCODE%"', #cmd "feature", propagate the process exit code manually - hive_bin=params.hive_bin, - hive_metastore_db_type=params.hive_metastore_db_type, - hive_metastore_user_name=params.hive_metastore_user_name, - hive_metastore_user_passwd=params.hive_metastore_user_passwd) - try: - Execute(check_schema_created_cmd) - except Fail: - create_schema_cmd = format('cmd /c {hive_bin}\\hive.cmd --service schematool -initSchema ' - '-dbType {hive_metastore_db_type} ' - '-userName {hive_metastore_user_name} ' - '-passWord {hive_metastore_user_passwd!p}', - hive_bin=params.hive_bin, - hive_metastore_db_type=params.hive_metastore_db_type, - hive_metastore_user_name=params.hive_metastore_user_name, - hive_metastore_user_passwd=params.hive_metastore_user_passwd) - Execute(create_schema_cmd, - user = params.hive_user, - logoutput=True - ) - - if name == "hiveserver2": - if params.hive_execution_engine == "tez": - # Init the tez app dir in hadoop - script_file = __file__.replace('/', os.sep) - cmd_file = os.path.normpath(os.path.join(os.path.dirname(script_file), "..", "files", "hiveTezSetup.cmd")) - - Execute("cmd /c " + cmd_file, logoutput=True, user=params.hadoop_user) - - -@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) -def hive(name=None): - import params - - if name == 'hiveserver2': - # BigInsights 4.0.* or lower - if params.stack_version != "" and compare_versions(params.stack_version, "4.1.0.0") < 0: - params.HdfsResource(params.webhcat_apps_dir, - type="directory", - action="create_on_execute", - owner=params.webhcat_user, - mode=0755 - ) - - # Create webhcat dirs. - if params.hcat_hdfs_user_dir != params.webhcat_hdfs_user_dir: - params.HdfsResource(params.hcat_hdfs_user_dir, - type="directory", - action="create_on_execute", - owner=params.hcat_user, - mode=params.hcat_hdfs_user_mode - ) - - params.HdfsResource(params.webhcat_hdfs_user_dir, - type="directory", - action="create_on_execute", - owner=params.webhcat_user, - mode=params.webhcat_hdfs_user_mode - ) - - # ****** Begin Copy Tarballs ****** - # ********************************* - if params.stack_version != "" and compare_versions(params.stack_version, '4.0.0.0') >= 0: - copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, host_sys_prepped=params.host_sys_prepped) - - # Always copy pig.tar.gz and hive.tar.gz using the appropriate mode. - copy_to_hdfs("pig", - params.user_group, - params.hdfs_user, - file_mode=params.tarballs_mode, - custom_source_file=params.pig_tar_source, - custom_dest_file=params.pig_tar_dest_file, - host_sys_prepped=params.host_sys_prepped) - copy_to_hdfs("hive", - params.user_group, - params.hdfs_user, - file_mode=params.tarballs_mode, - custom_source_file=params.hive_tar_source, - custom_dest_file=params.hive_tar_dest_file, - host_sys_prepped=params.host_sys_prepped) - - wildcard_tarballs = ["sqoop", "hadoop_streaming"] - for tarball_name in wildcard_tarballs: - source_file_pattern = eval("params." + tarball_name + "_tar_source") - dest_dir = eval("params." + tarball_name + "_tar_dest_dir") - - if source_file_pattern is None or dest_dir is None: - continue - - source_files = glob.glob(source_file_pattern) if "*" in source_file_pattern else [source_file_pattern] - for source_file in source_files: - src_filename = os.path.basename(source_file) - dest_file = os.path.join(dest_dir, src_filename) - - copy_to_hdfs(tarball_name, - params.user_group, - params.hdfs_user, - file_mode=params.tarballs_mode, - custom_source_file=source_file, - custom_dest_file=dest_file, - host_sys_prepped=params.host_sys_prepped) - # ******* End Copy Tarballs ******* - # ********************************* - - params.HdfsResource(params.hive_apps_whs_dir, - type="directory", - action="create_on_execute", - owner=params.hive_user, - group=params.user_group, - mode=0770 - ) - # Create Hive User Dir - params.HdfsResource(params.hive_hdfs_user_dir, - type="directory", - action="create_on_execute", - owner=params.hive_user, - mode=params.hive_hdfs_user_mode - ) - - # hive.exec.scratchdir should be created via hive_user - # otherwise, hive.start.cleanup.scratchdir won't work, because ambari services always started by hive_user - if not is_empty(params.hive_exec_scratchdir): - params.HdfsResource(params.hive_exec_scratchdir, - type="directory", - action="create_on_execute", - owner=params.hive_user, - group=params.hdfs_user, - mode=0777) # Hive expects this dir to be writeable by everyone as it is used as a temp dir - - params.HdfsResource(None, action="execute") - - Directory(params.hive_etc_dir_prefix, - mode=0755 - ) - - # We should change configurations for client as well as for server. - # The reason is that stale-configs are service-level, not component. - for conf_dir in params.hive_conf_dirs_list: - fill_conf_dir(conf_dir) - - hive_site_permission = 0644; - if name in ["hiveserver2","metastore"]: - hive_site_permission = 0640; - XmlConfig("hive-site.xml", - conf_dir=params.hive_config_dir, - configurations=params.hive_site_config, - configuration_attributes=params.config['configuration_attributes']['hive-site'], - owner=params.hive_user, - group=params.user_group, - mode=hive_site_permission) - - if params.hive_specific_configs_supported and name == 'hiveserver2': - XmlConfig("hiveserver2-site.xml", - conf_dir=params.hive_server_conf_dir, - configurations=params.config['configurations']['hiveserver2-site'], - configuration_attributes=params.config['configuration_attributes']['hiveserver2-site'], - owner=params.hive_user, - group=params.user_group, - mode=0644) - - File(format("{hive_config_dir}/hive-env.sh"), - owner=params.hive_user, - group=params.user_group, - content=InlineTemplate(params.hive_env_sh_template) - ) - - # On some OS this folder could be not exists, so we will create it before pushing there files - Directory(params.limits_conf_dir, - recursive=True, - owner='root', - group='root' - ) - - File(os.path.join(params.limits_conf_dir, 'hive.conf'), - owner='root', - group='root', - mode=0644, - content=Template("hive.conf.j2") - ) - - if (name == 'metastore' or name == 'hiveserver2') and not os.path.exists(params.target): - jdbc_connector() - - File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"), - content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")), - mode = 0644, - ) - - if name == 'metastore': - File(params.start_metastore_path, - mode=0755, - content=StaticFile('startMetastore.sh') - ) - if params.init_metastore_schema: - create_schema_cmd = format("export HIVE_CONF_DIR={hive_server_conf_dir} ; " - "{hive_bin}/schematool -initSchema " - "-dbType {hive_metastore_db_type} " - "-userName {hive_metastore_user_name} " - "-passWord {hive_metastore_user_passwd!p}") - - check_schema_created_cmd = as_user(format("export HIVE_CONF_DIR={hive_server_conf_dir} ; " - "{hive_bin}/schematool -info " - "-dbType {hive_metastore_db_type} " - "-userName {hive_metastore_user_name} " - "-passWord {hive_metastore_user_passwd!p}"), params.hive_user) - - # HACK: in cases with quoted passwords and as_user (which does the quoting as well) !p won't work for hiding passwords. - # Fixing it with the hack below: - quoted_hive_metastore_user_passwd = quote_bash_args(quote_bash_args(params.hive_metastore_user_passwd)) - if quoted_hive_metastore_user_passwd[0] == "'" and quoted_hive_metastore_user_passwd[-1] == "'" \ - or quoted_hive_metastore_user_passwd[0] == '"' and quoted_hive_metastore_user_passwd[-1] == '"': - quoted_hive_metastore_user_passwd = quoted_hive_metastore_user_passwd[1:-1] - Logger.sensitive_strings[repr(check_schema_created_cmd)] = repr(check_schema_created_cmd.replace( - format("-passWord {quoted_hive_metastore_user_passwd}"), "-passWord " + utils.PASSWORDS_HIDE_STRING)) - - Execute(create_schema_cmd, - not_if = check_schema_created_cmd, - user = params.hive_user - ) - elif name == 'hiveserver2': - File(params.start_hiveserver2_path, - mode=0755, - content=Template(format('{start_hiveserver2_script}')) - ) - - if name != "client": - crt_directory(params.hive_pid_dir) - crt_directory(params.hive_log_dir) - crt_directory(params.hive_var_lib) - -def fill_conf_dir(component_conf_dir): - import params - - Directory(component_conf_dir, - owner=params.hive_user, - group=params.user_group, - recursive=True - ) - - XmlConfig("mapred-site.xml", - conf_dir=component_conf_dir, - configurations=params.config['configurations']['mapred-site'], - configuration_attributes=params.config['configuration_attributes']['mapred-site'], - owner=params.hive_user, - group=params.user_group, - mode=0644) - - - crt_file(format("{component_conf_dir}/hive-default.xml.template")) - crt_file(format("{component_conf_dir}/hive-env.sh.template")) - - log4j_exec_filename = 'hive-exec-log4j.properties' - if (params.log4j_exec_props != None): - File(format("{component_conf_dir}/{log4j_exec_filename}"), - mode=0644, - group=params.user_group, - owner=params.hive_user, - content=params.log4j_exec_props - ) - elif (os.path.exists("{component_conf_dir}/{log4j_exec_filename}.template")): - File(format("{component_conf_dir}/{log4j_exec_filename}"), - mode=0644, - group=params.user_group, - owner=params.hive_user, - content=StaticFile(format("{component_conf_dir}/{log4j_exec_filename}.template")) - ) - - log4j_filename = 'hive-log4j.properties' - if (params.log4j_props != None): - File(format("{component_conf_dir}/{log4j_filename}"), - mode=0644, - group=params.user_group, - owner=params.hive_user, - content=params.log4j_props - ) - elif (os.path.exists("{component_conf_dir}/{log4j_filename}.template")): - File(format("{component_conf_dir}/{log4j_filename}"), - mode=0644, - group=params.user_group, - owner=params.hive_user, - content=StaticFile(format("{component_conf_dir}/{log4j_filename}.template")) - ) - -def crt_directory(name): - import params - - Directory(name, - recursive=True, - cd_access='a', - owner=params.hive_user, - group=params.user_group, - mode=0755) - -def crt_file(name): - import params - - File(name, - owner=params.hive_user, - group=params.user_group - ) - -def jdbc_connector(): - import params - - if params.hive_jdbc_driver in params.hive_jdbc_drivers_list and params.hive_use_existing_db: - environment = { - "no_proxy": format("{ambari_server_hostname}") - } - - # TODO: should be removed after ranger_hive_plugin will not provide jdbc - Execute(('rm', '-f', params.prepackaged_ojdbc_symlink), - path=["/bin", "/usr/bin/"], - sudo = True) - - File(params.downloaded_custom_connector, - content = DownloadSource(params.driver_curl_source)) - - # maybe it will be more correcvly to use db type - if params.sqla_db_used: - untar_sqla_type2_driver = ('tar', '-xvf', params.downloaded_custom_connector, '-C', params.tmp_dir) - - Execute(untar_sqla_type2_driver, sudo = True) - - Execute(format("yes | {sudo} cp {jars_path_in_archive} {hive_lib}")) - - Directory(params.jdbc_libs_dir, - recursive=True) - - Execute(format("yes | {sudo} cp {libs_path_in_archive} {jdbc_libs_dir}")) - - Execute(format("{sudo} chown -R {hive_user}:{user_group} {hive_lib}/*")) - - else: - Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.target), - #creates=params.target, TODO: uncomment after ranger_hive_plugin will not provide jdbc - path=["/bin", "/usr/bin/"], - sudo = True) - - else: - #for default hive db (Mysql) - Execute(('cp', '--remove-destination', format('/usr/share/java/{jdbc_jar_name}'), params.target), - #creates=params.target, TODO: uncomment after ranger_hive_plugin will not provide jdbc - path=["/bin", "/usr/bin/"], - sudo=True - ) - - File(params.target, - mode = 0644, - )