簡體   English   中英

如何使用regexp_extract在Hive中使用十進制提取數字

[英]How to extract the number with decimal in Hive using regexp_extract

我有一列是event_list。 所以我想提取20220=之后的數字。 該值將包含. 但是我只能在之前獲得價值.

我目前的查詢是

regexp_extract(event_list, '20220=([0-9]+)', 1)

event_list列就像 在此處輸入圖片說明

嘗試使用:-

regexp_extract(event_list,'20220=([0-9.]+)', 1) 

如果要在之后添加數據,則也可以在正則表達式中使用它,如下所示:-

regexp_extract(event_list,'20220=([0-9.,]+)', 1)
hive> select regexp_extract(',211,253,20219,20220=27.87,20222,20223','20220=([^,]*)',1);

27.87

要么

hive> select regexp_extract(',211,253,20219,20220=27.87,20222,20223','20220=(.*?),',1);

27.87

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM