HIVE Select columns names with regular expression?

前端 未结 2 1984
遇见更好的自我
遇见更好的自我 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:34

    You have to use back quote character (above tilda in the keyboard not the single quote) after select and before from to run regular expression in the hive.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题