current position:Home>The replacement of tab key in hive leads to a problem in the file.

The replacement of tab key in hive leads to a problem in the file.

2022-02-03 00:09:55 CSDN Q & A

Now? hive There is a field in which tab build . Import this result into a file and insert two more fields in the table . And then use regexp_replace( Field , '\s+', '') Replace tab key .select The replacement is successful . But export to file , This field in the file still has tab key . Now how to deal with ? Export file statement :hive -e "use Account ; select *,regexp_replace( Field , '\s+', '') from table" > / Catalog / file name .dat
Now how to deal with .

The phenomenon and background of the problem
Operation results and error reporting contents
My solution ideas and tried methods
What I want to achieve



Refer to the answer 1:

Why not do it by updating fields tab key , You can try it, too trim( Field )




Refer to the answer 2:



Refer to the answer 3:

Replace tab use regexp_replace( Field , '\t', '')
\s+ It's a space, isn't it tab, \t It's just tab

If the data in the original table has been misplaced , It is suggested to directly modify hdfs File in the corresponding location




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030009531911.html

Random recommended