Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HIVE Select columns names with regular expression?

Tags:

hive

I want to know if it can be queried about the columns in the hive ith term rehiliare selection for the starting columns of some description?

example: table with this list of names of columns pattern1 pattern2 motif3 balab1 balabal2 ma1 ma2 ma3

select (an expression for that selection columns beginners with pattern) from table

Thank you

like image 889
malouke Avatar asked Jan 19 '26 15:01

malouke


1 Answers

I believe you are looking to select columns based on regular expression.

Well below works:

  set hive.support.quoted.identifiers=none;
  select `patt.*` from test_table;

Above code will return columns pattern1 pattern2 among your mentioned columns "pattern1 pattern2 motif3 balab1 balabal2 ma1 ma2 ma3"

Please see https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Select#LanguageManualSelect-REGEXColumnSpecification for more information.

like image 170
Ram Manohar Avatar answered Jan 21 '26 09:01

Ram Manohar