2

I am trying to run the following

alter table historical_data drop partition (my_date not rlike '[A-Za-z]');

Which gives me an Exception

org.apache.hadoop.hive.ql.parse.ParseException: line 2:69 mismatched input 'not' expecting set null in drop partition statement

I couldn't find anything similar. I did see one answer on some question in SO but it doesn't work.

Any help is appreciated.

leftjoin
  • 36,950
  • 8
  • 57
  • 116
Akshay Hazari
  • 3,186
  • 4
  • 48
  • 84

1 Answers1

2

Regexp is not supported unfortunately.

You can use all these comparators < > <= >= <> = != maybe it will help. See usage in this answer: https://stackoverflow.com/a/56646879/2700344

See also this jira Extend ALTER TABLE DROP PARTITION syntax to use all comparators

Also one more jira not implemented yet: Extend ALTER TABLE DROP PARTITION syntax to use multiple conditions

Impala supports LIKE in drop partition:

alter table historical_data drop partition (year < 1995, last_name like 'A%');

Created this Jira for adding regexp, please vote in the Jira if you need it.

leftjoin
  • 36,950
  • 8
  • 57
  • 116
  • Yeah , we can use < or > , and if it is a date like pattern similar to my case , we can use a future date (my_date > '2020-12-12') . But it could be a new request to add regex similar to the Jiras request for other features you shared , and this would yet be unresolved and closed. Thank you leftjoin. – Akshay Hazari Apr 26 '19 at 04:46