메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


hive lateral view 예제

총관리자 2014.09.18 14:36 조회 수 : 775


---------------------------파일내용-------------


1, read a book

2,한글과 컴퓨터 만!~쉐

3,write a book



--------------------hive테이블 생성 --------------------


create external table cmt

(

c_id         int,

c_cont         string

)

row format delimited fields terminated by ','

location '/user/hadoop/input/exp';



-----------------------------cmt테이블내용-----------------


c_id c_conts

1  read a book

2 대한 민국 만!~쉐

3 write a book




----hive query --

select c_id, c_conts from cmt

lateral view explode(split(trim(c_cont),' ')) dummy as c_conts

==>

c_id c_conts

1 read

1 a

1 book

2 한글과

2 컴퓨터

2 만!~쉐

3 write

3 a

3 book

Time taken: 19.293 seconds, Fetched: 9 row(s)


-----------------------쿼리2-----------------

select c_id, c_conts from cmt

lateral view explode(split(c_cont, ' ')) dummy as c_conts

==>

c_id c_conts

1

1 read

1 a

1 book

2 한글과

2 컴퓨터

2 만!~쉐

3 write

3 a

3 book

Time taken: 18.142 seconds, Fetched: 10 row(s)

번호 제목 날짜 조회 수
47 Hive Query Examples from test code (2 of 2) 2014.03.26 11466
46 insert hbase by hive ... error occured after 5 hours..HMaster가 뜨지 않는 장애에 대한 복구 방법 2014.04.29 7249
45 hive 2.0.1 설치및 mariadb로 metastore 설정 2016.06.03 5295
44 Hive 사용법 및 쿼리 샘플코드 2013.03.07 3083
43 Hive+mysql 설치 및 환경구축하기 file 2013.03.07 2802
42 banana pi에 hive 0.13.1+mysql(metastore)설치 file 2014.09.09 2493
41 Hive java connection 설정 file 2013.04.01 2170
40 java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error: Unable to deserialize reduce input key from...오류해결방법 2015.06.16 1976
39 hive에서 생성된 external table에서 hbase의 table에 값 insert하기 2014.04.11 1820
38 index생성, 삭제, 활용 2014.04.25 1766
37 upsert구현방법(년-월-일 파티션을 기준으로) 및 테스트 script file 2018.07.03 1617
36 FAILED: IllegalStateException Variable substitution depth too large: 40 오류발생시 조치사항 2014.08.19 1597
35 hiverserver2기동시 connection refused가 발생하는 경우 조치방법 2014.05.22 1560
34 json 값 다루기 2014.04.17 1331
33 external partition table생성및 data확인 2014.04.03 1303
32 schema설정없이 hive를 최초에 실행했을때 발생하는 오류메세지및 처리방법 2016.09.25 1299
31 json으로 존재하는 데이터 parsing하기 2019.03.25 1258
30 sequence한 번호 생성방법 2014.04.25 1256
29 Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D오류발생시 조치사항 2016.06.03 1246
28 json serde사용법 2014.04.17 1196
위로