You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/04/07 17:25:06 UTC
[GitHub] [beam] ibzib opened a new pull request #14462: [BEAM-10925] Refactor ZetaSqlJavaUdfTypeTest.
ibzib opened a new pull request #14462:
URL: https://github.com/apache/beam/pull/14462
Remove unnecessary throws clause and register all UDFs up front.
R: @apilloud
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
- [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
Post-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
<table>
<thead>
<tr>
<th>Lang</th>
<th>SDK</th>
<th>ULR</th>
<th>Dataflow</th>
<th>Flink</th>
<th>Samza</th>
<th>Spark</th>
<th>Twister2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Go</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
</tr>
<tr>
<td>Java</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_ULR/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_ULR/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Streaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Streaming/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2_Streaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2_Streaming/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon">
</a>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Cron/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Java11_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Java11_Cron/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_Examples_Dataflow_V2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_Examples_Dataflow_V2/lastCompletedBuild/badge/icon">
</a><br>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Twister2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Twister2/lastCompletedBuild/badge/icon">
</a>
</td>
</tr>
<tr>
<td>Python</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python38/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python38/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
</tr>
<tr>
<td>XLang</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Direct/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Direct/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Dataflow/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Dataflow/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
</tr>
</tbody>
</table>
Pre-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
<table>
<thead>
<tr>
<th>---</th>
<th>Java</th>
<th>Python</th>
<th>Go</th>
<th>Website</th>
<th>Whitespace</th>
<th>Typescript</th>
</tr>
</thead>
<tbody>
<tr>
<td>Non-portable</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/badge/icon">
</a><br>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/lastCompletedBuild/">
<img src="https://camo.githubusercontent.com/4565d7b7e907114e6c1d12323408bd903aa252fefed5eeab93701b05c9628a84/68747470733a2f2f63692d6265616d2e6170616368652e6f72672f6a6f622f6265616d5f507265436f6d6d69745f507974686f6e446f636b65725f43726f6e2f62616467652f69636f6e" alt="Build Status" data-canonical-src="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/lastCompletedBuild/">
<img src="https://camo.githubusercontent.com/21afb097a5745440598bee5c59a027b140585eec871c3f3b883200610fabf722/68747470733a2f2f63692d6265616d2e6170616368652e6f72672f6a6f622f6265616d5f507265436f6d6d69745f507974686f6e446f63735f43726f6e2f62616467652f69636f6e" alt="Build Status" data-canonical-src="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Typescript_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Typescript_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
</tr>
<tr>
<td>Portable</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_GoPortable_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_GoPortable_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
</tbody>
</table>
See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ibzib commented on a change in pull request #14462: [BEAM-10925] Refactor ZetaSqlJavaUdfTypeTest.
Posted by GitBox <gi...@apache.org>.
ibzib commented on a change in pull request #14462:
URL: https://github.com/apache/beam/pull/14462#discussion_r609929273
##########
File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSqlJavaUdfTypeTest.java
##########
@@ -181,293 +181,268 @@ private void runUdfTypeTest(String query, Object result, Schema.TypeName typeNam
}
@Test
- public void testTrueLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(true);", true, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testTrueLiteral() {
+ runUdfTypeTest("SELECT test_boolean(true);", true, Schema.TypeName.BOOLEAN);
}
@Test
- public void testTrueInput() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(boolean_true) FROM table;", true, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testTrueInput() {
+ runUdfTypeTest("SELECT test_boolean(boolean_true) FROM table;", true, Schema.TypeName.BOOLEAN);
}
@Test
- public void testFalseLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(false);", false, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testFalseLiteral() {
+ runUdfTypeTest("SELECT test_boolean(false);", false, Schema.TypeName.BOOLEAN);
}
@Test
- public void testFalseInput() throws NoSuchMethodException {
+ public void testFalseInput() {
runUdfTypeTest(
- "SELECT test(boolean_false) FROM table;", false, Schema.TypeName.BOOLEAN, boolUdf);
+ "SELECT test_boolean(boolean_false) FROM table;", false, Schema.TypeName.BOOLEAN);
}
@Test
- public void testZeroInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0);", 0L, Schema.TypeName.INT64, longUdf);
+ public void testZeroInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(0);", 0L, Schema.TypeName.INT64);
}
@Test
- public void testZeroInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_0) FROM table;", 0L, Schema.TypeName.INT64, longUdf);
+ public void testZeroInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_0) FROM table;", 0L, Schema.TypeName.INT64);
}
@Test
- public void testPosInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(123);", 123L, Schema.TypeName.INT64, longUdf);
+ public void testPosInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(123);", 123L, Schema.TypeName.INT64);
}
@Test
- public void testPosInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_pos) FROM table;", 123L, Schema.TypeName.INT64, longUdf);
+ public void testPosInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_pos) FROM table;", 123L, Schema.TypeName.INT64);
}
@Test
- public void testNegInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(-123);", -123L, Schema.TypeName.INT64, longUdf);
+ public void testNegInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(-123);", -123L, Schema.TypeName.INT64);
}
@Test
- public void testNegInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_neg) FROM table;", -123L, Schema.TypeName.INT64, longUdf);
+ public void testNegInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_neg) FROM table;", -123L, Schema.TypeName.INT64);
}
@Test
- public void testMaxInt64Literal() throws NoSuchMethodException {
+ public void testMaxInt64Literal() {
runUdfTypeTest(
- "SELECT test(9223372036854775807);", 9223372036854775807L, Schema.TypeName.INT64, longUdf);
+ "SELECT test_int64(9223372036854775807);", 9223372036854775807L, Schema.TypeName.INT64);
}
@Test
- public void testMaxInt64Input() throws NoSuchMethodException {
+ public void testMaxInt64Input() {
runUdfTypeTest(
- "SELECT test(int64_max) FROM table;", 9223372036854775807L, Schema.TypeName.INT64, longUdf);
+ "SELECT test_int64(int64_max) FROM table;", 9223372036854775807L, Schema.TypeName.INT64);
}
@Test
- public void testMinInt64Literal() throws NoSuchMethodException {
+ public void testMinInt64Literal() {
runUdfTypeTest(
- "SELECT test(-9223372036854775808);",
- -9223372036854775808L,
- Schema.TypeName.INT64,
- longUdf);
+ "SELECT test_int64(-9223372036854775808);", -9223372036854775808L, Schema.TypeName.INT64);
}
@Test
- public void testMinInt64Input() throws NoSuchMethodException {
+ public void testMinInt64Input() {
runUdfTypeTest(
- "SELECT test(int64_min) FROM table;",
- -9223372036854775808L,
- Schema.TypeName.INT64,
- longUdf);
+ "SELECT test_int64(int64_min) FROM table;", -9223372036854775808L, Schema.TypeName.INT64);
}
@Test
- public void testEmptyStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('');", "", Schema.TypeName.STRING, stringUdf);
+ public void testEmptyStringLiteral() {
+ runUdfTypeTest("SELECT test_string('');", "", Schema.TypeName.STRING);
}
@Test
- public void testEmptyStringInput() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(string_empty) FROM table;", "", Schema.TypeName.STRING, stringUdf);
+ public void testEmptyStringInput() {
+ runUdfTypeTest("SELECT test_string(string_empty) FROM table;", "", Schema.TypeName.STRING);
}
@Test
- public void testAsciiStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('abc');", "abc", Schema.TypeName.STRING, stringUdf);
+ public void testAsciiStringLiteral() {
+ runUdfTypeTest("SELECT test_string('abc');", "abc", Schema.TypeName.STRING);
}
@Test
- public void testAsciiStringInput() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(string_ascii) FROM table;", "abc", Schema.TypeName.STRING, stringUdf);
+ public void testAsciiStringInput() {
+ runUdfTypeTest("SELECT test_string(string_ascii) FROM table;", "abc", Schema.TypeName.STRING);
}
@Test
- public void testUnicodeStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('スタリング');", "スタリング", Schema.TypeName.STRING, stringUdf);
+ public void testUnicodeStringLiteral() {
+ runUdfTypeTest("SELECT test_string('スタリング');", "スタリング", Schema.TypeName.STRING);
}
@Test
- public void testUnicodeStringInput() throws NoSuchMethodException {
+ public void testUnicodeStringInput() {
runUdfTypeTest(
- "SELECT test(string_unicode) FROM table;", "スタリング", Schema.TypeName.STRING, stringUdf);
+ "SELECT test_string(string_unicode) FROM table;", "スタリング", Schema.TypeName.STRING);
}
@Test
- public void testEmptyBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(b'');", new byte[] {}, Schema.TypeName.BYTES, bytesUdf);
+ public void testEmptyBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'');", new byte[] {}, Schema.TypeName.BYTES);
}
@Test
- public void testEmptyBytesInput() throws NoSuchMethodException {
+ public void testEmptyBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_empty) FROM table;", new byte[] {}, Schema.TypeName.BYTES, bytesUdf);
+ "SELECT test_bytes(bytes_empty) FROM table;", new byte[] {}, Schema.TypeName.BYTES);
}
@Test
- public void testAsciiBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(b'abc');", new byte[] {'a', 'b', 'c'}, Schema.TypeName.BYTES, bytesUdf);
+ public void testAsciiBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'abc');", new byte[] {'a', 'b', 'c'}, Schema.TypeName.BYTES);
}
@Test
- public void testAsciiBytesInput() throws NoSuchMethodException {
+ public void testAsciiBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_ascii) FROM table;",
+ "SELECT test_bytes(bytes_ascii) FROM table;",
new byte[] {'a', 'b', 'c'},
- Schema.TypeName.BYTES,
- bytesUdf);
+ Schema.TypeName.BYTES);
}
@Test
- public void testUnicodeBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(b'ス');", new byte[] {-29, -126, -71}, Schema.TypeName.BYTES, bytesUdf);
+ public void testUnicodeBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'ス');", new byte[] {-29, -126, -71}, Schema.TypeName.BYTES);
}
@Test
- public void testUnicodeBytesInput() throws NoSuchMethodException {
+ public void testUnicodeBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_unicode) FROM table;",
+ "SELECT test_bytes(bytes_unicode) FROM table;",
new byte[] {-29, -126, -71},
- Schema.TypeName.BYTES,
- bytesUdf);
+ Schema.TypeName.BYTES);
}
@Test
- public void testZeroFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0.0);", 0.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testZeroFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(0.0);", 0.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testZeroFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(float64_0) FROM table;", 0.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testZeroFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_0) FROM table;", 0.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNonIntegerFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0.123);", 0.123, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNonIntegerFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(0.123);", 0.123, Schema.TypeName.DOUBLE);
}
@Test
- public void testNonIntegerFloat64Input() throws NoSuchMethodException {
+ public void testNonIntegerFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_noninteger) FROM table;", 0.123, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(float64_noninteger) FROM table;", 0.123, Schema.TypeName.DOUBLE);
}
@Test
- public void testPosFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(123.0);", 123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testPosFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(123.0);", 123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testPosFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(float64_pos) FROM table;", 123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testPosFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_pos) FROM table;", 123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNegFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(-123.0);", -123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNegFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(-123.0);", -123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNegFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(float64_neg) FROM table;", -123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNegFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_neg) FROM table;", -123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testMaxFloat64Literal() throws NoSuchMethodException {
+ public void testMaxFloat64Literal() {
runUdfTypeTest(
- "SELECT test(1.7976931348623157e+308);",
+ "SELECT test_float64(1.7976931348623157e+308);",
1.7976931348623157e+308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMaxFloat64Input() throws NoSuchMethodException {
+ public void testMaxFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_max) FROM table;",
+ "SELECT test_float64(float64_max) FROM table;",
1.7976931348623157e+308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMinPosFloat64Literal() throws NoSuchMethodException {
+ public void testMinPosFloat64Literal() {
runUdfTypeTest(
- "SELECT test(2.2250738585072014e-308);",
+ "SELECT test_float64(2.2250738585072014e-308);",
2.2250738585072014e-308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMinPosFloat64Input() throws NoSuchMethodException {
+ public void testMinPosFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_min_pos) FROM table;",
+ "SELECT test_float64(float64_min_pos) FROM table;",
2.2250738585072014e-308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"+inf is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testPosInfFloat64Literal() throws NoSuchMethodException {
+ public void testPosInfFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('+inf' AS FLOAT64));",
+ "SELECT test_float64(CAST('+inf' AS FLOAT64));",
Double.POSITIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testPosInfFloat64Input() throws NoSuchMethodException {
+ public void testPosInfFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_inf) FROM table;",
+ "SELECT test_float64(float64_inf) FROM table;",
Double.POSITIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"-inf is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testNegInfFloat64Literal() throws NoSuchMethodException {
+ public void testNegInfFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('-inf' AS FLOAT64));",
+ "SELECT test_float64(CAST('-inf' AS FLOAT64));",
Double.NEGATIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testNegInfFloat64Input() throws NoSuchMethodException {
+ public void testNegInfFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_neg_inf) FROM table;",
+ "SELECT test_float64(float64_neg_inf) FROM table;",
Double.NEGATIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"NaN is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testNaNFloat64Literal() throws NoSuchMethodException {
+ public void testNaNFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('NaN' AS FLOAT64));", Double.NaN, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(CAST('NaN' AS FLOAT64));", Double.NaN, Schema.TypeName.DOUBLE);
}
@Test
- public void testNaNFloat64Input() throws NoSuchMethodException {
+ public void testNaNFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_nan) FROM table;", Double.NaN, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(float64_nan) FROM table;", Double.NaN, Schema.TypeName.DOUBLE);
}
-
- // TODO(ibzib) Test that dates and times are rejected.
Review comment:
These TODOs were just for my short-term personal use, long-term they're better off tracked as JIRAs: BEAM-12106, BEAM-12108, BEAM-12086, BEAM-12087, BEAM-11990.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ibzib commented on a change in pull request #14462: [BEAM-10925] Refactor ZetaSqlJavaUdfTypeTest.
Posted by GitBox <gi...@apache.org>.
ibzib commented on a change in pull request #14462:
URL: https://github.com/apache/beam/pull/14462#discussion_r609937678
##########
File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSqlJavaUdfTypeTest.java
##########
@@ -181,293 +181,268 @@ private void runUdfTypeTest(String query, Object result, Schema.TypeName typeNam
}
@Test
- public void testTrueLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(true);", true, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testTrueLiteral() {
+ runUdfTypeTest("SELECT test_boolean(true);", true, Schema.TypeName.BOOLEAN);
}
@Test
- public void testTrueInput() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(boolean_true) FROM table;", true, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testTrueInput() {
+ runUdfTypeTest("SELECT test_boolean(boolean_true) FROM table;", true, Schema.TypeName.BOOLEAN);
}
@Test
- public void testFalseLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(false);", false, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testFalseLiteral() {
+ runUdfTypeTest("SELECT test_boolean(false);", false, Schema.TypeName.BOOLEAN);
}
@Test
- public void testFalseInput() throws NoSuchMethodException {
+ public void testFalseInput() {
runUdfTypeTest(
- "SELECT test(boolean_false) FROM table;", false, Schema.TypeName.BOOLEAN, boolUdf);
+ "SELECT test_boolean(boolean_false) FROM table;", false, Schema.TypeName.BOOLEAN);
}
@Test
- public void testZeroInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0);", 0L, Schema.TypeName.INT64, longUdf);
+ public void testZeroInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(0);", 0L, Schema.TypeName.INT64);
}
@Test
- public void testZeroInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_0) FROM table;", 0L, Schema.TypeName.INT64, longUdf);
+ public void testZeroInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_0) FROM table;", 0L, Schema.TypeName.INT64);
}
@Test
- public void testPosInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(123);", 123L, Schema.TypeName.INT64, longUdf);
+ public void testPosInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(123);", 123L, Schema.TypeName.INT64);
}
@Test
- public void testPosInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_pos) FROM table;", 123L, Schema.TypeName.INT64, longUdf);
+ public void testPosInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_pos) FROM table;", 123L, Schema.TypeName.INT64);
}
@Test
- public void testNegInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(-123);", -123L, Schema.TypeName.INT64, longUdf);
+ public void testNegInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(-123);", -123L, Schema.TypeName.INT64);
}
@Test
- public void testNegInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_neg) FROM table;", -123L, Schema.TypeName.INT64, longUdf);
+ public void testNegInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_neg) FROM table;", -123L, Schema.TypeName.INT64);
}
@Test
- public void testMaxInt64Literal() throws NoSuchMethodException {
+ public void testMaxInt64Literal() {
runUdfTypeTest(
- "SELECT test(9223372036854775807);", 9223372036854775807L, Schema.TypeName.INT64, longUdf);
+ "SELECT test_int64(9223372036854775807);", 9223372036854775807L, Schema.TypeName.INT64);
}
@Test
- public void testMaxInt64Input() throws NoSuchMethodException {
+ public void testMaxInt64Input() {
runUdfTypeTest(
- "SELECT test(int64_max) FROM table;", 9223372036854775807L, Schema.TypeName.INT64, longUdf);
+ "SELECT test_int64(int64_max) FROM table;", 9223372036854775807L, Schema.TypeName.INT64);
}
@Test
- public void testMinInt64Literal() throws NoSuchMethodException {
+ public void testMinInt64Literal() {
runUdfTypeTest(
- "SELECT test(-9223372036854775808);",
- -9223372036854775808L,
- Schema.TypeName.INT64,
- longUdf);
+ "SELECT test_int64(-9223372036854775808);", -9223372036854775808L, Schema.TypeName.INT64);
}
@Test
- public void testMinInt64Input() throws NoSuchMethodException {
+ public void testMinInt64Input() {
runUdfTypeTest(
- "SELECT test(int64_min) FROM table;",
- -9223372036854775808L,
- Schema.TypeName.INT64,
- longUdf);
+ "SELECT test_int64(int64_min) FROM table;", -9223372036854775808L, Schema.TypeName.INT64);
}
@Test
- public void testEmptyStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('');", "", Schema.TypeName.STRING, stringUdf);
+ public void testEmptyStringLiteral() {
+ runUdfTypeTest("SELECT test_string('');", "", Schema.TypeName.STRING);
}
@Test
- public void testEmptyStringInput() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(string_empty) FROM table;", "", Schema.TypeName.STRING, stringUdf);
+ public void testEmptyStringInput() {
+ runUdfTypeTest("SELECT test_string(string_empty) FROM table;", "", Schema.TypeName.STRING);
}
@Test
- public void testAsciiStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('abc');", "abc", Schema.TypeName.STRING, stringUdf);
+ public void testAsciiStringLiteral() {
+ runUdfTypeTest("SELECT test_string('abc');", "abc", Schema.TypeName.STRING);
}
@Test
- public void testAsciiStringInput() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(string_ascii) FROM table;", "abc", Schema.TypeName.STRING, stringUdf);
+ public void testAsciiStringInput() {
+ runUdfTypeTest("SELECT test_string(string_ascii) FROM table;", "abc", Schema.TypeName.STRING);
}
@Test
- public void testUnicodeStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('スタリング');", "スタリング", Schema.TypeName.STRING, stringUdf);
+ public void testUnicodeStringLiteral() {
+ runUdfTypeTest("SELECT test_string('スタリング');", "スタリング", Schema.TypeName.STRING);
}
@Test
- public void testUnicodeStringInput() throws NoSuchMethodException {
+ public void testUnicodeStringInput() {
runUdfTypeTest(
- "SELECT test(string_unicode) FROM table;", "スタリング", Schema.TypeName.STRING, stringUdf);
+ "SELECT test_string(string_unicode) FROM table;", "スタリング", Schema.TypeName.STRING);
}
@Test
- public void testEmptyBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(b'');", new byte[] {}, Schema.TypeName.BYTES, bytesUdf);
+ public void testEmptyBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'');", new byte[] {}, Schema.TypeName.BYTES);
}
@Test
- public void testEmptyBytesInput() throws NoSuchMethodException {
+ public void testEmptyBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_empty) FROM table;", new byte[] {}, Schema.TypeName.BYTES, bytesUdf);
+ "SELECT test_bytes(bytes_empty) FROM table;", new byte[] {}, Schema.TypeName.BYTES);
}
@Test
- public void testAsciiBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(b'abc');", new byte[] {'a', 'b', 'c'}, Schema.TypeName.BYTES, bytesUdf);
+ public void testAsciiBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'abc');", new byte[] {'a', 'b', 'c'}, Schema.TypeName.BYTES);
}
@Test
- public void testAsciiBytesInput() throws NoSuchMethodException {
+ public void testAsciiBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_ascii) FROM table;",
+ "SELECT test_bytes(bytes_ascii) FROM table;",
new byte[] {'a', 'b', 'c'},
- Schema.TypeName.BYTES,
- bytesUdf);
+ Schema.TypeName.BYTES);
}
@Test
- public void testUnicodeBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(b'ス');", new byte[] {-29, -126, -71}, Schema.TypeName.BYTES, bytesUdf);
+ public void testUnicodeBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'ス');", new byte[] {-29, -126, -71}, Schema.TypeName.BYTES);
}
@Test
- public void testUnicodeBytesInput() throws NoSuchMethodException {
+ public void testUnicodeBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_unicode) FROM table;",
+ "SELECT test_bytes(bytes_unicode) FROM table;",
new byte[] {-29, -126, -71},
- Schema.TypeName.BYTES,
- bytesUdf);
+ Schema.TypeName.BYTES);
}
@Test
- public void testZeroFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0.0);", 0.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testZeroFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(0.0);", 0.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testZeroFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(float64_0) FROM table;", 0.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testZeroFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_0) FROM table;", 0.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNonIntegerFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0.123);", 0.123, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNonIntegerFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(0.123);", 0.123, Schema.TypeName.DOUBLE);
}
@Test
- public void testNonIntegerFloat64Input() throws NoSuchMethodException {
+ public void testNonIntegerFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_noninteger) FROM table;", 0.123, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(float64_noninteger) FROM table;", 0.123, Schema.TypeName.DOUBLE);
}
@Test
- public void testPosFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(123.0);", 123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testPosFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(123.0);", 123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testPosFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(float64_pos) FROM table;", 123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testPosFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_pos) FROM table;", 123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNegFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(-123.0);", -123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNegFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(-123.0);", -123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNegFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(float64_neg) FROM table;", -123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNegFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_neg) FROM table;", -123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testMaxFloat64Literal() throws NoSuchMethodException {
+ public void testMaxFloat64Literal() {
runUdfTypeTest(
- "SELECT test(1.7976931348623157e+308);",
+ "SELECT test_float64(1.7976931348623157e+308);",
1.7976931348623157e+308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMaxFloat64Input() throws NoSuchMethodException {
+ public void testMaxFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_max) FROM table;",
+ "SELECT test_float64(float64_max) FROM table;",
1.7976931348623157e+308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMinPosFloat64Literal() throws NoSuchMethodException {
+ public void testMinPosFloat64Literal() {
runUdfTypeTest(
- "SELECT test(2.2250738585072014e-308);",
+ "SELECT test_float64(2.2250738585072014e-308);",
2.2250738585072014e-308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMinPosFloat64Input() throws NoSuchMethodException {
+ public void testMinPosFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_min_pos) FROM table;",
+ "SELECT test_float64(float64_min_pos) FROM table;",
2.2250738585072014e-308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"+inf is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testPosInfFloat64Literal() throws NoSuchMethodException {
+ public void testPosInfFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('+inf' AS FLOAT64));",
+ "SELECT test_float64(CAST('+inf' AS FLOAT64));",
Double.POSITIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testPosInfFloat64Input() throws NoSuchMethodException {
+ public void testPosInfFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_inf) FROM table;",
+ "SELECT test_float64(float64_inf) FROM table;",
Double.POSITIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"-inf is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testNegInfFloat64Literal() throws NoSuchMethodException {
+ public void testNegInfFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('-inf' AS FLOAT64));",
+ "SELECT test_float64(CAST('-inf' AS FLOAT64));",
Double.NEGATIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testNegInfFloat64Input() throws NoSuchMethodException {
+ public void testNegInfFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_neg_inf) FROM table;",
+ "SELECT test_float64(float64_neg_inf) FROM table;",
Double.NEGATIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"NaN is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testNaNFloat64Literal() throws NoSuchMethodException {
+ public void testNaNFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('NaN' AS FLOAT64));", Double.NaN, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(CAST('NaN' AS FLOAT64));", Double.NaN, Schema.TypeName.DOUBLE);
}
@Test
- public void testNaNFloat64Input() throws NoSuchMethodException {
+ public void testNaNFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_nan) FROM table;", Double.NaN, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(float64_nan) FROM table;", Double.NaN, Schema.TypeName.DOUBLE);
}
-
- // TODO(ibzib) Test that dates and times are rejected.
Review comment:
I also created a JIRA label `zetasql-java-udf` since I was starting to have trouble finding these.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ibzib merged pull request #14462: [BEAM-10925] Refactor ZetaSqlJavaUdfTypeTest.
Posted by GitBox <gi...@apache.org>.
ibzib merged pull request #14462:
URL: https://github.com/apache/beam/pull/14462
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] apilloud commented on a change in pull request #14462: [BEAM-10925] Refactor ZetaSqlJavaUdfTypeTest.
Posted by GitBox <gi...@apache.org>.
apilloud commented on a change in pull request #14462:
URL: https://github.com/apache/beam/pull/14462#discussion_r609158924
##########
File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSqlJavaUdfTypeTest.java
##########
@@ -181,293 +181,268 @@ private void runUdfTypeTest(String query, Object result, Schema.TypeName typeNam
}
@Test
- public void testTrueLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(true);", true, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testTrueLiteral() {
+ runUdfTypeTest("SELECT test_boolean(true);", true, Schema.TypeName.BOOLEAN);
}
@Test
- public void testTrueInput() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(boolean_true) FROM table;", true, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testTrueInput() {
+ runUdfTypeTest("SELECT test_boolean(boolean_true) FROM table;", true, Schema.TypeName.BOOLEAN);
}
@Test
- public void testFalseLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(false);", false, Schema.TypeName.BOOLEAN, boolUdf);
+ public void testFalseLiteral() {
+ runUdfTypeTest("SELECT test_boolean(false);", false, Schema.TypeName.BOOLEAN);
}
@Test
- public void testFalseInput() throws NoSuchMethodException {
+ public void testFalseInput() {
runUdfTypeTest(
- "SELECT test(boolean_false) FROM table;", false, Schema.TypeName.BOOLEAN, boolUdf);
+ "SELECT test_boolean(boolean_false) FROM table;", false, Schema.TypeName.BOOLEAN);
}
@Test
- public void testZeroInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0);", 0L, Schema.TypeName.INT64, longUdf);
+ public void testZeroInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(0);", 0L, Schema.TypeName.INT64);
}
@Test
- public void testZeroInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_0) FROM table;", 0L, Schema.TypeName.INT64, longUdf);
+ public void testZeroInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_0) FROM table;", 0L, Schema.TypeName.INT64);
}
@Test
- public void testPosInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(123);", 123L, Schema.TypeName.INT64, longUdf);
+ public void testPosInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(123);", 123L, Schema.TypeName.INT64);
}
@Test
- public void testPosInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_pos) FROM table;", 123L, Schema.TypeName.INT64, longUdf);
+ public void testPosInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_pos) FROM table;", 123L, Schema.TypeName.INT64);
}
@Test
- public void testNegInt64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(-123);", -123L, Schema.TypeName.INT64, longUdf);
+ public void testNegInt64Literal() {
+ runUdfTypeTest("SELECT test_int64(-123);", -123L, Schema.TypeName.INT64);
}
@Test
- public void testNegInt64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(int64_neg) FROM table;", -123L, Schema.TypeName.INT64, longUdf);
+ public void testNegInt64Input() {
+ runUdfTypeTest("SELECT test_int64(int64_neg) FROM table;", -123L, Schema.TypeName.INT64);
}
@Test
- public void testMaxInt64Literal() throws NoSuchMethodException {
+ public void testMaxInt64Literal() {
runUdfTypeTest(
- "SELECT test(9223372036854775807);", 9223372036854775807L, Schema.TypeName.INT64, longUdf);
+ "SELECT test_int64(9223372036854775807);", 9223372036854775807L, Schema.TypeName.INT64);
}
@Test
- public void testMaxInt64Input() throws NoSuchMethodException {
+ public void testMaxInt64Input() {
runUdfTypeTest(
- "SELECT test(int64_max) FROM table;", 9223372036854775807L, Schema.TypeName.INT64, longUdf);
+ "SELECT test_int64(int64_max) FROM table;", 9223372036854775807L, Schema.TypeName.INT64);
}
@Test
- public void testMinInt64Literal() throws NoSuchMethodException {
+ public void testMinInt64Literal() {
runUdfTypeTest(
- "SELECT test(-9223372036854775808);",
- -9223372036854775808L,
- Schema.TypeName.INT64,
- longUdf);
+ "SELECT test_int64(-9223372036854775808);", -9223372036854775808L, Schema.TypeName.INT64);
}
@Test
- public void testMinInt64Input() throws NoSuchMethodException {
+ public void testMinInt64Input() {
runUdfTypeTest(
- "SELECT test(int64_min) FROM table;",
- -9223372036854775808L,
- Schema.TypeName.INT64,
- longUdf);
+ "SELECT test_int64(int64_min) FROM table;", -9223372036854775808L, Schema.TypeName.INT64);
}
@Test
- public void testEmptyStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('');", "", Schema.TypeName.STRING, stringUdf);
+ public void testEmptyStringLiteral() {
+ runUdfTypeTest("SELECT test_string('');", "", Schema.TypeName.STRING);
}
@Test
- public void testEmptyStringInput() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(string_empty) FROM table;", "", Schema.TypeName.STRING, stringUdf);
+ public void testEmptyStringInput() {
+ runUdfTypeTest("SELECT test_string(string_empty) FROM table;", "", Schema.TypeName.STRING);
}
@Test
- public void testAsciiStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('abc');", "abc", Schema.TypeName.STRING, stringUdf);
+ public void testAsciiStringLiteral() {
+ runUdfTypeTest("SELECT test_string('abc');", "abc", Schema.TypeName.STRING);
}
@Test
- public void testAsciiStringInput() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(string_ascii) FROM table;", "abc", Schema.TypeName.STRING, stringUdf);
+ public void testAsciiStringInput() {
+ runUdfTypeTest("SELECT test_string(string_ascii) FROM table;", "abc", Schema.TypeName.STRING);
}
@Test
- public void testUnicodeStringLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test('スタリング');", "スタリング", Schema.TypeName.STRING, stringUdf);
+ public void testUnicodeStringLiteral() {
+ runUdfTypeTest("SELECT test_string('スタリング');", "スタリング", Schema.TypeName.STRING);
}
@Test
- public void testUnicodeStringInput() throws NoSuchMethodException {
+ public void testUnicodeStringInput() {
runUdfTypeTest(
- "SELECT test(string_unicode) FROM table;", "スタリング", Schema.TypeName.STRING, stringUdf);
+ "SELECT test_string(string_unicode) FROM table;", "スタリング", Schema.TypeName.STRING);
}
@Test
- public void testEmptyBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(b'');", new byte[] {}, Schema.TypeName.BYTES, bytesUdf);
+ public void testEmptyBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'');", new byte[] {}, Schema.TypeName.BYTES);
}
@Test
- public void testEmptyBytesInput() throws NoSuchMethodException {
+ public void testEmptyBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_empty) FROM table;", new byte[] {}, Schema.TypeName.BYTES, bytesUdf);
+ "SELECT test_bytes(bytes_empty) FROM table;", new byte[] {}, Schema.TypeName.BYTES);
}
@Test
- public void testAsciiBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(b'abc');", new byte[] {'a', 'b', 'c'}, Schema.TypeName.BYTES, bytesUdf);
+ public void testAsciiBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'abc');", new byte[] {'a', 'b', 'c'}, Schema.TypeName.BYTES);
}
@Test
- public void testAsciiBytesInput() throws NoSuchMethodException {
+ public void testAsciiBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_ascii) FROM table;",
+ "SELECT test_bytes(bytes_ascii) FROM table;",
new byte[] {'a', 'b', 'c'},
- Schema.TypeName.BYTES,
- bytesUdf);
+ Schema.TypeName.BYTES);
}
@Test
- public void testUnicodeBytesLiteral() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(b'ス');", new byte[] {-29, -126, -71}, Schema.TypeName.BYTES, bytesUdf);
+ public void testUnicodeBytesLiteral() {
+ runUdfTypeTest("SELECT test_bytes(b'ス');", new byte[] {-29, -126, -71}, Schema.TypeName.BYTES);
}
@Test
- public void testUnicodeBytesInput() throws NoSuchMethodException {
+ public void testUnicodeBytesInput() {
runUdfTypeTest(
- "SELECT test(bytes_unicode) FROM table;",
+ "SELECT test_bytes(bytes_unicode) FROM table;",
new byte[] {-29, -126, -71},
- Schema.TypeName.BYTES,
- bytesUdf);
+ Schema.TypeName.BYTES);
}
@Test
- public void testZeroFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0.0);", 0.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testZeroFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(0.0);", 0.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testZeroFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(float64_0) FROM table;", 0.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testZeroFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_0) FROM table;", 0.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNonIntegerFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(0.123);", 0.123, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNonIntegerFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(0.123);", 0.123, Schema.TypeName.DOUBLE);
}
@Test
- public void testNonIntegerFloat64Input() throws NoSuchMethodException {
+ public void testNonIntegerFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_noninteger) FROM table;", 0.123, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(float64_noninteger) FROM table;", 0.123, Schema.TypeName.DOUBLE);
}
@Test
- public void testPosFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(123.0);", 123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testPosFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(123.0);", 123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testPosFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(float64_pos) FROM table;", 123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testPosFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_pos) FROM table;", 123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNegFloat64Literal() throws NoSuchMethodException {
- runUdfTypeTest("SELECT test(-123.0);", -123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNegFloat64Literal() {
+ runUdfTypeTest("SELECT test_float64(-123.0);", -123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testNegFloat64Input() throws NoSuchMethodException {
- runUdfTypeTest(
- "SELECT test(float64_neg) FROM table;", -123.0, Schema.TypeName.DOUBLE, doubleUdf);
+ public void testNegFloat64Input() {
+ runUdfTypeTest("SELECT test_float64(float64_neg) FROM table;", -123.0, Schema.TypeName.DOUBLE);
}
@Test
- public void testMaxFloat64Literal() throws NoSuchMethodException {
+ public void testMaxFloat64Literal() {
runUdfTypeTest(
- "SELECT test(1.7976931348623157e+308);",
+ "SELECT test_float64(1.7976931348623157e+308);",
1.7976931348623157e+308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMaxFloat64Input() throws NoSuchMethodException {
+ public void testMaxFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_max) FROM table;",
+ "SELECT test_float64(float64_max) FROM table;",
1.7976931348623157e+308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMinPosFloat64Literal() throws NoSuchMethodException {
+ public void testMinPosFloat64Literal() {
runUdfTypeTest(
- "SELECT test(2.2250738585072014e-308);",
+ "SELECT test_float64(2.2250738585072014e-308);",
2.2250738585072014e-308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testMinPosFloat64Input() throws NoSuchMethodException {
+ public void testMinPosFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_min_pos) FROM table;",
+ "SELECT test_float64(float64_min_pos) FROM table;",
2.2250738585072014e-308,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"+inf is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testPosInfFloat64Literal() throws NoSuchMethodException {
+ public void testPosInfFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('+inf' AS FLOAT64));",
+ "SELECT test_float64(CAST('+inf' AS FLOAT64));",
Double.POSITIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testPosInfFloat64Input() throws NoSuchMethodException {
+ public void testPosInfFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_inf) FROM table;",
+ "SELECT test_float64(float64_inf) FROM table;",
Double.POSITIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"-inf is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testNegInfFloat64Literal() throws NoSuchMethodException {
+ public void testNegInfFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('-inf' AS FLOAT64));",
+ "SELECT test_float64(CAST('-inf' AS FLOAT64));",
Double.NEGATIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
- public void testNegInfFloat64Input() throws NoSuchMethodException {
+ public void testNegInfFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_neg_inf) FROM table;",
+ "SELECT test_float64(float64_neg_inf) FROM table;",
Double.NEGATIVE_INFINITY,
- Schema.TypeName.DOUBLE,
- doubleUdf);
+ Schema.TypeName.DOUBLE);
}
@Test
@Ignore(
"NaN is implemented as a ZetaSQL builtin function, so combining it with a UDF requires Calc splitting (BEAM-12009).")
- public void testNaNFloat64Literal() throws NoSuchMethodException {
+ public void testNaNFloat64Literal() {
runUdfTypeTest(
- "SELECT test(CAST('NaN' AS FLOAT64));", Double.NaN, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(CAST('NaN' AS FLOAT64));", Double.NaN, Schema.TypeName.DOUBLE);
}
@Test
- public void testNaNFloat64Input() throws NoSuchMethodException {
+ public void testNaNFloat64Input() {
runUdfTypeTest(
- "SELECT test(float64_nan) FROM table;", Double.NaN, Schema.TypeName.DOUBLE, doubleUdf);
+ "SELECT test_float64(float64_nan) FROM table;", Double.NaN, Schema.TypeName.DOUBLE);
}
-
- // TODO(ibzib) Test that dates and times are rejected.
Review comment:
I'm fine with deleting these (I'm not a big fan of TODOs) but wanted to confirm these issues still remain?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org