Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spark - Implement FunctionCatalog and Truncate #5305

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove test for assertion error on bad truncation width now that we d…
…on't verify for perf reasons
  • Loading branch information
kbendick committed Jul 28, 2022
commit b77a5b337c24a9a52c8a4a9d68284d69b9e027d2
Original file line number Diff line number Diff line change
Expand Up @@ -161,37 +161,6 @@ public void testTruncateIntegerLiteralSQL() {
null, scalarSql("SELECT %s.truncate(2, CAST(null AS int))", systemNamespace));
}

@Test
public void testTruncationWidthFailsWhenNonnegative() {
AssertHelpers.assertThrows(
"Non-positive truncation width for integers should throw an exception at runtime",
IllegalArgumentException.class,
"Invalid truncate width",
() -> scalarSql("SELECT %s.truncate(0, 10)", systemNamespace)
);

AssertHelpers.assertThrows(
"Non-positive truncation width for longs should throw an exception at runtime",
IllegalArgumentException.class,
"Invalid truncate width",
() -> scalarSql("SELECT %s.truncate(-1, 10L)", systemNamespace)
);

AssertHelpers.assertThrows(
"Non-positive truncation width for decimals should throw an exception at runtime",
IllegalArgumentException.class,
"Invalid truncate width",
() -> scalarSql("SELECT %s.truncate(0, CAST(12.34 AS decimal(9, 2)))", systemNamespace)
);

AssertHelpers.assertThrows(
"Non-positive truncation width for binary types should throw an exception at runtime",
IllegalArgumentException.class,
"Invalid truncate width",
() -> scalarSql("SELECT %s.truncate(-1, X'01020304')", systemNamespace)
);
}

@Test
public void testTruncateBigInt() {
Assert.assertEquals(0L, scalarSql("SELECT %s.truncate(10, 0L)", systemNamespace));
Expand Down