메뉴 건너뛰기

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;

번호 제목 글쓴이 날짜 조회 수
440 메이븐 (maven) 설치 및 이클립스 연동하기 file 구퍼 2013.03.06 2280
439 Hadoop 설치 및 시작하기 file 구퍼 2013.03.06 1951
438 Hadoop wordcount 소스 작성 file 구퍼 2013.03.06 1888
437 이클립스에서 생성한 jar 파일 hadoop 으로 실행하기 file 구퍼 2013.03.06 2836
436 ExWordCount jar파일 file 구퍼 2013.03.06 1336
435 Hadoop Cluster 설치 (Hadoop+Zookeeper+Hbase) file 구퍼 2013.03.07 3995
434 Hive+mysql 설치 및 환경구축하기 file 구퍼 2013.03.07 2722
433 Hive 사용법 및 쿼리 샘플코드 구퍼 2013.03.07 2991
432 hadoop 설치(3대) file 구퍼 2013.03.07 2613
431 hadoop설치시 참고사항 구퍼 2013.03.08 2131
430 org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /tmp/hadoop-root/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible. 구퍼 2013.03.11 14781
429 HBase 설치하기 – Pseudo-distributed file 구퍼 2013.03.12 2644
428 HBase 설치하기 – Fully-distributed 구퍼 2013.03.12 3548
427 Cacti로 Hadoop 모니터링 하기 file 구퍼 2013.03.12 2367
426 org.apache.hadoop.hbase.PleaseHoldException: Master is initializing 구퍼 2013.03.15 2668
425 HBase shell로 작업하기 구퍼 2013.03.15 5834
424 HBase, BigTable, Cassandra Schema Design file 구퍼 2013.03.15 2509
423 하둡 분산 파일 시스템을 기반으로 색인하고 검색하기 구퍼 2013.03.15 5573
422 HBASE Client API : 기본 기능 정리 file 구퍼 2013.04.01 3554
421 Hbase Shell 명령 정리 구퍼 2013.04.01 3170

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.

위로