matriv commented on a change in pull request #17811:
URL: https://github.com/apache/flink/pull/17811#discussion_r756820062



##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecSinkITCase.java
##########
@@ -187,6 +198,148 @@ public void testStreamRecordTimestampInserterNotApplied() 
{
         assertPlan(tableEnv, "INSERT INTO T1 SELECT * FROM T1", false);
     }
 
+    @Test
+    public void testCharPrecisionEnforcer() throws ExecutionException, 
InterruptedException {
+        final StreamTableEnvironment tableEnv = 
StreamTableEnvironment.create(env);
+        final List<Row> rows =
+                Arrays.asList(
+                        Row.of(1, "Apache Flink", "SQL RuleZ", 11, 111, "SQL"),
+                        Row.of(2, "Apache", "SQL", 22, 222, "Flink"),
+                        Row.of(3, "Apache", "Flink SQL", 33, 333, "Apache 
Flink SQL"),
+                        Row.of(4, "Flink Project", "SQL or SeQueL?", 44, 444, 
"Apache Flink SQL"));
+
+        final TableDescriptor sourceDescriptor =
+                TableFactoryHarness.newBuilder()
+                        .schema(schemaForCharPrecisionEnforcer())
+                        .source(new TestSource(rows))
+                        .build();
+        tableEnv.createTable("T1", sourceDescriptor);
+
+        // Default config - ignore (no trim)
+        TableResult result = tableEnv.executeSql("SELECT * FROM T1");
+        result.await();
+
+        final List<String> expected = 
rows.stream().map(Row::toString).collect(Collectors.toList());
+        final List<String> resultsAsString = new ArrayList<>();
+        result.collect().forEachRemaining(r -> 
resultsAsString.add(r.toString()));
+        assertEquals(expected, resultsAsString);

Review comment:
       I used a `containsInAnyOrder` on the Row directly instead of using the 
string representation. I think it's better to wait for `AssertJ` coming soon, 
to use a nice Row comparison method from a utility.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to