From 31a80520a977c08c76218fdc2c6d41a09501973a Mon Sep 17 00:00:00 2001 From: congyi <15605187270@163.com> Date: Thu, 14 Mar 2024 16:20:06 +0800 Subject: [PATCH] minor --- src/connector/src/sink/encoder/json.rs | 32 +++----------------------- src/connector/src/sink/encoder/mod.rs | 1 - 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/connector/src/sink/encoder/json.rs b/src/connector/src/sink/encoder/json.rs index 13fce6f5cfe75..64a06ff70770f 100644 --- a/src/connector/src/sink/encoder/json.rs +++ b/src/connector/src/sink/encoder/json.rs @@ -114,23 +114,6 @@ impl JsonEncoder { } } - pub fn new_with_s3( - schema: Schema, - col_indices: Option>, - _map: HashMap, - ) -> Self { - Self { - schema, - col_indices, - time_handling_mode: TimeHandlingMode::Milli, - date_handling_mode: DateHandlingMode::String, - timestamp_handling_mode: TimestampHandlingMode::String, - timestamptz_handling_mode: TimestamptzHandlingMode::UtcWithoutSuffix, - custom_json_type: CustomJsonType::S3, - kafka_connect: None, - } - } - pub fn new_with_bigquery(schema: Schema, col_indices: Option>) -> Self { Self { schema, @@ -276,10 +259,7 @@ fn datum_to_json_object( } json!(v_string) } - CustomJsonType::Es - | CustomJsonType::None - | CustomJsonType::BigQuery - | CustomJsonType::S3 => { + CustomJsonType::Es | CustomJsonType::None | CustomJsonType::BigQuery => { json!(v.to_text()) } }, @@ -331,10 +311,7 @@ fn datum_to_json_object( } (DataType::Jsonb, ScalarRefImpl::Jsonb(jsonb_ref)) => match custom_json_type { CustomJsonType::Es | CustomJsonType::StarRocks(_) => JsonbVal::from(jsonb_ref).take(), - CustomJsonType::Doris(_) - | CustomJsonType::None - | CustomJsonType::BigQuery - | CustomJsonType::S3 => { + CustomJsonType::Doris(_) | CustomJsonType::None | CustomJsonType::BigQuery => { json!(jsonb_ref.to_string()) } }, @@ -385,10 +362,7 @@ fn datum_to_json_object( "starrocks can't support struct".to_string(), )); } - CustomJsonType::Es - | CustomJsonType::None - | CustomJsonType::BigQuery - | CustomJsonType::S3 => { + CustomJsonType::Es | CustomJsonType::None | CustomJsonType::BigQuery => { let mut map = Map::with_capacity(st.len()); for (sub_datum_ref, sub_field) in struct_ref.iter_fields_ref().zip_eq_debug( st.iter() diff --git a/src/connector/src/sink/encoder/mod.rs b/src/connector/src/sink/encoder/mod.rs index 97b2cb1f8eb99..3254447e27077 100644 --- a/src/connector/src/sink/encoder/mod.rs +++ b/src/connector/src/sink/encoder/mod.rs @@ -144,7 +144,6 @@ pub enum CustomJsonType { Es, // starrocks' need jsonb is struct StarRocks(HashMap), - S3, // bigquery need null array -> [] BigQuery, None,