하이브(Hive) 테이블 생성

2021. 5. 6. 02:16 Big Data/Apache Hive

하이브(Hive) 테이블 생성

하이브 테이블이 만약 textfile로 되어 있다면,
테이블을 load하거나, hue에서 테이블을 로딩할때 에러가 발생하는 경우가 있다.
malformed ORC 에러가 뜬다면, 하이브 테이블의 타입을 확인할 필요가 있다.
이럴 경우에는 아래와 같이 기존 textfile을 orc테이블의 형태로 생성한 뒤에 export/import를 하면 에러 없이 진행이 된다.

 

코드

drop table if exists target_table;
CREATE TABLE target_table
stored as orc
tblproperties ("orc.compress"="ZLIB")
as
select * from source_table;

 

출처 : ourcstory.tistory.com/370?category=717035