处理方案: select
(case
--处理非科学计数法表示的字符串
when length(regexp_extract(lte_drop_rate,‘([0-9]+\\.)([0-9]+)(E-*[0-9]+)‘,2))=0
then lte_drop_rate
--处理整数
when length(regexp_extract(lte_drop_rate,‘([0-9]+\\.)([0-9]+)(E[0-9]+)‘,2))<=cast(regexp_extract(lte_drop_rate,‘(E)([0-9]+)‘,2) as int)
then rpad(regexp_replace(regexp_extract(lte_drop_rate,‘([^E]+)‘,1),‘\\.‘,‘‘),cast(regexp_extract(lte_drop_rate,‘(E)([0-9]+)‘,2) as int)+1,‘0‘)
--处理小数
when length(regexp_extract(lte_drop_rate,‘([0-9]+\\.)([0-9]+)(E[0-9]+)‘,2))>cast(regexp_extract(lte_drop_rate,‘(E)([0-9]+)‘,2) as int)
then concat(substr(regexp_replace(regexp_extract(lte_drop_rate,‘([^E]+)‘,1),‘\\.‘,‘‘),1,cast(regexp_extract(lte_drop_rate,‘(E)([0-9]+)‘,2) as int)+1),‘\.‘,
substr(regexp_replace(regexp_extract(lte_drop_rate,‘([^E]+)‘,1),‘\\.‘,‘‘),cast(regexp_extract(lte_drop_rate,‘(E)([0-9]+)‘,2) as int)+2))
--处理类似“3.4E-6”这种字符串
when lte_drop_rate regexp ‘E-‘
then concat(‘0.‘,repeat(‘0‘,cast(regexp_extract(lte_drop_rate,‘(E)(-)([0-9]+)‘,3) as int)-1),regexp_replace(regexp_extract(lte_drop_rate,‘(.+)(E)‘,1),‘\\.‘,‘‘))
else lte_drop_rate
end)
from t_table limit 10