Skip to content

Commit efec745

Browse files
committed
readyset-data: Switch all test calls from Collation::default() to Utf8
No functional changes. Change-Id: I70996bb28aaa903012a3cabd52ab5037d6202c39 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/9241 Reviewed-by: Michael Zink <[email protected]> Tested-by: Buildkite CI
1 parent 41be52e commit efec745

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

dataflow-expression/src/eval.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ mod tests {
475475
fn eval_json_exists() {
476476
let expr = Op {
477477
left: Box::new(column_with_type(0, DfType::Jsonb)),
478-
right: Box::new(column_with_type(1, DfType::Text(Collation::default()))),
478+
right: Box::new(column_with_type(1, DfType::Text(Collation::Utf8))),
479479
op: BinaryOperator::JsonExists,
480480
ty: DfType::Bool,
481481
};
@@ -505,7 +505,7 @@ mod tests {
505505
fn eval_json_exists_bad_types() {
506506
let expr = Op {
507507
left: Box::new(column_with_type(0, DfType::Jsonb)),
508-
right: Box::new(column_with_type(1, DfType::Text(Collation::default()))),
508+
right: Box::new(column_with_type(1, DfType::Text(Collation::Utf8))),
509509
op: BinaryOperator::JsonExists,
510510
ty: DfType::Bool,
511511
};
@@ -521,7 +521,7 @@ mod tests {
521521
left: Box::new(column_with_type(0, DfType::Jsonb)),
522522
right: Box::new(column_with_type(
523523
1,
524-
DfType::Array(Box::new(DfType::Text(Collation::default()))),
524+
DfType::Array(Box::new(DfType::Text(Collation::Utf8))),
525525
)),
526526
op: BinaryOperator::JsonAnyExists,
527527
ty: DfType::Bool,
@@ -566,7 +566,7 @@ mod tests {
566566
left: Box::new(column_with_type(0, DfType::Jsonb)),
567567
right: Box::new(column_with_type(
568568
1,
569-
DfType::Array(Box::new(DfType::Text(Collation::default()))),
569+
DfType::Array(Box::new(DfType::Text(Collation::Utf8))),
570570
)),
571571
op: BinaryOperator::JsonAnyExists,
572572
ty: DfType::Bool,
@@ -583,7 +583,7 @@ mod tests {
583583
left: Box::new(column_with_type(0, DfType::Jsonb)),
584584
right: Box::new(column_with_type(
585585
1,
586-
DfType::Array(Box::new(DfType::Text(Collation::default()))),
586+
DfType::Array(Box::new(DfType::Text(Collation::Utf8))),
587587
)),
588588
op: BinaryOperator::JsonAllExists,
589589
ty: DfType::Bool,
@@ -684,7 +684,7 @@ mod tests {
684684
left: Box::new(column_with_type(0, DfType::Jsonb)),
685685
right: Box::new(column_with_type(
686686
1,
687-
DfType::Array(Box::new(DfType::Text(Collation::default()))),
687+
DfType::Array(Box::new(DfType::Text(Collation::Utf8))),
688688
)),
689689
op: BinaryOperator::JsonAllExists,
690690
ty: DfType::Bool,

readyset-data/src/float.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,14 +455,14 @@ mod tests {
455455

456456
assert_eq!(
457457
DfValue::Double(1e4)
458-
.coerce_to(&DfType::VarChar(2, Collation::default()), &DfType::Unknown)
458+
.coerce_to(&DfType::VarChar(2, Collation::Utf8), &DfType::Unknown)
459459
.unwrap(),
460460
DfValue::from("10")
461461
);
462462

463463
assert_eq!(
464464
DfValue::Double(1e4)
465-
.coerce_to(&DfType::Char(8, Collation::default()), &DfType::Unknown)
465+
.coerce_to(&DfType::Char(8, Collation::Utf8), &DfType::Unknown)
466466
.unwrap(),
467467
DfValue::from("10000 ")
468468
);

readyset-data/src/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,8 +3861,7 @@ mod tests {
38613861
#[proptest]
38623862
fn char_equal_length(#[strategy("a{1,30}")] text: String) {
38633863
let input = DfValue::from(text.as_str());
3864-
let intermediate =
3865-
DfType::Char(u16::try_from(text.len()).unwrap(), Collation::default());
3864+
let intermediate = DfType::Char(u16::try_from(text.len()).unwrap(), Collation::Utf8);
38663865
let result = input.coerce_to(&intermediate, &DfType::Unknown).unwrap();
38673866
assert_eq!(String::try_from(&result).unwrap().as_str(), text.as_str());
38683867
}
@@ -3902,13 +3901,13 @@ mod tests {
39023901
);
39033902
assert_eq!(
39043903
DfValue::from(20070523i64)
3905-
.coerce_to(&DfType::VarChar(2, Collation::default()), &DfType::Unknown)
3904+
.coerce_to(&DfType::VarChar(2, Collation::Utf8), &DfType::Unknown)
39063905
.unwrap(),
39073906
DfValue::from("20"),
39083907
);
39093908
assert_eq!(
39103909
DfValue::from(20070523i64)
3911-
.coerce_to(&DfType::Char(10, Collation::default()), &DfType::Unknown)
3910+
.coerce_to(&DfType::Char(10, Collation::Utf8), &DfType::Unknown)
39123911
.unwrap(),
39133912
DfValue::from("20070523 "),
39143913
);
@@ -4151,24 +4150,24 @@ mod tests {
41514150
// Test coercion from enum to text types with length limits
41524151

41534152
let result = DfValue::Int(2)
4154-
.coerce_to(&DfType::Char(3, Collation::default()), &enum_ty)
4153+
.coerce_to(&DfType::Char(3, Collation::Utf8), &enum_ty)
41554154
.unwrap();
41564155
assert_eq!("yel", result.to_string());
41574156

41584157
let result = DfValue::Int(2)
4159-
.coerce_to(&DfType::VarChar(3, Collation::default()), &enum_ty)
4158+
.coerce_to(&DfType::VarChar(3, Collation::Utf8), &enum_ty)
41604159
.unwrap();
41614160
assert_eq!("yel", result.to_string());
41624161

41634162
let result = DfValue::Int(2)
4164-
.coerce_to(&DfType::Char(10, Collation::default()), &enum_ty)
4163+
.coerce_to(&DfType::Char(10, Collation::Utf8), &enum_ty)
41654164
.unwrap();
41664165
assert_eq!("yellow ", result.to_string());
41674166

41684167
let no_change_tys = [
4169-
DfType::VarChar(10, Collation::default()),
4168+
DfType::VarChar(10, Collation::Utf8),
41704169
// FIXME(ENG-1839)
4171-
// DfType::Char(None, Collation::default(), Dialect::DEFAULT_MYSQL),
4170+
// DfType::Char(None, Collation::Utf8, Dialect::DEFAULT_MYSQL),
41724171
DfType::DEFAULT_TEXT,
41734172
];
41744173

readyset-data/src/text.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,22 +706,22 @@ mod tests {
706706
// TEXT to TEXT coercions
707707
let text = DfValue::from("abcdefgh");
708708
assert_eq!(
709-
text.coerce_to(&DfType::Char(10, Collation::default()), &DfType::Unknown)
709+
text.coerce_to(&DfType::Char(10, Collation::Utf8), &DfType::Unknown)
710710
.unwrap(),
711711
DfValue::from("abcdefgh ")
712712
);
713713
assert_eq!(
714-
text.coerce_to(&DfType::Char(4, Collation::default()), &DfType::Unknown)
714+
text.coerce_to(&DfType::Char(4, Collation::Utf8), &DfType::Unknown)
715715
.unwrap(),
716716
DfValue::from("abcd")
717717
);
718718
assert_eq!(
719-
text.coerce_to(&DfType::VarChar(10, Collation::default()), &DfType::Unknown)
719+
text.coerce_to(&DfType::VarChar(10, Collation::Utf8), &DfType::Unknown)
720720
.unwrap(),
721721
DfValue::from("abcdefgh")
722722
);
723723
assert_eq!(
724-
text.coerce_to(&DfType::VarChar(4, Collation::default()), &DfType::Unknown)
724+
text.coerce_to(&DfType::VarChar(4, Collation::Utf8), &DfType::Unknown)
725725
.unwrap(),
726726
DfValue::from("abcd")
727727
);

readyset-data/src/timestamp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ mod tests {
710710
assert_eq!(
711711
&format!(
712712
"{}",
713-
ts.coerce_to(&DfType::VarChar(6, Collation::default()), &DfType::Unknown)
713+
ts.coerce_to(&DfType::VarChar(6, Collation::Utf8), &DfType::Unknown)
714714
.unwrap()
715715
),
716716
"2022-0"

0 commit comments

Comments
 (0)