You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/06/20 16:04:59 UTC

[GitHub] [flink] godfreyhe opened a new pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

godfreyhe opened a new pull request #12728:
URL: https://github.com/apache/flink/pull/12728


   
   ## What is the purpose of the change
   
   *In current implementation of PrintUtils, all result will be collected to local memory to compute column width first. this can works fine with batch query and bounded stream query. but for unbounded stream query, the result will be endless, so the result will be never printed. To solve this, we can use fix-length strategy, and print a row immediately once the row is accessed. This pr aims to fix the bug.*
   
   
   ## Brief change log
   
   *(for example:)*
     - *[hotfix] correct the logic of `truncateString` method in PrintUtils*
     - *Correct the logic of PrintUtils for unbounded stream query case*
   
   
   ## Verifying this change
   
   
   This change added tests and can be verified as follows:
   
     - *Extended PrintUtilsTest and CliTableauResultViewTest  to verify the fixes*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / **not documented**)
   


----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444047821



##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java
##########
@@ -131,14 +131,27 @@
 	 *      it... // collect same data
 	 *  }
 	 * }</pre>
+	 *
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,
+	 * call `StreamExecutionEnvironment#enableCheckpointing()` method.
+	 *
+	 * <p>Only this method or {@link #print()} method can be called for a TableResult instance,
+	 * because the result can only be accessed once.
 	 */
 	CloseableIterator<Row> collect();
 
 	/**
 	 * Print the result contents as tableau form to client console.
 	 *
-	 * <p><strong>NOTE:</strong> please make sure the result data to print should be small.
-	 * Because all data will be collected to local first, and then print them to console.
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,
+	 * call `StreamExecutionEnvironment#enableCheckpointing()` method.

Review comment:
       yes, it is required in streaming mode.




----------------------------------------------------------------
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] [flink] wuchong commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444075896



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {
+		PrintUtils.printAsTableauForm(
+				getSchema(),
+				getData().subList(0, 3).iterator(),
+				new PrintWriter(outContent),
+				PrintUtils.MAX_COLUMN_WIDTH,
+				"",
+				false, // derive column width by content
+				true);
+
+		assertEquals(
+				"+----------+---------+------------+--------+---------+----------------+------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |        int | bigint | varchar | decimal(10, 5) |              timestamp |" + System.lineSeparator() +

Review comment:
       How about `change` (kind is not so self-explained) or `op` (commonly used in CDC)?   




----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444047393



##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -705,7 +705,7 @@ public TableResult executeInternal(QueryOperation operation) {
 					.tableSchema(operation.getTableSchema())
 					.data(resultProvider.getResultIterator())
 					.setPrintStyle(TableResultImpl.PrintStyle.tableau(
-							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, isStreamingMode))
+							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, true, isStreamingMode))

Review comment:
       The batch select result may be too large to be stored in local java heap memory, so I prefer to derive column width based on type for both mode select result.




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0737868c4f2700cf24b97c6d1d623708b5a1c8a2 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] twalthr commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
twalthr commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444016557



##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -66,70 +77,102 @@ public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter) {
-		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false);
+		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false, false);
 	}
 
 	/**
 	 * Displays the result in a tableau form.
 	 *
+	 * <p><b>NOTE:</b> please make sure the data to print is small enough to be stored in java heap memory
+	 * if the column width is derived from content (`deriveColumnWidthByType` is false).
+	 *
 	 * <p>For example: (printRowKind is true)
-	 * +-------------+-------------+---------+-------------+
+	 * <pre>
+	 * +----------+-------------+---------+-------------+
 	 * | row_kind | boolean_col | int_col | varchar_col |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * |       +I |        true |       1 |         abc |
 	 * |       -U |       false |       2 |         def |
 	 * |       +U |       false |       3 |         def |
 	 * |       -D |      (NULL) |  (NULL) |      (NULL) |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * 4 rows in result
+	 * </pre>
+	 *
+	 * @param tableSchema The schema of the data to print
+	 * @param it The iterator for the data to print
+	 * @param printWriter The writer to write to
+	 * @param maxColumnWidth The max width of a column
+	 * @param nullColumn The string representation of a null value
+	 * @param deriveColumnWidthByType A flag to indicate whether the column width
+	 *        is derived from type (true) or content (false).
+	 * @param printRowKind A flag to indicate whether print row kind info
 	 */
 	public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter,
 			int maxColumnWidth,
 			String nullColumn,
+			boolean deriveColumnWidthByType,
 			boolean printRowKind) {
-		List<String[]> rows = new ArrayList<>();
-
-		// fill field names first
-		final List<TableColumn> columns;
+		final List<TableColumn> columns = tableSchema.getTableColumns();
+		String[] columnNames = columns.stream().map(TableColumn::getName).toArray(String[]::new);
 		if (printRowKind) {
-			columns = Stream.concat(
-					Stream.of(TableColumn.of("row_kind", DataTypes.STRING())),
-					tableSchema.getTableColumns().stream()
-			).collect(Collectors.toList());
-		} else {
-			columns = tableSchema.getTableColumns();
+			columnNames = Stream.concat(Stream.of(ROW_KIND_COLUMN), Arrays.stream(columnNames)).toArray(String[]::new);
 		}
 
-		rows.add(columns.stream().map(TableColumn::getName).toArray(String[]::new));
-		while (it.hasNext()) {
-			rows.add(rowToString(it.next(), nullColumn, printRowKind));
+		final int[] colWidths;
+		if (deriveColumnWidthByType) {
+			colWidths = columnWidthsByType(
+					columns,
+					maxColumnWidth,
+					nullColumn,
+					printRowKind ? ROW_KIND_COLUMN : null);
+		} else {
+			//

Review comment:
       empty comment

##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java
##########
@@ -131,14 +131,17 @@
 	 *      it... // collect same data
 	 *  }
 	 * }</pre>
+	 *
+	 * <p>Only this method or {@link #print()} method can be called for a TableResult instance,
+	 * because the result can only be accessed once.
 	 */
 	CloseableIterator<Row> collect();
 
 	/**
 	 * Print the result contents as tableau form to client console.
 	 *
-	 * <p><strong>NOTE:</strong> please make sure the result data to print should be small.
-	 * Because all data will be collected to local first, and then print them to console.
+	 * <p>only this method or {@link #collect()} ()} method can be called for a TableResult instance,

Review comment:
       invalid parenthesis in JavaDoc

##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {

Review comment:
       nit: Driver?

##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {
+		PrintUtils.printAsTableauForm(
+				getSchema(),
+				getData().subList(0, 3).iterator(),
+				new PrintWriter(outContent),
+				PrintUtils.MAX_COLUMN_WIDTH,
+				"",
+				false, // derive column width by content
+				true);
+
+		assertEquals(
+				"+----------+---------+------------+--------+---------+----------------+------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |        int | bigint | varchar | decimal(10, 5) |              timestamp |" + System.lineSeparator() +

Review comment:
       how about we make this column shorter and leave more room for the remaining column, just `kind`?

##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java
##########
@@ -131,14 +131,27 @@
 	 *      it... // collect same data
 	 *  }
 	 * }</pre>
+	 *
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,

Review comment:
       Remove
   ```
   By default, checkpointing is disabled. To enable checkpointing, call `StreamExecutionEnvironment#enableCheckpointing()` method.
   ```
   because `StreamExecutionEnvironment` is not available for pure Table API users.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -66,70 +77,102 @@ public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter) {
-		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false);
+		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false, false);
 	}
 
 	/**
 	 * Displays the result in a tableau form.
 	 *
+	 * <p><b>NOTE:</b> please make sure the data to print is small enough to be stored in java heap memory
+	 * if the column width is derived from content (`deriveColumnWidthByType` is false).
+	 *
 	 * <p>For example: (printRowKind is true)
-	 * +-------------+-------------+---------+-------------+
+	 * <pre>
+	 * +----------+-------------+---------+-------------+
 	 * | row_kind | boolean_col | int_col | varchar_col |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * |       +I |        true |       1 |         abc |
 	 * |       -U |       false |       2 |         def |
 	 * |       +U |       false |       3 |         def |
 	 * |       -D |      (NULL) |  (NULL) |      (NULL) |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * 4 rows in result
+	 * </pre>
+	 *
+	 * @param tableSchema The schema of the data to print
+	 * @param it The iterator for the data to print
+	 * @param printWriter The writer to write to
+	 * @param maxColumnWidth The max width of a column
+	 * @param nullColumn The string representation of a null value
+	 * @param deriveColumnWidthByType A flag to indicate whether the column width
+	 *        is derived from type (true) or content (false).
+	 * @param printRowKind A flag to indicate whether print row kind info
 	 */
 	public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter,
 			int maxColumnWidth,
 			String nullColumn,
+			boolean deriveColumnWidthByType,
 			boolean printRowKind) {
-		List<String[]> rows = new ArrayList<>();
-
-		// fill field names first
-		final List<TableColumn> columns;
+		final List<TableColumn> columns = tableSchema.getTableColumns();
+		String[] columnNames = columns.stream().map(TableColumn::getName).toArray(String[]::new);
 		if (printRowKind) {
-			columns = Stream.concat(
-					Stream.of(TableColumn.of("row_kind", DataTypes.STRING())),
-					tableSchema.getTableColumns().stream()
-			).collect(Collectors.toList());
-		} else {
-			columns = tableSchema.getTableColumns();
+			columnNames = Stream.concat(Stream.of(ROW_KIND_COLUMN), Arrays.stream(columnNames)).toArray(String[]::new);
 		}
 
-		rows.add(columns.stream().map(TableColumn::getName).toArray(String[]::new));
-		while (it.hasNext()) {
-			rows.add(rowToString(it.next(), nullColumn, printRowKind));
+		final int[] colWidths;
+		if (deriveColumnWidthByType) {
+			colWidths = columnWidthsByType(
+					columns,
+					maxColumnWidth,
+					nullColumn,
+					printRowKind ? ROW_KIND_COLUMN : null);
+		} else {
+			//
+			List<Row> rows = new ArrayList<>();
+			List<String[]> content = new ArrayList<>();
+			content.add(columnNames);
+			while (it.hasNext()) {
+				Row row = it.next();
+				rows.add(row);
+				content.add(rowToString(row, nullColumn, printRowKind));
+			}
+			colWidths = columnWidthsByContent(columnNames, content, maxColumnWidth);
+			it = rows.iterator();
 		}
 
-		int[] colWidths = columnWidthsByContent(columns, rows, maxColumnWidth);
-		String borderline = genBorderLine(colWidths);
-
-		// print field names
+		final String borderline = PrintUtils.genBorderLine(colWidths);
+		// print border line
 		printWriter.println(borderline);
-		printSingleRow(colWidths, rows.get(0), printWriter);
+		// print filed names

Review comment:
       nit: `field`

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -66,70 +77,102 @@ public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter) {
-		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false);
+		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false, false);
 	}
 
 	/**
 	 * Displays the result in a tableau form.
 	 *
+	 * <p><b>NOTE:</b> please make sure the data to print is small enough to be stored in java heap memory
+	 * if the column width is derived from content (`deriveColumnWidthByType` is false).
+	 *
 	 * <p>For example: (printRowKind is true)
-	 * +-------------+-------------+---------+-------------+
+	 * <pre>
+	 * +----------+-------------+---------+-------------+
 	 * | row_kind | boolean_col | int_col | varchar_col |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * |       +I |        true |       1 |         abc |
 	 * |       -U |       false |       2 |         def |
 	 * |       +U |       false |       3 |         def |
 	 * |       -D |      (NULL) |  (NULL) |      (NULL) |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * 4 rows in result
+	 * </pre>
+	 *
+	 * @param tableSchema The schema of the data to print
+	 * @param it The iterator for the data to print
+	 * @param printWriter The writer to write to
+	 * @param maxColumnWidth The max width of a column
+	 * @param nullColumn The string representation of a null value
+	 * @param deriveColumnWidthByType A flag to indicate whether the column width
+	 *        is derived from type (true) or content (false).
+	 * @param printRowKind A flag to indicate whether print row kind info
 	 */
 	public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter,
 			int maxColumnWidth,
 			String nullColumn,
+			boolean deriveColumnWidthByType,
 			boolean printRowKind) {
-		List<String[]> rows = new ArrayList<>();
-
-		// fill field names first
-		final List<TableColumn> columns;
+		final List<TableColumn> columns = tableSchema.getTableColumns();
+		String[] columnNames = columns.stream().map(TableColumn::getName).toArray(String[]::new);
 		if (printRowKind) {
-			columns = Stream.concat(
-					Stream.of(TableColumn.of("row_kind", DataTypes.STRING())),
-					tableSchema.getTableColumns().stream()
-			).collect(Collectors.toList());
-		} else {
-			columns = tableSchema.getTableColumns();
+			columnNames = Stream.concat(Stream.of(ROW_KIND_COLUMN), Arrays.stream(columnNames)).toArray(String[]::new);
 		}
 
-		rows.add(columns.stream().map(TableColumn::getName).toArray(String[]::new));
-		while (it.hasNext()) {
-			rows.add(rowToString(it.next(), nullColumn, printRowKind));
+		final int[] colWidths;
+		if (deriveColumnWidthByType) {
+			colWidths = columnWidthsByType(
+					columns,
+					maxColumnWidth,
+					nullColumn,
+					printRowKind ? ROW_KIND_COLUMN : null);
+		} else {
+			//
+			List<Row> rows = new ArrayList<>();

Review comment:
       you are using `final` above but here and below you are not using it anymore, a reader now thinks that the variable is modified but this is not the case. It would be great to use `final` consistently.

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -176,14 +229,101 @@ public static void printAsTableauForm(
 		return colWidths;
 	}
 
-	public static String genBorderLine(int[] colWidths) {
-		StringBuilder sb = new StringBuilder();
-		sb.append("+");
-		for (int width : colWidths) {
-			sb.append(EncodingUtils.repeat('-', width + 1));
-			sb.append("-+");
+	/**
+	 * Try to infer column width based on column types. In streaming case, we will have an

Review comment:
       we try to avoid the terminology `streaming` and `batch` in the code base, instead we call it `unbounded` or `bounded`




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   * 8cdd66625096a80204032acea1287401bdcd8a2f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] twalthr closed pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
twalthr closed pull request #12728:
URL: https://github.com/apache/flink/pull/12728


   


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950",
       "triggerID" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955",
       "triggerID" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   * 8cdd66625096a80204032acea1287401bdcd8a2f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948) 
   * 8a326af40d9a35ee0b967fb2e7ffaf05724a6473 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950) 
   * b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950",
       "triggerID" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955",
       "triggerID" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   * 8cdd66625096a80204032acea1287401bdcd8a2f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0737868c4f2700cf24b97c6d1d623708b5a1c8a2 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863) 
   * 2ce6cf5a5e67f2cc85cd156ac257c783f0fca503 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] wuchong commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444005803



##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java
##########
@@ -131,14 +131,27 @@
 	 *      it... // collect same data
 	 *  }
 	 * }</pre>
+	 *
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,
+	 * call `StreamExecutionEnvironment#enableCheckpointing()` method.
+	 *
+	 * <p>Only this method or {@link #print()} method can be called for a TableResult instance,
+	 * because the result can only be accessed once.

Review comment:
       NOTE: In order to fetch result, you can call either {@link #print()} or {@link #collect()}. But, they can't be called both on the same {@link TableResult} instance, because the result can only be accessed once.
   
   
   What do you think?

##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java
##########
@@ -131,14 +131,27 @@
 	 *      it... // collect same data
 	 *  }
 	 * }</pre>
+	 *
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,
+	 * call `StreamExecutionEnvironment#enableCheckpointing()` method.
+	 *
+	 * <p>Only this method or {@link #print()} method can be called for a TableResult instance,
+	 * because the result can only be accessed once.
 	 */
 	CloseableIterator<Row> collect();
 
 	/**
 	 * Print the result contents as tableau form to client console.
 	 *
-	 * <p><strong>NOTE:</strong> please make sure the result data to print should be small.
-	 * Because all data will be collected to local first, and then print them to console.
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,
+	 * call `StreamExecutionEnvironment#enableCheckpointing()` method.

Review comment:
       What if it is called in batch mode? IIUC, this is only required in streaming mode?

##########
File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/PrintUtils.java
##########
@@ -66,70 +77,102 @@ public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter) {
-		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false);
+		printAsTableauForm(tableSchema, it, printWriter, MAX_COLUMN_WIDTH, NULL_COLUMN, false, false);
 	}
 
 	/**
 	 * Displays the result in a tableau form.
 	 *
+	 * <p><b>NOTE:</b> please make sure the data to print is small enough to be stored in java heap memory
+	 * if the column width is derived from content (`deriveColumnWidthByType` is false).
+	 *
 	 * <p>For example: (printRowKind is true)
-	 * +-------------+-------------+---------+-------------+
+	 * <pre>
+	 * +----------+-------------+---------+-------------+
 	 * | row_kind | boolean_col | int_col | varchar_col |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * |       +I |        true |       1 |         abc |
 	 * |       -U |       false |       2 |         def |
 	 * |       +U |       false |       3 |         def |
 	 * |       -D |      (NULL) |  (NULL) |      (NULL) |
-	 * +-------------+-------------+---------+-------------+
+	 * +----------+-------------+---------+-------------+
 	 * 4 rows in result
+	 * </pre>
+	 *
+	 * @param tableSchema The schema of the data to print
+	 * @param it The iterator for the data to print
+	 * @param printWriter The writer to write to
+	 * @param maxColumnWidth The max width of a column
+	 * @param nullColumn The string representation of a null value
+	 * @param deriveColumnWidthByType A flag to indicate whether the column width
+	 *        is derived from type (true) or content (false).
+	 * @param printRowKind A flag to indicate whether print row kind info
 	 */
 	public static void printAsTableauForm(
 			TableSchema tableSchema,
 			Iterator<Row> it,
 			PrintWriter printWriter,
 			int maxColumnWidth,
 			String nullColumn,
+			boolean deriveColumnWidthByType,
 			boolean printRowKind) {
-		List<String[]> rows = new ArrayList<>();
-
-		// fill field names first
-		final List<TableColumn> columns;
+		final List<TableColumn> columns = tableSchema.getTableColumns();
+		String[] columnNames = columns.stream().map(TableColumn::getName).toArray(String[]::new);
 		if (printRowKind) {
-			columns = Stream.concat(
-					Stream.of(TableColumn.of("row_kind", DataTypes.STRING())),
-					tableSchema.getTableColumns().stream()
-			).collect(Collectors.toList());
-		} else {
-			columns = tableSchema.getTableColumns();
+			columnNames = Stream.concat(Stream.of(ROW_KIND_COLUMN), Arrays.stream(columnNames)).toArray(String[]::new);
 		}
 
-		rows.add(columns.stream().map(TableColumn::getName).toArray(String[]::new));
-		while (it.hasNext()) {
-			rows.add(rowToString(it.next(), nullColumn, printRowKind));
+		final int[] colWidths;
+		if (deriveColumnWidthByType) {
+			colWidths = columnWidthsByType(
+					columns,
+					maxColumnWidth,
+					nullColumn,
+					printRowKind ? ROW_KIND_COLUMN : null);
+		} else {
+			//

Review comment:
       remove?

##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -705,7 +705,7 @@ public TableResult executeInternal(QueryOperation operation) {
 					.tableSchema(operation.getTableSchema())
 					.data(resultProvider.getResultIterator())
 					.setPrintStyle(TableResultImpl.PrintStyle.tableau(
-							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, isStreamingMode))
+							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, true, isStreamingMode))

Review comment:
       Can we use `isStreamingMode` for the `deriveColumnWidthByType` instead of hard code to `true`? 
   
   In my understanding, we can derive width by content if it is batch mode.




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950",
       "triggerID" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955",
       "triggerID" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8cdd66625096a80204032acea1287401bdcd8a2f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948) 
   * 8a326af40d9a35ee0b967fb2e7ffaf05724a6473 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950) 
   * b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0737868c4f2700cf24b97c6d1d623708b5a1c8a2 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863) 
   * 2ce6cf5a5e67f2cc85cd156ac257c783f0fca503 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647014208


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 0737868c4f2700cf24b97c6d1d623708b5a1c8a2 (Sat Jun 20 16:06:41 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-18399).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   * 8cdd66625096a80204032acea1287401bdcd8a2f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948) 
   * 8a326af40d9a35ee0b967fb2e7ffaf05724a6473 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] wuchong commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-648221649


   FYI: I merged the one for release-1.11 #12752


----------------------------------------------------------------
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] [flink] wuchong commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444075896



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {
+		PrintUtils.printAsTableauForm(
+				getSchema(),
+				getData().subList(0, 3).iterator(),
+				new PrintWriter(outContent),
+				PrintUtils.MAX_COLUMN_WIDTH,
+				"",
+				false, // derive column width by content
+				true);
+
+		assertEquals(
+				"+----------+---------+------------+--------+---------+----------------+------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |        int | bigint | varchar | decimal(10, 5) |              timestamp |" + System.lineSeparator() +

Review comment:
       How about `change` (kind is not so self-explained) or `op`?   




----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444066174



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {
+		PrintUtils.printAsTableauForm(
+				getSchema(),
+				getData().subList(0, 3).iterator(),
+				new PrintWriter(outContent),
+				PrintUtils.MAX_COLUMN_WIDTH,
+				"",
+				false, // derive column width by content
+				true);
+
+		assertEquals(
+				"+----------+---------+------------+--------+---------+----------------+------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |        int | bigint | varchar | decimal(10, 5) |              timestamp |" + System.lineSeparator() +

Review comment:
       `kind` may be too generic, and it might be a user-defined field.




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950",
       "triggerID" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955",
       "triggerID" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8a326af40d9a35ee0b967fb2e7ffaf05724a6473 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950) 
   * b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3955) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * ed25e698b05791c8bf8d4204ff32689cea42fc40 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * ed25e698b05791c8bf8d4204ff32689cea42fc40 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926) 
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] twalthr commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
twalthr commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-648261386


   Thanks for the notice @wuchong. I didn't know that there were two PRs for the different branches.


----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444047393



##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -705,7 +705,7 @@ public TableResult executeInternal(QueryOperation operation) {
 					.tableSchema(operation.getTableSchema())
 					.data(resultProvider.getResultIterator())
 					.setPrintStyle(TableResultImpl.PrintStyle.tableau(
-							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, isStreamingMode))
+							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, true, isStreamingMode))

Review comment:
       The batch select result may be very large to be stored in local java heap memory, so I prefer to derive column width based on type for both mode select result.




----------------------------------------------------------------
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] [flink] godfreyhe edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-648020411


   > They are rather confused about having no output by default.
   
   agree with you, for 1.11, we throw an exception if checkpoint is not enabled for streaming query. @TsReaper have opened a pr https://github.com/apache/flink/pull/12750. In 1.12, we will support at least once semantics soon


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ce6cf5a5e67f2cc85cd156ac257c783f0fca503 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444047393



##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -705,7 +705,7 @@ public TableResult executeInternal(QueryOperation operation) {
 					.tableSchema(operation.getTableSchema())
 					.data(resultProvider.getResultIterator())
 					.setPrintStyle(TableResultImpl.PrintStyle.tableau(
-							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, isStreamingMode))
+							PrintUtils.MAX_COLUMN_WIDTH, PrintUtils.NULL_COLUMN, true, isStreamingMode))

Review comment:
       The batch select result may be very large to be stored in local java heap memory, so I prefer to derive column type for both mode select result.




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ce6cf5a5e67f2cc85cd156ac257c783f0fca503 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895) 
   * ed25e698b05791c8bf8d4204ff32689cea42fc40 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444089370



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {
+		PrintUtils.printAsTableauForm(
+				getSchema(),
+				getData().subList(0, 3).iterator(),
+				new PrintWriter(outContent),
+				PrintUtils.MAX_COLUMN_WIDTH,
+				"",
+				false, // derive column width by content
+				true);
+
+		assertEquals(
+				"+----------+---------+------------+--------+---------+----------------+------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |        int | bigint | varchar | decimal(10, 5) |              timestamp |" + System.lineSeparator() +

Review comment:
       `op` is good to me




----------------------------------------------------------------
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] [flink] wuchong commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444075896



##########
File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/utils/PrintUtilsTest.java
##########
@@ -145,28 +168,55 @@ public void testPrintWithMultipleRowsAndRowKind() {
 				new PrintWriter(outContent),
 				PrintUtils.MAX_COLUMN_WIDTH,
 				"",
+				true, // derive column width by type
 				true);
 
 		// note: the expected result may look irregular because every CJK(Chinese/Japanese/Korean) character's
 		// width < 2 in IDE by default, every CJK character usually's width is 2, you can open this source file
 		// by vim or just cat the file to check the regular result.
+		// The last row of `varchar` value will pad with two ' ' before the column.
+		// Because the length of `これは日本語をテストするた` plus the length of `...` is 29,
+		// no more Japanese character can be added to the line.
 		assertEquals(
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
-				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |\n" +
-				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |\n" +
-				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |\n" +
-				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |\n" +
-				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |\n" +
-				"|       -U |         |          -1 |                   -1 |     abcdefghijklmnopqrstuvwxyz |   -12345.06789 |                            |\n" +
-				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |\n" +
-				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+\n" +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |         int |               bigint |                        varchar | decimal(10, 5) |                  timestamp |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
+				"|       +I |         |           1 |                    2 |                            abc |           1.23 |      2020-03-01 18:39:14.0 |" + System.lineSeparator() +
+				"|       +I |   false |             |                    0 |                                |              1 |      2020-03-01 18:39:14.1 |" + System.lineSeparator() +
+				"|       -D |    true |  2147483647 |                      |                        abcdefg |     1234567890 |     2020-03-01 18:39:14.12 |" + System.lineSeparator() +
+				"|       +I |   false | -2147483648 |  9223372036854775807 |                                |    12345.06789 |    2020-03-01 18:39:14.123 |" + System.lineSeparator() +
+				"|       +I |    true |         100 | -9223372036854775808 |                     abcdefg111 |                | 2020-03-01 18:39:14.123456 |" + System.lineSeparator() +
+				"|       -U |         |          -1 |                   -1 | abcdefghijklmnopqrstuvwxyza... |   -12345.06789 |                            |" + System.lineSeparator() +
+				"|       +U |         |          -1 |                   -1 |                   这是一段中文 |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"|       -D |         |          -1 |                   -1 |  これは日本語をテストするた... |   -12345.06789 |      2020-03-04 18:39:14.0 |" + System.lineSeparator() +
+				"+----------+---------+-------------+----------------------+--------------------------------+----------------+----------------------------+" + System.lineSeparator() +
 				"8 rows in set" + System.lineSeparator(),
 				outContent.toString());
 	}
 
+	@Test
+	public void testPrintWithMultipleRowsAndDriverColumnWidthByContent() {
+		PrintUtils.printAsTableauForm(
+				getSchema(),
+				getData().subList(0, 3).iterator(),
+				new PrintWriter(outContent),
+				PrintUtils.MAX_COLUMN_WIDTH,
+				"",
+				false, // derive column width by content
+				true);
+
+		assertEquals(
+				"+----------+---------+------------+--------+---------+----------------+------------------------+" + System.lineSeparator() +
+				"| row_kind | boolean |        int | bigint | varchar | decimal(10, 5) |              timestamp |" + System.lineSeparator() +

Review comment:
       How about `change` (kind is not so self-explained)?   




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948",
       "triggerID" : "8cdd66625096a80204032acea1287401bdcd8a2f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950",
       "triggerID" : "8a326af40d9a35ee0b967fb2e7ffaf05724a6473",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   * 8cdd66625096a80204032acea1287401bdcd8a2f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3948) 
   * 8a326af40d9a35ee0b967fb2e7ffaf05724a6473 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3950) 
   * b6b8ffacb0a76a8842e98b0ae3d3f3190732fa88 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] godfreyhe commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-648020411


   > They are rather confused about having no output by default.
   
   agree with you, for 1.11, we throw an exception if checkpoint is not enabled for streaming query. @TsReaper have open a pr https://github.com/apache/flink/pull/12750. In 1.12, we will support at least once semantics soon


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * ed25e698b05791c8bf8d4204ff32689cea42fc40 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926) 
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] twalthr commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
twalthr commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-648129590


   Merging...


----------------------------------------------------------------
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] [flink] godfreyhe commented on a change in pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on a change in pull request #12728:
URL: https://github.com/apache/flink/pull/12728#discussion_r444052314



##########
File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/TableResult.java
##########
@@ -131,14 +131,27 @@
 	 *      it... // collect same data
 	 *  }
 	 * }</pre>
+	 *
+	 * <p>This method guarantees end-to-end exactly-once record delivery
+	 * which requires the checkpointing mechanism to be enabled.
+	 * By default, checkpointing is disabled. To enable checkpointing,

Review comment:
       change to: `By default, checkpointing is disabled. To enable checkpointing, set checkpointing properties (see ExecutionCheckpointingOptions) through {@link TableConfig#getConfiguration()}.`




----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2ce6cf5a5e67f2cc85cd156ac257c783f0fca503 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895) 
   * ed25e698b05791c8bf8d4204ff32689cea42fc40 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0737868c4f2700cf24b97c6d1d623708b5a1c8a2 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] godfreyhe commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647892983


   cc @twalthr @wuchong


----------------------------------------------------------------
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] [flink] godfreyhe commented on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
godfreyhe commented on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-648005788


   @wuchong @twalthr Thanks for the suggestions, I have updated the pr based on comments, please take another look


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0737868c4f2700cf24b97c6d1d623708b5a1c8a2 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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] [flink] flinkbot edited a comment on pull request #12728: [FLINK-18399] [table-api-java] fix TableResult#print can not print the result of unbounded stream query

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12728:
URL: https://github.com/apache/flink/pull/12728#issuecomment-647015309


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3863",
       "triggerID" : "0737868c4f2700cf24b97c6d1d623708b5a1c8a2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3895",
       "triggerID" : "2ce6cf5a5e67f2cc85cd156ac257c783f0fca503",
       "triggerType" : "PUSH"
     }, {
       "hash" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3926",
       "triggerID" : "ed25e698b05791c8bf8d4204ff32689cea42fc40",
       "triggerType" : "PUSH"
     }, {
       "hash" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939",
       "triggerID" : "70dd97ae9379c3de39d32abdbd7bda496f214d53",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 70dd97ae9379c3de39d32abdbd7bda496f214d53 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3939) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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