Github user snuyanzin commented on a diff in the pull request:
https://github.com/apache/flink/pull/6233#discussion_r199364581
--- Diff: flink-libraries/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliUtilsTest.java
---
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.client.cli;
+
+import org.apache.flink.api.java.tuple.Tuple3;
+import org.apache.flink.types.Row;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link CliUtils}.
+ */
+public class CliUtilsTest {
+
+ @Test
+ public void testRowToString() throws IOException {
+ Row result = new Row(10);
+ result.setField(0, null);
+ result.setField(1, "String");
+ result.setField(2, 'c');
+ result.setField(3, false);
+ result.setField(4, 12345.67f);
+ result.setField(5, 12345.67d);
+ result.setField(6, 12345L);
+ result.setField(7, java.sql.Date.valueOf("2018-11-12"));
+ result.setField(8, new int[]{1, 2});
+ result.setField(9, new Tuple3<>(1, "123", null));
+ assertEquals(Arrays.toString(CliUtils.rowToString(result)),
+ "[(NULL), String, c, false, 12345.67, 12345.67, 12345, 2018-11-12, " +
+ "[1, 2], (1,123,null)]");
--- End diff --
If having tuple here is ok then the next strange thing is null handling inside tuples
(it is printed in lowercase and without brackets). So there are at least 2 different types
of null handling: inside tuples and all others.
---
|