From 8033893b13e66a38577b4e08bfa9b060feec0c82 Mon Sep 17 00:00:00 2001 From: Lordworms Date: Mon, 22 Jul 2024 16:55:18 -0700 Subject: [PATCH] optimize code --- datafusion/proto/src/logical_plan/file_formats.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/datafusion/proto/src/logical_plan/file_formats.rs b/datafusion/proto/src/logical_plan/file_formats.rs index 69028a6a95929..2c4085b888692 100644 --- a/datafusion/proto/src/logical_plan/file_formats.rs +++ b/datafusion/proto/src/logical_plan/file_formats.rs @@ -59,6 +59,9 @@ impl CsvOptionsProto { time_format: options.time_format.clone().unwrap_or_default(), null_value: options.null_value.clone().unwrap_or_default(), comment: options.comment.map_or(vec![], |v| vec![v]), + newlines_in_values: options + .newlines_in_values + .map_or(vec![], |v| vec![v as u8]), } } else { CsvOptionsProto::default() @@ -129,6 +132,11 @@ impl From<&CsvOptionsProto> for CsvOptions { } else { None }, + newlines_in_values: if proto.newlines_in_values.is_empty() { + None + } else { + Some(proto.newlines_in_values[0] != 0) + }, } } }