메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

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


hive lateral view 예제

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


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


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 FAILED: IllegalStateException Variable substitution depth too large: 40 오류발생시 조치사항 2014.08.19 4588
26 [CDP7.1.7, Hive Replication]Hive Replication진행중 "The following columns have types incompatible with the existing columns in their respective positions " 오류 2023.12.27 4584
25 json serde사용법 2014.04.17 4536
24 sequence한 번호 생성방법 2014.04.25 4525
23 index생성, 삭제, 활용 2014.04.25 4490
22 unique한 값 생성 2014.04.25 4451
21 hive query에서 mapreduce돌리지 않고 select하는 방법 2014.05.23 4430
20 AIX 7.1에서 hive실행시 "hive: line 86: readlink: command not found" 오류가 발생시 임시 조치사항 2016.09.25 4301
19 external partition table생성및 data확인 2014.04.03 4279
18 dual table만들기 2014.05.16 4246
17 json 값 다루기 2014.04.17 4218
16 [sentry]role부여후 테이블명이 변경되어 오류가 발생할때 조치방법 2018.10.16 4200
15 hive metastore db중 TBLS, TABLE_PARAMS테이블 설명 2021.10.22 4164
14 hive 0.13.1 설치 + meta정보는 postgresql 9.3에 저장 2015.04.30 4115
13 hive metastore ERD file 2018.09.20 4107
12 beeline으로 접근시 "User: gooper is not allowed to impersonate anonymous (state=08S01,code=0)"가 발생하면서 "No current connection"이 발생하는 경우 조치 2018.04.15 4104
11 schema설정없이 hive를 최초에 실행했을때 발생하는 오류메세지및 처리방법 2016.09.25 4061
10 Hive JDBC Connection과 유형별 에러및 필요한 jar파일 2021.05.24 4003
» lateral view 예제 2014.09.18 3905
8 impala session type별 표시되는 정보로 구분하는 방법 2021.05.25 3877
위로