srinipunuru commented on a change in pull request #1153: SAMZA-2320: Samza-sql: 
Refactor validation to cover more cases and make it more extensible.
URL: https://github.com/apache/samza/pull/1153#discussion_r324783398
 
 

 ##########
 File path: 
samza-sql/src/test/java/org/apache/samza/sql/planner/TestSamzaSqlValidator.java
 ##########
 @@ -59,6 +59,42 @@ public void testBasicValidation() throws 
SamzaSqlValidatorException {
     new SamzaSqlValidator(samzaConfig).validate(sqlStmts);
   }
 
+  @Test
+  public void testRepeatedTwiceFieldsValidation() throws 
SamzaSqlValidatorException {
+    Map<String, String> config = 
SamzaSqlTestConfig.fetchStaticConfigsWithFactories(1);
+    config.put(SamzaSqlApplicationConfig.CFG_SQL_STMT,
+        "Insert into testavro.outputTopic select id, true as bool_value, false 
as bool_value"
+            + " from testavro.level1.level2.SIMPLE1 as s where s.id = 1");
+    Config samzaConfig = SamzaSqlApplicationRunner.computeSamzaConfigs(true, 
new MapConfig(config));
+
+    List<String> sqlStmts = fetchSqlFromConfig(config);
+    new SamzaSqlValidator(samzaConfig).validate(sqlStmts);
+  }
+
+  @Test (expected = SamzaSqlValidatorException.class)
+  public void testRepeatedThriceFieldsValidation() throws 
SamzaSqlValidatorException {
+    Map<String, String> config = 
SamzaSqlTestConfig.fetchStaticConfigsWithFactories(1);
+    config.put(SamzaSqlApplicationConfig.CFG_SQL_STMT,
+        "Insert into testavro.outputTopic select id, true as bool_value, false 
as bool_value, true as bool_value"
+            + " from testavro.level1.level2.SIMPLE1 as s where s.id = 1");
+    Config samzaConfig = SamzaSqlApplicationRunner.computeSamzaConfigs(true, 
new MapConfig(config));
+
+    List<String> sqlStmts = fetchSqlFromConfig(config);
+    new SamzaSqlValidator(samzaConfig).validate(sqlStmts);
+  }
+
+  @Test (expected = SamzaSqlValidatorException.class)
+  public void testFieldEndingInZeroValidation() throws 
SamzaSqlValidatorException {
 
 Review comment:
   Can you add a test case where there is a legit field named "field0" in the 
schema?

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to