1.背景
我在使用seatunnel实现从mysql导入到hive的时候,遇到mysql中存在回车换行符“\n\r”时,到hive中会出现在换行符处切分,导致换行前的一条记录后面的列都是空,而换行后的一条记录的前面的列都是空,严重干扰了结果的准确性,所以需要解决这个问题。
本身seatunnel的filter是有将列里面的内容通过使用正则的方式进行替换的,但是需要每一个列都要进行配置,如果列特别多的话,会产生很大的工作量。Seatunnel Replace
filter{
replace {
target_field = "col1"
source_field = "col1"
pattern = "[\n\r]"
replacement = ""
result_table_name = "tb_tmp1"
}
replace {
source_table_name = "tb_tmp1"
target_field = "col2"
source_field = "col2"
pattern = "[\n\r]"
replacement = ""
result_table_name = "tb_tmp2"
}