메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


임시 테이블(db_enc.hue_user_tmp)에서 데이터를 읽어서 partitioned table(db_enc.hue_user_test)에 데이터를 입력하는 impala SQL문장으로 모두 동일한 결과를 갖는다.
(임시 테이블과 최종 테이블의 table layout은 동일하며 최종 테이블에는 partition용 column이 한개 더 있다)
Kudu table을 이용하여 Parquet table을 생성하는 경우 Kudu table은 컬럼 순서가 달라서 컬럼을 일일이 지정해 주어야 하고 파티션 컬럼은 select의 마지막에 지정해줘야 한다

-- CTAS로 table을 생성하는 SQL 예시
 1. create table db_enc.tb_hue_user partitioned by(partition_date) stored as parquet location '/ENC/DB_ENC/hue_user' 
         as select user_name, account, sentry_group, hue_last_login_date, hue_active_status, update_date, user_id, partition_date from db.hue_user;
 2. create table db_enc.tb_query_history partitioned by (partition_date) stored as parquet location '/ENC/DB_ENC/query_history' as select * from db.query_history;

-- insert into 를 사용하는 다양한 SQL 예시 (아래의 4가지는 동일한 결과를 나타낸다.)
1. 
insert into db_enc.hue_user_test(user_name, account, sentry_group, hue_last_login_date, hue_active_status, update_date, user_id) partition(partition_date='${partition_date}') 
select user_name, account, sentry_group, hue_last_login_date, hue_active_status, update_date, user_id from db_enc.hue_user_tmp;

2. 
insert into db_enc.hue_user_test(user_name, account, sentry_group, hue_last_login_date, hue_active_status, update_date, user_id) partition(partition_date) 
select user_name, account, sentry_group, hue_last_login_date, hue_active_status, update_date, user_id, '${partition_date}' as partition_date from db_enc.hue_user_tmp;

3. 
insert into db_enc.hue_user_test partition(partition_date) 
select *, '${partition_date}' as partition_date from db_enc.hue_user_tmp;

4. 
insert into db_enc.hue_user_test partition(partition_date='${partition_date}') 
select * from db_enc.hue_user_tmp;

번호 제목 글쓴이 날짜 조회 수
130 insert hbase by hive ... error occured after 5 hours..HMaster가 뜨지 않는 장애에 대한 복구 방법 총관리자 2014.04.29 7129
129 hive 2.0.1 설치및 mariadb로 metastore 설정 총관리자 2016.06.03 5185
128 Hive Query Examples from test code (2 of 2) 총관리자 2014.03.26 5023
127 Spark에서 Serializable관련 오류및 조치사항 총관리자 2017.04.21 4901
126 의사분산모드에서 presto설치하기 총관리자 2014.03.31 3050
125 Hive 사용법 및 쿼리 샘플코드 구퍼 2013.03.07 2991
124 spark-sql실행시 Caused by: java.lang.NumberFormatException: For input string: "0s" 오류발생시 조치사항 총관리자 2016.06.09 2802
123 Hive+mysql 설치 및 환경구축하기 file 구퍼 2013.03.07 2722
122 banana pi에 hive 0.13.1+mysql(metastore)설치 file 총관리자 2014.09.09 2406
121 Hive java connection 설정 file 구퍼 2013.04.01 2013
120 VisualVM 1.3.9을 이용한 spark-submit JVM 모니터링을 위한 설정및 spark-submit실행 옵션 총관리자 2016.10.28 1891
119 Spark 2.1.1 clustering(5대) 설치(YARN기반) 총관리자 2016.04.22 1882
118 hive에서 생성된 external table에서 hbase의 table에 값 insert하기 총관리자 2014.04.11 1748
117 java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error: Unable to deserialize reduce input key from...오류해결방법 총관리자 2015.06.16 1734
116 index생성, 삭제, 활용 총관리자 2014.04.25 1702
115 impald에서 idle_query_timeout 와 idle_session_timeout 구분 총관리자 2021.05.20 1630
114 FAILED: IllegalStateException Variable substitution depth too large: 40 오류발생시 조치사항 총관리자 2014.08.19 1521
113 hiverserver2기동시 connection refused가 발생하는 경우 조치방법 총관리자 2014.05.22 1471
112 schema설정없이 hive를 최초에 실행했을때 발생하는 오류메세지및 처리방법 총관리자 2016.09.25 1224
111 json 값 다루기 총관리자 2014.04.17 1222

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로