Skip to content

Commit ae9720f

Browse files
authored
Merge pull request #9182 from youngsofun/fix3
fix(TSV): custom field_delimiter.
2 parents d503aa2 + f3abea7 commit ae9720f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/query/pipeline/sources/src/processors/sources/input_formats/impls/input_format_tsv.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub struct InputFormatTSV {}
3737
impl InputFormatTSV {
3838
#[allow(clippy::too_many_arguments)]
3939
fn read_row(
40+
field_delimiter: u8,
4041
field_decoder: &FieldDecoderTSV,
4142
buf: &[u8],
4243
deserializers: &mut Vec<common_datavalues::TypeDeserializerImpl>,
@@ -53,7 +54,7 @@ impl InputFormatTSV {
5354
let mut err_msg = None;
5455
let buf_len = buf.len();
5556
while pos <= buf_len {
56-
if pos == buf_len || buf[pos] == b'\t' {
57+
if pos == buf_len || buf[pos] == field_delimiter {
5758
let col_data = &buf[field_start..pos];
5859
if col_data.is_empty() {
5960
deserializers[column_index].de_default();
@@ -156,6 +157,7 @@ impl InputFormatTextBase for InputFormatTSV {
156157
for (i, end) in batch.row_ends.iter().enumerate() {
157158
let buf = &batch.data[start..*end]; // include \n
158159
Self::read_row(
160+
builder.ctx.field_delimiter,
159161
field_decoder,
160162
buf,
161163
columns,

0 commit comments

Comments
 (0)