sonam-vend commented on a change in pull request #13817:
URL: https://github.com/apache/beam/pull/13817#discussion_r568559525
##########
File path:
sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSqlDialectSpecTest.java
##########
@@ -4067,4 +4064,113 @@ public void testSimpleTableName() {
Row.withSchema(singleField).addValues(15L).build());
pipeline.run().waitUntilFinish(Duration.standardMinutes(PIPELINE_EXECUTION_WAITTIME_MINUTES));
}
+
+ /** Tests for logical_and operation with different inputs. */
+ @RunWith(Parameterized.class)
+ public static class LogicalAndTests {
+
+ @Parameterized.Parameters
+ public static Collection<Object[]> inputData() {
+ Object[][] data =
+ new Object[][] {{false, false, false}, {true, true, true}, {true,
false, false}};
+ return Arrays.asList(data);
+ }
+
+ @Parameterized.Parameter(0)
+ private boolean firstValue;
+
+ @Parameterized.Parameter(1)
+ private boolean secondValue;
+
+ @Parameterized.Parameter(2)
+ private boolean logicalAndExpectedResult;
+
+ @Test
+ public void testLogicalAndAggregation() {
+ String sql =
+ "SELECT LOGICAL_AND(x) AS logical_and FROM UNNEST(["
+ + firstValue
+ + ","
+ + secondValue
+ + "]) AS x";
+
+ ZetaSQLQueryPlanner zetaSQLQueryPlanner = new
ZetaSQLQueryPlanner(config);
Review comment:
@ibzib since `config` and `pipeline` are non-static variables, we cannot
utilize them in the Parameterized Tests classes. However, if Beam would have
been using JUNIT 5, we could have used [annotation based
implementation](https://www.journaldev.com/21639/junit-parameterized-tests). I
think, we need to keep the duplicate tests for now for different inputs.
----------------------------------------------------------------
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:
[email protected]