메뉴 건너뛰기

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)

번호 제목 날짜 조회 수
170 hbase가 기동시키는 zookeeper에서 받아드리는 ip가 IPv6로 사용되는 경우가 있는데 이를 IPv4로 강제적용하는 방법 2015.05.08 4571
169 [CDP7.1.7]EncryptionZone에 table생성및 권한 테스트 2023.09.26 4579
168 [Kerberos]병렬 kinit 호출시 cache파일이 손상되어 Bad format in credentials cache 혹은 No credentials cache found 혹은 Internal credentials cache error 오류 발생시 2023.01.20 4582
167 [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
166 FAILED: IllegalStateException Variable substitution depth too large: 40 오류발생시 조치사항 2014.08.19 4587
165 oozie webui접근시 id/pw를 물어보는 Windows보안 팝업창이 뜰때 확인/조치방법 2022.05.02 4588
164 Hadoop wordcount 소스 작성 file 2013.03.06 4595
163 hadoop nfs gateway설정 (Cloudera 6.3.4, CentOS 7.4 환경에서) 2022.01.07 4601
162 you are accessing a non-optimized hue please switch to one of the available addresses 2021.10.06 4606
161 oozie의 sqoop action수행시 ooize:launcher의 applicationId를 이용하여 oozie:action의 applicationId및 관련 로그를 찾는 방법 2023.07.26 4606
160 [Hadoop Encryption] Encryption Zone에 생성된 table에 Hue에서 insert 수행시 User:hdfs not allowed to do 'DECRYPT_EEK' ON 'testkey' 오류 2023.11.01 4607
159 service name방식의 oracle을 메타정보 저장소로 사용할때 Hue Configuration설정하는 방법 2022.02.12 4608
158 root가 localhost에서 mysql로 접근하지 못하는 경우의 해결방법(패스워드) 2014.09.10 4610
157 Oozie 설치, 환경설정 및 테스트 2014.04.08 4612
156 Tracking URL = N/A 가발생하는 경우 - 환경설정값을 잘못설정하는 경우에 발생함 2015.06.17 4616
155 Error: IO_ERROR : java.io.IOException: Error while connecting Oozie server 2022.05.02 4618
154 hive에서 생성된 external table에서 hbase의 table에 값 insert하기 2014.04.11 4631
153 [JSON 파싱]mongodb의 document를 GSON을 이용하여 parsing할때 ObjectId값에서 오류 발생시 조치방법 2017.01.18 4631
152 console명령과 API비교 2015.12.21 4632
151 access=WRITE, inode="staging":ubuntu:supergroup:rwxr-xr-x 오류 2014.07.05 4635
위로