Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
wcy-fdu committed Mar 14, 2024
1 parent f4618c1 commit 31a8052
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
32 changes: 3 additions & 29 deletions src/connector/src/sink/encoder/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,6 @@ impl JsonEncoder {
}
}

pub fn new_with_s3(
schema: Schema,
col_indices: Option<Vec<usize>>,
_map: HashMap<String, (u8, u8)>,
) -> 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<Vec<usize>>) -> Self {
Self {
schema,
Expand Down Expand Up @@ -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())
}
},
Expand Down Expand Up @@ -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())
}
},
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion src/connector/src/sink/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ pub enum CustomJsonType {
Es,
// starrocks' need jsonb is struct
StarRocks(HashMap<String, (u8, u8)>),
S3,
// bigquery need null array -> []
BigQuery,
None,
Expand Down

0 comments on commit 31a8052

Please sign in to comment.