HIVE Select columns names with regular expression?

前端 未结 2 2059
遇见更好的自我
遇见更好的自我 2021-01-25 09:19

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 lis

2条回答
  •  情深已故
    2021-01-25 09:49

    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.

提交回复
热议问题