简体   繁体   中英

select row from orc snappy table in hive

I have created a table employee_orc which is orc format with snappy compression.

    create table employee_orc(emp_id string, name string)
 row format delimited fields terminated by '\t' stored as orc tblproperties("orc.compress"="SNAPPY");

I have uploaded data into the table using the insert statement.

employee_orc table has 1000 records.

When I run the below query, it shows all the records

select * from employee_orc;

But when run the below query, it shows zero results even though the records exist.

select * from employee_orc where emp_id = "EMP456";

Why I am unable to retrieve a single record from the employee_orc table?

The record does not exist. You may think they are the same because they look the same, but there is some difference. One possibility are spaces at the beginning or end of the string. For this, you can use like :

where emp_id like '%EMP456%'

This might help you.

On my part, I don't understand why you want to specify a delimiter in ORC. Are you confusing CSV and ORC or external vs managed ? I advice you to create your table differently

create table employee_orc(emp_id string, name string) stored as ORC TBLPROPERTIES ( "orc.compress"="ZLIB");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM