메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

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


hive lateral view 예제

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


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


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)

번호 제목 날짜 조회 수
27 Caused by: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D오류발생시 조치사항 2016.06.03 3508
26 hive 2.0.1 설치및 mariadb로 metastore 설정 2016.06.03 9475
25 CDH 5.4.4 버전에서 hive on tez (0.7.0)설치하기 2016.01.14 3454
24 Tracking URL = N/A 가발생하는 경우 - 환경설정값을 잘못설정하는 경우에 발생함 2015.06.17 4693
23 java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error: Unable to deserialize reduce input key from...오류해결방법 2015.06.16 6248
22 hive 0.13.1 설치 + meta정보는 postgresql 9.3에 저장 2015.04.30 4223
» lateral view 예제 2014.09.18 4021
20 banana pi에 hive 0.13.1+mysql(metastore)설치 file 2014.09.09 4942
19 FAILED: IllegalStateException Variable substitution depth too large: 40 오류발생시 조치사항 2014.08.19 4781
18 hive job실행시 meta정보를 원격의 mysql에 저장하는 경우 설정방법 2014.05.28 5210
17 hive query에서 mapreduce돌리지 않고 select하는 방법 2014.05.23 4988
16 hiverserver2기동시 connection refused가 발생하는 경우 조치방법 2014.05.22 4919
15 hive에서 insert overwrite directory.. 로 하면 default column구분자는 'SOH'혹은 't'가 됨 2014.05.20 3670
14 dual table만들기 2014.05.16 4320
13 insert hbase by hive ... error occured after 5 hours..HMaster가 뜨지 않는 장애에 대한 복구 방법 2014.04.29 10053
12 index생성, 삭제, 활용 2014.04.25 4801
11 unique한 값 생성 2014.04.25 4718
10 sequence한 번호 생성방법 2014.04.25 4866
9 json serde사용법 2014.04.17 4728
8 json 값 다루기 2014.04.17 4613
위로