Skip to content

Commit dd3c71e

Browse files
zustonCopilot
andauthored
Update crates/fluss/src/row/encode/iceberg_key_encoder.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 7417c92 commit dd3c71e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

crates/fluss/src/row/encode/iceberg_key_encoder.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,25 @@ mod tests {
309309
assert_eq!(encoded.as_ref(), bytes);
310310
}
311311

312+
#[test]
313+
fn test_char_encoding() {
314+
let row_type = RowType::with_data_types_and_field_names(
315+
vec![DataTypes::char_type(5)],
316+
vec!["char_field"],
317+
);
318+
319+
let value = "hello";
320+
let row = GenericRow::from_data(vec![Datum::from(value)]);
321+
let mut encoder = IcebergKeyEncoder::create_key_encoder(
322+
&row_type,
323+
&["char_field".to_string()],
324+
)
325+
.unwrap();
326+
327+
let encoded = encoder.encode_key(&row).unwrap();
328+
assert_eq!(encoded.as_ref(), value.as_bytes());
329+
}
330+
312331
#[test]
313332
fn test_float_encoding() {
314333
let row_type =

0 commit comments

Comments
 (0)