Skip to content

Commit

Permalink
[SPARK-47420][SQL] Fix test output
Browse files Browse the repository at this point in the history
Make "AssertionFailedError: expected: <true> but was: <false>" to be rendered correctly

### What changes were proposed in this pull request?
The assertion was being rendered the other way around

### Why are the changes needed?
To avoid confusion during test checks

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
`testOnly org.apache.spark.unsafe.types.CollationSupportSuite`

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #46058 from vladimirg-db/vladimirg-db/fix-test-output.

Authored-by: Vladimir Golubev <vladimir.golubev@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
  • Loading branch information
vladimirg-db authored and cloud-fan committed Apr 16, 2024
1 parent 348b1bc commit 6762d1f
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public class CollationSupportSuite {
* Collation-aware string expressions.
*/

private void assertContains(String pattern, String target, String collationName, boolean value)
private void assertContains(String pattern, String target, String collationName, boolean expected)
throws SparkException {
UTF8String l = UTF8String.fromString(pattern);
UTF8String r = UTF8String.fromString(target);
int collationId = CollationFactory.collationNameToId(collationName);
assertEquals(CollationSupport.Contains.exec(l, r, collationId), value);
assertEquals(expected, CollationSupport.Contains.exec(l, r, collationId));
}

@Test
Expand Down Expand Up @@ -103,12 +103,13 @@ public void testContains() throws SparkException {
assertContains("äbćδe", "ÄBcΔÉ", "UNICODE_CI", false);
}

private void assertStartsWith(String pattern, String prefix, String collationName, boolean value)
private void assertStartsWith(
String pattern, String prefix, String collationName, boolean expected)
throws SparkException {
UTF8String l = UTF8String.fromString(pattern);
UTF8String r = UTF8String.fromString(prefix);
int collationId = CollationFactory.collationNameToId(collationName);
assertEquals(CollationSupport.StartsWith.exec(l, r, collationId), value);
assertEquals(expected, CollationSupport.StartsWith.exec(l, r, collationId));
}

@Test
Expand Down Expand Up @@ -176,12 +177,12 @@ public void testStartsWith() throws SparkException {
assertStartsWith("äbćδe", "ÄBcΔÉ", "UNICODE_CI", false);
}

private void assertEndsWith(String pattern, String suffix, String collationName, boolean value)
private void assertEndsWith(String pattern, String suffix, String collationName, boolean expected)
throws SparkException {
UTF8String l = UTF8String.fromString(pattern);
UTF8String r = UTF8String.fromString(suffix);
int collationId = CollationFactory.collationNameToId(collationName);
assertEquals(CollationSupport.EndsWith.exec(l, r, collationId), value);
assertEquals(expected, CollationSupport.EndsWith.exec(l, r, collationId));
}

@Test
Expand Down

0 comments on commit 6762d1f

Please sign in to comment.