HIVE Select columns names with regular expression?

2019-08-08 19:16发布

问题:

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

回答1:

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.



标签: hive