How can I select certain rows that the key starts with a prefix in Hive?

Viewed 4164

A very simple question:

I wanted to select all the rows that their keys have a certain prefix in Hive, but somehow it's not working.

The queries I've tried:

select * from solr_json_history where dt='20170814' and hour='2147' and substr(`_root_`,1,9)='P10004232' limit 100;

SELECT * FROM solr_json_history where dt='20170814' and hour='2147' and `_root_` like 'P19746284%' limit 100; 

My Hue editor just hangs there without returning anything.

I've checked this time range there's data in my table by this query:

select * from solr_json_history where dt='20170814' and hour='2147' limit 15;

It's returning 15 records as expected.

Any help please?

Thanks a lot!

1 Answers
Related